Salome HOME
Updated copyright comment
[tools/medcoupling.git] / src / INTERP_KERNEL / Geometric2DIntersector.txx
index ba4b238b13da3ee58bd095d70b175ca3bbcdd672..a66b2ab227031789f87cb4c5341188da385abac4 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  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
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,6 +27,7 @@
 #include "PlanarIntersectorP1P0.txx"
 #include "PlanarIntersectorP1P1.txx"
 #include "PlanarIntersectorP1P0Bary.txx"
+#include "PlanarIntersectorP0P1Bary.txx"
 #include "CellModel.hxx"
 
 #include "InterpKernelGeo2DQuadraticPolygon.hxx"
@@ -41,11 +42,11 @@ namespace INTERP_KERNEL
 {
   INTERSECTOR_TEMPLATE
   GEO2D_INTERSECTOR::Geometric2DIntersector(const MyMeshType& meshT, const MyMeshType& meshS,
-                                            double dimCaracteristic, double md3DSurf, double medianPlane,
+                                            double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane,
                                             double precision, int orientation):
-    InterpType<MyMeshType,MyMatrix,GEO2D_INTERSECTOR >(meshT,meshS,dimCaracteristic, precision, md3DSurf, medianPlane, true, orientation, 0)
+    InterpType<MyMeshType,MyMatrix,GEO2D_INTERSECTOR >(meshT,meshS,dimCaracteristic, precision, md3DSurf, minDot3DSurf, medianPlane, true, orientation, 0),
+    _precision(precision)
   {
-    QUADRATIC_PLANAR::_precision=precision;
   }
   
   INTERSECTOR_TEMPLATE
@@ -62,7 +63,7 @@ namespace INTERP_KERNEL
     QuadraticPolygon *p2=buildPolygonFrom(CoordsS,tS);
     double ret=p1->intersectWithAbs(*p2);
     delete p1; delete p2;
-    return ret;
+    return orientation*ret;
   }
 
   INTERSECTOR_TEMPLATE
@@ -80,7 +81,7 @@ namespace INTERP_KERNEL
     QuadraticPolygon *p2=buildPolygonOfOneEdgeFrom(CoordsS,tS);
     double ret=p1->intersectWithAbs1D(*p2, isColinear);
     delete p1; delete p2;
-    return ret;
+    return orientation*ret;
   }
 
   INTERSECTOR_TEMPLATE
@@ -93,9 +94,9 @@ namespace INTERP_KERNEL
     nodes[1]=new Node(quadrangle[SPACEDIM],quadrangle[SPACEDIM+1]);
     nodes[2]=new Node(quadrangle[2*SPACEDIM],quadrangle[2*SPACEDIM+1]);
     nodes[3]=new Node(quadrangle[3*SPACEDIM],quadrangle[3*SPACEDIM+1]);
-    int nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
+    std::size_t nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
     std::vector<Node *> nodes2(nbOfSourceNodes);
-    for(int i=0;i<nbOfSourceNodes;i++)
+    for(std::size_t i=0;i<nbOfSourceNodes;i++)
       nodes2[i]=new Node(sourceCoords[i*SPACEDIM],sourceCoords[i*SPACEDIM+1]);
     QuadraticPolygon *p1=QuadraticPolygon::BuildLinearPolygon(nodes);
     QuadraticPolygon *p2;
@@ -112,13 +113,13 @@ namespace INTERP_KERNEL
   double GEO2D_INTERSECTOR::intersectGeometryGeneral(const std::vector<double>& targetCoords,
                                                      const std::vector<double>& sourceCoords)
   {
-    int nbOfTargetNodes=targetCoords.size()/SPACEDIM;
+    std::size_t nbOfTargetNodes=targetCoords.size()/SPACEDIM;
     std::vector<Node *> nodes(nbOfTargetNodes);
-    for(int i=0;i<nbOfTargetNodes;i++)
+    for(std::size_t i=0;i<nbOfTargetNodes;i++)
       nodes[i]=new Node(targetCoords[i*SPACEDIM],targetCoords[i*SPACEDIM+1]);
-    int nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
+    std::size_t nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
     std::vector<Node *> nodes2(nbOfSourceNodes);
-    for(int i=0;i<nbOfSourceNodes;i++)
+    for(std::size_t i=0;i<nbOfSourceNodes;i++)
       nodes2[i]=new Node(sourceCoords[i*SPACEDIM],sourceCoords[i*SPACEDIM+1]);
     QuadraticPolygon *p1=QuadraticPolygon::BuildLinearPolygon(nodes);
     QuadraticPolygon *p2=QuadraticPolygon::BuildLinearPolygon(nodes2);
@@ -147,9 +148,9 @@ namespace INTERP_KERNEL
     nodes[0]=new Node(sourceTria[0*SPACEDIM],sourceTria[0*SPACEDIM+1]);
     nodes[1]=new Node(sourceTria[1*SPACEDIM],sourceTria[1*SPACEDIM+1]);
     nodes[2]=new Node(sourceTria[2*SPACEDIM],sourceTria[2*SPACEDIM+1]);
-    int nbOfTargetNodes=targetCell.size()/SPACEDIM;
+    std::size_t nbOfTargetNodes=targetCell.size()/SPACEDIM;
     std::vector<Node *> nodes2(nbOfTargetNodes);
-    for(int i=0;i<nbOfTargetNodes;i++)
+    for(std::size_t i=0;i<nbOfTargetNodes;i++)
       nodes2[i]=new Node(targetCell[i*SPACEDIM],targetCell[i*SPACEDIM+1]);
     QuadraticPolygon *p1=QuadraticPolygon::BuildLinearPolygon(nodes);
     QuadraticPolygon *p2;
@@ -182,9 +183,9 @@ namespace INTERP_KERNEL
   INTERSECTOR_TEMPLATE
   QuadraticPolygon *GEO2D_INTERSECTOR::buildPolygonFrom(const std::vector<double>& coords, NormalizedCellType type)
   {
-    int nbNodes=coords.size()/SPACEDIM;
+    std::size_t nbNodes=coords.size()/SPACEDIM;
     std::vector<Node *> nodes(nbNodes);
-    for(int i=0;i<nbNodes;i++)
+    for(std::size_t i=0;i<nbNodes;i++)
       nodes[i]=new Node(coords[i*SPACEDIM],coords[i*SPACEDIM+1]);
     if(!CellModel::GetCellModel(type).isQuadratic())
       return QuadraticPolygon::BuildLinearPolygon(nodes);