From 7cc9f1e76aa43f309ddcf1b4e01d4e2d8fc40292 Mon Sep 17 00:00:00 2001 From: abn Date: Fri, 30 Oct 2020 10:16:51 +0100 Subject: [PATCH] Doc + remaining tabs --- .../MEDCouplingUMesh_intersection.cxx | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx index a3c26a380..b480bec30 100644 --- a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx @@ -556,9 +556,15 @@ void MEDCouplingUMesh::BuildIntersectEdges(const MEDCouplingUMesh *m1, const MED } } -MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std::vector< std::vector >& intersectEdge2, const DataArrayDouble *coords1, - const std::vector& addCoo, const std::map& mergedNodes, const std::vector< std::vector >& colinear2, - const std::vector< std::vector >& 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 >& intersectEdge2, + const DataArrayDouble *coords1, const std::vector& addCoo, const std::map& mergedNodes, + const std::vector< std::vector >& colinear2, const std::vector< std::vector >& intersectEdge1, MCAuto& idsInRetColinear, MCAuto& idsInMesh1DForIdsInRetColinear) { idsInRetColinear=DataArrayIdType::New(); idsInRetColinear->alloc(0,1); @@ -584,7 +590,7 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: for(mcIdType j=0;j 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 e2(e->buildEdgeLyingOnMe(n1,n2)); INTERP_KERNEL::Edge *e2Ptr(e2); std::map::const_iterator itm; @@ -1825,12 +1831,12 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, MCAuto idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear; MCAuto ret2(DataArrayIdType::New()); ret2->alloc(0,1); MCAuto 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 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 ret3(DataArrayIdType::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits::max()); ret3->rearrange(2); MCAuto idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells())); -- 2.39.2