]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Doc + remaining tabs
authorabn <adrien.bruneton@cea.fr>
Fri, 30 Oct 2020 09:16:51 +0000 (10:16 +0100)
committerabn <adrien.bruneton@cea.fr>
Fri, 30 Oct 2020 09:16:51 +0000 (10:16 +0100)
src/MEDCoupling/MEDCouplingUMesh_intersection.cxx

index a3c26a3806e9ac5401d71241668952d68dad4d76..b480bec30b67740d31480fafa6b1662deac5ea0b 100644 (file)
@@ -556,9 +556,15 @@ void MEDCouplingUMesh::BuildIntersectEdges(const MEDCouplingUMesh *m1, const MED
     }
 }
 
-MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std::vector< std::vector<mcIdType> >& intersectEdge2, const DataArrayDouble *coords1,
-                                                                       const std::vector<double>& addCoo, const std::map<mcIdType,mcIdType>& mergedNodes, const std::vector< std::vector<mcIdType> >& colinear2,
-                                                                       const std::vector< std::vector<mcIdType> >& intersectEdge1,
+/*
+ *  Build the final 1D mesh resulting from the newly created points after intersection with the segments of the descending 2D mesh.
+ *  @param[out] idsInRetColinear IDs of edges in the result (ret) that are colinears to one of the segment of the descending 2D mesh. Indexing scheme
+ *  is the one of the ret 1D mesh.
+ *  @param[out] idsInMesh1DForIdsInRetColinear same IDs as above in the descending 2D mesh
+ */
+MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std::vector< std::vector<mcIdType> >& intersectEdge2,
+                                     const DataArrayDouble *coords1, const std::vector<double>& addCoo, const std::map<mcIdType,mcIdType>& mergedNodes,
+                                     const std::vector< std::vector<mcIdType> >& colinear2, const std::vector< std::vector<mcIdType> >& intersectEdge1,
                                      MCAuto<DataArrayIdType>& idsInRetColinear, MCAuto<DataArrayIdType>& idsInMesh1DForIdsInRetColinear)
 {
   idsInRetColinear=DataArrayIdType::New(); idsInRetColinear->alloc(0,1);
@@ -584,7 +590,7 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std::
       for(mcIdType j=0;j<nbSubEdge;j++,kk++)
         {
           MCAuto<INTERP_KERNEL::Node> n1(MEDCouplingUMeshBuildQPNode(subEdges[2*j],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)),
-                                                                 n2(MEDCouplingUMeshBuildQPNode(subEdges[2*j+1],coords1->begin(),offset1,coo2Ptr,offset2,addCoo));
+                                      n2(MEDCouplingUMeshBuildQPNode(subEdges[2*j+1],coords1->begin(),offset1,coo2Ptr,offset2,addCoo));
           MCAuto<INTERP_KERNEL::Edge> e2(e->buildEdgeLyingOnMe(n1,n2));
           INTERP_KERNEL::Edge *e2Ptr(e2);
           std::map<mcIdType,mcIdType>::const_iterator itm;
@@ -1825,12 +1831,12 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D,
   MCAuto<DataArrayIdType> idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear;
   MCAuto<DataArrayIdType> ret2(DataArrayIdType::New()); ret2->alloc(0,1);
   MCAuto<MEDCouplingUMesh> ret1(BuildMesh1DCutFrom(mesh1D,intersectEdge2,mesh2D->getCoords(),addCoo,mergedNodes,colinear2,intersectEdge1,
-      idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear));
+                                                   idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear));
 
-  //
+  // ### Colinearity fix :
   // if a node in ret1 has been merged with an already existing node in mesh2D,
-  // we might end up with edges in ret1 that are collinear with some edges in mesh2D
-  // even if none of the edges of the two original meshes were collinear.
+  // we might end up with edges in ret1 that are colinear with some edges in mesh2D
+  // even if none of the edges of the two original meshes were colinear.
   // this procedure detects such edges and adds them in idsInRet1Colinear/idsInDescMesh2DForIdsInRetColinear
   // a- find edges in ret1 that are in contact with 2 cells
   MCAuto<DataArrayDouble> centerOfMassRet1(ret1->computeCellCenterOfMass());
@@ -1847,7 +1853,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D,
   for(const mcIdType *it=idsInRet1With2Contacts->begin();it!=idsInRet1With2Contacts->end();it++)
     {
       // b- find the edge that the 2 cells in m1Desc have in common:
-      // this is the edge which is collinear with the one in ret1
+      // this is the edge which is colinear with the one in ret1
       const mcIdType* cellId1 = cells->begin() + cellsIndex->begin()[*it];
       const mcIdType* cellId2 = cells->begin() + cellsIndex->begin()[*it]+1;
 
@@ -1866,6 +1872,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D,
           idsInDescMesh2DForIdsInRetColinear->pushBackSilent(commonEdgeId);
         }
     }
+  // ### End colinearity fix
 
   MCAuto<DataArrayIdType> ret3(DataArrayIdType::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits<mcIdType>::max()); ret3->rearrange(2);
   MCAuto<DataArrayIdType> idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells()));