]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Factorization IntersectorPlanar Intersector3D coming soon.
authorageay <ageay>
Fri, 23 Oct 2009 05:41:15 +0000 (05:41 +0000)
committerageay <ageay>
Fri, 23 Oct 2009 05:41:15 +0000 (05:41 +0000)
src/INTERP_KERNEL/InterpolationPlanar.txx
src/INTERP_KERNEL/Intersector3D.hxx
src/INTERP_KERNEL/Intersector3D.txx

index eca6069aeaa95f93828568b0a7e62c6db36793fa..d22325813aed51cac4bb0ce552aea06f9ac4e193 100644 (file)
@@ -173,7 +173,7 @@ namespace INTERP_KERNEL
                                                                                                 InterpolationOptions::getPrecision(),
                                                                                                 InterpolationOptions::getOrientation());
             break;
-          case PointLocator2D:
+          case PointLocator:
             intersector=new PointLocator2DIntersector<MyMeshType,MatrixType,PlanarIntersectorP0P0>(myMeshT, myMeshS, _dim_caracteristic,
                                                                                                    InterpolationOptions::getMaxDistance3DSurfIntersect(),
                                                                                                    InterpolationOptions::getMedianPlane(),
@@ -210,7 +210,7 @@ namespace INTERP_KERNEL
                                                                                                 InterpolationOptions::getPrecision(),
                                                                                                 InterpolationOptions::getOrientation());
             break;
-          case PointLocator2D:
+          case PointLocator:
             intersector=new PlanarIntersectorP0P1PL<MyMeshType,MatrixType>(myMeshT, myMeshS, _dim_caracteristic,
                                                                            InterpolationOptions::getMaxDistance3DSurfIntersect(),
                                                                            InterpolationOptions::getMedianPlane(),
@@ -247,7 +247,7 @@ namespace INTERP_KERNEL
                                                                                                 InterpolationOptions::getPrecision(),
                                                                                                 InterpolationOptions::getOrientation());
             break;
-          case PointLocator2D:
+          case PointLocator:
             intersector=new PlanarIntersectorP1P0PL<MyMeshType,MatrixType>(myMeshT, myMeshS, _dim_caracteristic,
                                                                        InterpolationOptions::getMaxDistance3DSurfIntersect(),
                                                                        InterpolationOptions::getMedianPlane(),
@@ -284,8 +284,8 @@ namespace INTERP_KERNEL
                                                                                                 InterpolationOptions::getPrecision(),
                                                                                                 InterpolationOptions::getOrientation());
         break;
-      case PointLocator2D:
-        throw INTERP_KERNEL::Exception("Invalid intersector (PointLocator2D) for P1P0Bary !");
+      case PointLocator:
+        throw INTERP_KERNEL::Exception("Invalid intersector (PointLocator) for P1P0Bary !");
         break;
       }
     }
@@ -317,7 +317,7 @@ namespace INTERP_KERNEL
                                                                                                 InterpolationOptions::getPrecision(),
                                                                                                 InterpolationOptions::getOrientation());
             break;
