Salome HOME
Add test for .mesh file format
[tools/medcoupling.git] / src / INTERP_KERNEL / PlanarIntersectorP1P1PL.txx
index 37eb3348b35e2541644b0503607b9acba3437083..45692ac8880a11c9f0138d2e86f480d5027aaa6b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -31,9 +31,9 @@ namespace INTERP_KERNEL
 {
   template<class MyMeshType, class MyMatrix>
   PlanarIntersectorP1P1PL<MyMeshType,MyMatrix>::PlanarIntersectorP1P1PL(const MyMeshType& meshT, const MyMeshType& meshS,
-                                                                        double dimCaracteristic, double md3DSurf,
+                                                                        double dimCaracteristic, double md3DSurf, double minDot3DSurf,
                                                                         double medianPlane, double precision, int orientation):
-    PlanarIntersector<MyMeshType,MyMatrix>(meshT,meshS,dimCaracteristic,precision,md3DSurf,medianPlane,true,orientation,0)
+    PlanarIntersector<MyMeshType,MyMatrix>(meshT,meshS,dimCaracteristic,precision,md3DSurf,minDot3DSurf,medianPlane,true,orientation,0)
   {
   }
 
@@ -41,30 +41,30 @@ namespace INTERP_KERNEL
   void PlanarIntersectorP1P1PL<MyMeshType,MyMatrix>::intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res)
   {
     std::vector<double> CoordsT;
-    PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),CoordsT);
-    int nbOfNodesT=CoordsT.size()/SPACEDIM;
+    this->getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),CoordsT);
+    ConnType nbOfNodesT=ToConnType(CoordsT.size())/SPACEDIM;
     for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
       {
-        NormalizedCellType tS=PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iter));
+        NormalizedCellType tS=this->_meshS.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iter));
         if(tS!=NORM_TRI3)
           throw INTERP_KERNEL::Exception("Invalid source cell detected for meshdim==2. Only TRI3 supported !");
         std::vector<double> CoordsS;
-        PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(OTT<ConnType,numPol>::indFC(*iter),CoordsS);
+        this->getRealSourceCoordinates(OTT<ConnType,numPol>::indFC(*iter),CoordsS);
         std::vector<double> CoordsTTmp(CoordsT);
         if(SPACEDIM==3)
-          PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&CoordsS[0],&CoordsTTmp[0],CoordsS.size()/SPACEDIM,nbOfNodesT);
-        const ConnType *startOfCellNodeConnT=PlanarIntersector<MyMeshType,MyMatrix>::_connectT+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT]);
+          this->projectionThis(CoordsS.data(),CoordsTTmp.data(),ToConnType(CoordsS.size())/SPACEDIM,nbOfNodesT);
+        const ConnType *startOfCellNodeConnT=this->_connectT+OTT<ConnType,numPol>::conn2C(this->_connIndexT[icellT]);
         for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
           {
             typename MyMatrix::value_type& resRow=res[OTT<ConnType,numPol>::ind2C(startOfCellNodeConnT[nodeIdT])];
-            if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg2D(&CoordsTTmp[nodeIdT*SPACEDIM],&CoordsS[0],3,PlanarIntersector<MyMeshType,MyMatrix>::_precision) )
+            if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg2DSimple(CoordsTTmp.data()+nodeIdT*SPACEDIM,CoordsS.data(),3,this->_precision) )
               {
                 double resLoc[3];
                 barycentric_coords<SPACEDIM>(&CoordsS[0],&CoordsTTmp[nodeIdT*SPACEDIM],resLoc);
-                const ConnType *startOfCellNodeConnS=PlanarIntersector<MyMeshType,MyMatrix>::_connectS+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[*iter]);
+                const ConnType *startOfCellNodeConnS=this->_connectS+OTT<ConnType,numPol>::conn2C(this->_connIndexS[*iter]);
                 for(int nodeIdS=0;nodeIdS<3;nodeIdS++)
                   {
-                    if(fabs(resLoc[nodeIdS])>PlanarIntersector<MyMeshType,MyMatrix>::_precision)
+                    if(fabs(resLoc[nodeIdS])>this->_precision)
                       {
                         ConnType curNodeSInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConnS[nodeIdS]);
                         typename MyMatrix::value_type::const_iterator iterRes=resRow.find(OTT<ConnType,numPol>::indFC(curNodeSInCmode));
@@ -84,15 +84,15 @@ namespace INTERP_KERNEL
   }
 
   template<class MyMeshType, class MyMatrix>
-  int PlanarIntersectorP1P1PL<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
+  typename MyMeshType::MyConnType PlanarIntersectorP1P1PL<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
   {
-    return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfNodes();
+    return this->_meshT.getNumberOfNodes();
   }
   
   template<class MyMeshType, class MyMatrix>
-  int PlanarIntersectorP1P1PL<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
+  typename MyMeshType::MyConnType PlanarIntersectorP1P1PL<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
   {
-    return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfNodes();
+    return this->_meshS.getNumberOfNodes();
   }
 }