Back to index

salome-med  6.5.0
IntersectorCU.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2009-2012  OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 // File      : IntersectorCU.hxx
00020 // Created   : Thu Dec 17 12:30:17 2009
00021 // Author    : Edward AGAPOV (eap)
00022 //
00023 
00024 #ifndef __IntersectorCU_HXX__
00025 #define __IntersectorCU_HXX__
00026 
00027 #include "TargetIntersector.hxx"
00028 #include "NormalizedUnstructuredMesh.hxx"
00029 
00030 namespace INTERP_KERNEL
00031 {
00032   template<class MyCMeshType, class MyUMeshType, class MyMatrix> class _StabIntersector;
00033 
00034   template<class MyCMeshType, class MyUMeshType, class MyMatrix, class ConcreteIntersector=_StabIntersector<MyCMeshType,MyUMeshType,MyMatrix> >
00035   class IntersectorCU : public TargetIntersector<MyCMeshType,MyMatrix>
00036   {
00037   public:
00038     static const int SPACEDIM=MyCMeshType::MY_SPACEDIM;
00039     static const int MESHDIM=MyCMeshType::MY_MESHDIM;
00040     typedef typename MyUMeshType::MyConnType UConnType;
00041     typedef typename MyCMeshType::MyConnType CConnType;
00042   public:
00044     IntersectorCU(const MyCMeshType& meshS, const MyUMeshType& meshT);
00046     virtual ~IntersectorCU();
00047     void getUElemBB(double* bb, UConnType iP);
00048     void getUCoordinates(UConnType icell, std::vector<double>& coords);
00049 
00050     int getNumberOfRowsOfResMatrix() const;
00051     int getNumberOfColsOfResMatrix() const;
00052     void intersectCells(CConnType icellU, const std::vector<CConnType>& icellC, MyMatrix& res);
00053     double intersectGeometry(CConnType icellT, const std::vector<CConnType>& icellC) { return asLeaf().intersectGeometry(icellT,icellC); }
00054   protected:
00055     ConcreteIntersector& asLeaf() { return static_cast<ConcreteIntersector&>(*this); }
00056 
00057   protected:
00058     const UConnType *_connectU;
00059     const UConnType *_connIndexU;
00060     const double *  _coordsU;
00061     const MyUMeshType& _meshU;
00062 
00063     const double *     _coordsC[SPACEDIM];
00064     int                _nbCellsC[SPACEDIM];
00065     const MyCMeshType& _meshC;
00066   };
00067 
00068   // class to enable usage of IntersectorCU not for intersection but for access to data it encapsulates
00069   template<class MyCMeshType, class MyUMeshType, class MyMatrix>
00070   class _StabIntersector: public IntersectorCU<MyCMeshType, MyUMeshType, MyMatrix, _StabIntersector<MyCMeshType, MyUMeshType, MyMatrix> >
00071   {
00072   public:
00073     _StabIntersector(const MyCMeshType& meshS, const MyUMeshType& meshT) : IntersectorCU<MyCMeshType, MyUMeshType, MyMatrix, _StabIntersector<MyCMeshType, MyUMeshType, MyMatrix> >(meshS, meshT) {}
00074     double intersectGeometry(typename MyUMeshType::MyConnType icellT, const std::vector<typename MyCMeshType::MyConnType>& icellC) { throw Exception("You must provide an intersector as the 4-th template argument of IntersectorCU"); return 0; }
00075   };
00076 }
00077 
00078 #endif