From: abn Date: Mon, 26 Mar 2018 08:35:35 +0000 (+0200) Subject: Bug fix for conformize3D() + automatic mergeNodes X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fabn%2Fconf3d_2;p=tools%2Fmedcoupling.git Bug fix for conformize3D() + automatic mergeNodes --- diff --git a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx index 5ff5f27bb..e5fa5050c 100644 --- a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx @@ -1819,8 +1819,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, * The modified cells, if any, are systematically declared as NORM_POLYGON or NORM_QPOLYG depending on the initial quadraticness of geometric type. * * This method expects that \b this has a meshDim equal 2 and spaceDim equal to 2 too. - * This method expects that all nodes in \a this are not closer than \a eps. - * If it is not the case you can invoke MEDCouplingUMesh::mergeNodes before calling this method. + * This method will also merge any duplicate node in the mesh. * * \param [in] eps the relative error to detect merged edges. * \return DataArrayInt * - The list of cellIds in \a this that have been subdivided. If empty, nothing changed in \a this (as if it were a const method). The array is a newly allocated array @@ -1837,6 +1836,14 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) checkConsistencyLight(); if(getSpaceDimension()!=2 || getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::conformize2D : This method only works for meshes with spaceDim=2 and meshDim=2 !"); + + // conformizeXD() doesn't like meshes with duplicate nodes. Do the merge here. + { + bool dnu; + int dnu2; + MCAuto dnu3(mergeNodes(eps, dnu, dnu2)); + } + MCAuto desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New()); MCAuto mDesc(buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1)); const int *c(mDesc->getNodalConnectivity()->begin()),*ci(mDesc->getNodalConnectivityIndex()->begin()),*rd(revDesc1->begin()),*rdi(revDescIndx1->begin()); @@ -2097,15 +2104,18 @@ void MEDCouplingUMesh::ReplaceEdgeInFace(const int * sIdxConn, const int * sIdxC /*! + * + * + * * \b WARNING this method is \b potentially \b non \b const (if returned array is not empty). * \b WARNING this method lead to have a non geometric type sorted mesh (for MED file users) ! - * This method performs a conformization of \b this. * - * Only polyhedron cells are supported. You can call convertAllToPoly() + * This method performs a conformization of \b this. + * Only polyhedron cells are supported. You can call convertAllToPoly(). For the moment, only partition-like non conformities are handled, that is to say + * that many small coplanar faces of a given polyhedron must exactly fit into a single big face of an adjacent polyhedron. + * This method will also merge duplicate nodes in the mesh. * * This method expects that \b this has a meshDim equal 3 and spaceDim equal to 3 too. - * This method expects that all nodes in \a this are not closer than \a eps. - * If it is not the case you can invoke MEDCouplingUMesh::mergeNodes before calling this method. * * \param [in] eps the relative error to detect merged edges. * \return DataArrayInt * - The list of cellIds in \a this that have been subdivided. If empty, nothing changed in \a this (as if it were a const method). The array is a newly allocated array @@ -2127,6 +2137,13 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) if(_types.size() != 1 || *(_types.begin()) != INTERP_KERNEL::NORM_POLYHED) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::conformize3D : This method only works for polyhedrons! Call convertAllToPoly first."); + // conformizeXD() doesn't like meshes with duplicate nodes. Do the merge here. + { + bool dnu; + int dnu2; + MCAuto dnu3(mergeNodes(eps, dnu, dnu2)); + } + MCAuto connSla(MEDCouplingSkyLineArray::BuildFromPolyhedronConn(getNodalConnectivity(), getNodalConnectivityIndex())); const double * coo(_coords->begin()); MCAuto ret(DataArrayInt::New());