-          case PointLocator2D:
+          case PointLocator:
             intersector=new PlanarIntersectorP1P1PL<MyMeshType,MatrixType>(myMeshT, myMeshS, _dim_caracteristic,
                                                                            InterpolationOptions::getMaxDistance3DSurfIntersect(),
                                                                            InterpolationOptions::getMedianPlane(),
index 8b3f4c3cf4da448feba383b09ed1b050845e1e03..1bfbd898d1074d5fcc7a0415a255440738336053 100644 (file)
@@ -26,8 +26,18 @@ namespace INTERP_KERNEL
   template<class MyMeshType, class MyMatrix>
   class Intersector3D : public TargetIntersector<MyMeshType,MyMatrix>
   {
+  public:
+    static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
+    static const int MESHDIM=MyMeshType::MY_MESHDIM;
+    typedef typename MyMeshType::MyConnType ConnType;
+    static const NumberingPolicy numPol=MyMeshType::My_numPol;
   public:
     Intersector3D(const MyMeshType& targetMesh, const MyMeshType& srcMesh);
+    void getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT) const;
+    void getRealSourceCoordinates(ConnType icellT, std::vector<double>& coordsT) const;
+    const ConnType *getStartConnOfTargetCell(ConnType icellT) const;
+    const ConnType *getStartConnOfSourceCell(ConnType icellS) const;
+    void getConnOfSourceCell(ConnType icellS, typename std::vector<ConnType>& res) const;
   protected:
     const MyMeshType& _target_mesh;
     const MyMeshType& _src_mesh;
index 523ab8f7b5dfe49fee4c98466978a6d40bf18668..501bb861d59675a4948e880b70c460358aabb2f1 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "Intersector3D.hxx"
 
+#include <algorithm>
+
 namespace INTERP_KERNEL
 {
   template<class MyMeshType, class MyMatrix>
@@ -28,7 +30,77 @@ namespace INTERP_KERNEL
   {
   }
 
-  
+  /*!
+   * @param icellT in format of MyMeshType.
+   */
+  template<class MyMeshType, class MyMatrix>
+  void Intersector3D<MyMeshType,MyMatrix>::getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT) const
+  {
+    const ConnType *myConectT=_target_mesh.getConnectivityPtr();
+    const ConnType *myConIndexT=_target_mesh.getConnectivityIndexPtr();
+    const double *myCoordsT=_target_mesh.getCoordinatesPtr();
+    int nbNodesT=myConIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1]-myConIndexT[OTT<ConnType,numPol>::ind2C(icellT)];
+    coordsT.resize(SPACEDIM*nbNodesT);
+    for (ConnType iT=0; iT<nbNodesT; iT++)
+      for(int idim=0; idim<SPACEDIM; idim++)
+        coordsT[SPACEDIM*iT+idim]=myCoordsT[SPACEDIM*OTT<ConnType,numPol>::coo2C(myConectT[OTT<ConnType,numPol>::conn2C(myConIndexT[OTT<ConnType,numPol>::ind2C(icellT)]+iT)])+idim];
+  }
+
+  /*!
+   * @param icellT in format of MyMeshType.
+   */
+  template<class MyMeshType, class MyMatrix>
+  void Intersector3D<MyMeshType,MyMatrix>::getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS) const
+  {
+    const ConnType *myConectS=_src_mesh.getConnectivityPtr();
+    const ConnType *myConIndexS=_src_mesh.getConnectivityIndexPtr();
+    const double *myCoordsS=_src_mesh.getCoordinatesPtr();
+    int nbNodesS=myConIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1]-myConIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
+    coordsS.resize(SPACEDIM*nbNodesS);
+    for (ConnType iS=0; iS<nbNodesS; iS++)
+      for(int idim=0; idim<SPACEDIM; idim++)
+        coordsS[SPACEDIM*iS+idim]=myCoordsS[SPACEDIM*OTT<ConnType,numPol>::coo2C(myConectS[OTT<ConnType,numPol>::conn2C(myConIndexS[OTT<ConnType,numPol>::ind2C(icellS)]+iS)])+idim];
+  }
+
+  /*!
+   * @param icellT in C format.
+   * @return is in format of MyMeshType
+   */
+  template<class MyMeshType, class MyMatrix>
+  const typename MyMeshType::MyConnType *Intersector3D<MyMeshType,MyMatrix>::getStartConnOfTargetCell(ConnType icellT) const
+  {
+    const ConnType *myConectT=_target_mesh.getConnectivityPtr();
+    const ConnType *myConIndexT=_target_mesh.getConnectivityIndexPtr();
+    return myConectT+OTT<ConnType,numPol>::conn2C(myConIndexT[icellT]);
+  }
+
+  /*!
+   * @param icellT in C format.
+   * @return is in format of MyMeshType
+   */
+  template<class MyMeshType, class MyMatrix>
+  const typename MyMeshType::MyConnType *Intersector3D<MyMeshType,MyMatrix>::getStartConnOfSourceCell(ConnType icellS) const
+  {
+    const ConnType *myConectS=_src_mesh.getConnectivityPtr();
+    const ConnType *myConIndexS=_src_mesh.getConnectivityIndexPtr();
+    return myConectS+OTT<ConnType,numPol>::conn2C(myConIndexS[icellS]);
+  }
+
+  /*!
+   * @param icellS in format of MyMeshType.
+   * @param res ; out param in format of MyMeshType.
+   */
+  template<class MyMeshType, class MyMatrix>
+  void Intersector3D<MyMeshType,MyMatrix>::getConnOfSourceCell(ConnType icellS, typename std::vector<ConnType>& res) const
+  {
+    const ConnType *myConectS=_src_mesh.getConnectivityPtr();
+    const ConnType *myConIndexS=_src_mesh.getConnectivityIndexPtr();
+    ConnType start=myConIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
+    ConnType end=myConIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1];
+    int nbNodesS=end-start;
+    res.resize(nbNodesS);
+    std::copy(myConectS+OTT<ConnType,numPol>::conn2C(start),myConectS+OTT<ConnType,numPol>::conn2C(end),res.begin());
+  }
 }
 
 #endif