From: ageay Date: Fri, 23 Oct 2009 05:41:15 +0000 (+0000) Subject: Factorization IntersectorPlanar Intersector3D coming soon. X-Git-Tag: V5_1_main_FINAL~301 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3e51471f22d7104c7adca742159fe3b2f3e4538e;p=tools%2Fmedcoupling.git Factorization IntersectorPlanar Intersector3D coming soon. --- diff --git a/src/INTERP_KERNEL/InterpolationPlanar.txx b/src/INTERP_KERNEL/InterpolationPlanar.txx index eca6069ae..d22325813 100644 --- a/src/INTERP_KERNEL/InterpolationPlanar.txx +++ b/src/INTERP_KERNEL/InterpolationPlanar.txx @@ -173,7 +173,7 @@ namespace INTERP_KERNEL InterpolationOptions::getPrecision(), InterpolationOptions::getOrientation()); break; - case PointLocator2D: + case PointLocator: intersector=new PointLocator2DIntersector(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(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(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(myMeshT, myMeshS, _dim_caracteristic, InterpolationOptions::getMaxDistance3DSurfIntersect(), InterpolationOptions::getMedianPlane(), diff --git a/src/INTERP_KERNEL/Intersector3D.hxx b/src/INTERP_KERNEL/Intersector3D.hxx index 8b3f4c3cf..1bfbd898d 100644 --- a/src/INTERP_KERNEL/Intersector3D.hxx +++ b/src/INTERP_KERNEL/Intersector3D.hxx @@ -26,8 +26,18 @@ namespace INTERP_KERNEL template class Intersector3D : public TargetIntersector { + 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& coordsT) const; + void getRealSourceCoordinates(ConnType icellT, std::vector& coordsT) const; + const ConnType *getStartConnOfTargetCell(ConnType icellT) const; + const ConnType *getStartConnOfSourceCell(ConnType icellS) const; + void getConnOfSourceCell(ConnType icellS, typename std::vector& res) const; protected: const MyMeshType& _target_mesh; const MyMeshType& _src_mesh; diff --git a/src/INTERP_KERNEL/Intersector3D.txx b/src/INTERP_KERNEL/Intersector3D.txx index 523ab8f7b..501bb861d 100644 --- a/src/INTERP_KERNEL/Intersector3D.txx +++ b/src/INTERP_KERNEL/Intersector3D.txx @@ -21,6 +21,8 @@ #include "Intersector3D.hxx" +#include + namespace INTERP_KERNEL { template @@ -28,7 +30,77 @@ namespace INTERP_KERNEL { } - + /*! + * @param icellT in format of MyMeshType. + */ + template + void Intersector3D::getRealTargetCoordinates(ConnType icellT, std::vector& coordsT) const + { + const ConnType *myConectT=_target_mesh.getConnectivityPtr(); + const ConnType *myConIndexT=_target_mesh.getConnectivityIndexPtr(); + const double *myCoordsT=_target_mesh.getCoordinatesPtr(); + int nbNodesT=myConIndexT[OTT::ind2C(icellT)+1]-myConIndexT[OTT::ind2C(icellT)]; + coordsT.resize(SPACEDIM*nbNodesT); + for (ConnType iT=0; iT::coo2C(myConectT[OTT::conn2C(myConIndexT[OTT::ind2C(icellT)]+iT)])+idim]; + } + + /*! + * @param icellT in format of MyMeshType. + */ + template + void Intersector3D::getRealSourceCoordinates(ConnType icellS, std::vector& coordsS) const + { + const ConnType *myConectS=_src_mesh.getConnectivityPtr(); + const ConnType *myConIndexS=_src_mesh.getConnectivityIndexPtr(); + const double *myCoordsS=_src_mesh.getCoordinatesPtr(); + int nbNodesS=myConIndexS[OTT::ind2C(icellS)+1]-myConIndexS[OTT::ind2C(icellS)]; + coordsS.resize(SPACEDIM*nbNodesS); + for (ConnType iS=0; iS::coo2C(myConectS[OTT::conn2C(myConIndexS[OTT::ind2C(icellS)]+iS)])+idim]; + } + + /*! + * @param icellT in C format. + * @return is in format of MyMeshType + */ + template + const typename MyMeshType::MyConnType *Intersector3D::getStartConnOfTargetCell(ConnType icellT) const + { + const ConnType *myConectT=_target_mesh.getConnectivityPtr(); + const ConnType *myConIndexT=_target_mesh.getConnectivityIndexPtr(); + return myConectT+OTT::conn2C(myConIndexT[icellT]); + } + + /*! + * @param icellT in C format. + * @return is in format of MyMeshType + */ + template + const typename MyMeshType::MyConnType *Intersector3D::getStartConnOfSourceCell(ConnType icellS) const + { + const ConnType *myConectS=_src_mesh.getConnectivityPtr(); + const ConnType *myConIndexS=_src_mesh.getConnectivityIndexPtr(); + return myConectS+OTT::conn2C(myConIndexS[icellS]); + } + + /*! + * @param icellS in format of MyMeshType. + * @param res ; out param in format of MyMeshType. + */ + template + void Intersector3D::getConnOfSourceCell(ConnType icellS, typename std::vector& res) const + { + const ConnType *myConectS=_src_mesh.getConnectivityPtr(); + const ConnType *myConIndexS=_src_mesh.getConnectivityIndexPtr(); + ConnType start=myConIndexS[OTT::ind2C(icellS)]; + ConnType end=myConIndexS[OTT::ind2C(icellS)+1]; + int nbNodesS=end-start; + res.resize(nbNodesS); + std::copy(myConectS+OTT::conn2C(start),myConectS+OTT::conn2C(end),res.begin()); + } } #endif