}
}
-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);
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;
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());
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;
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()));