/**
* \b this must be filled at level 0 and -1, typically the -1 level being (part of) the descending connectivity
- * of the top level. This method build a "crack" in \b this along the group of level -1 named grpNameM1.
- * The "crack" is built according to the following method:
- * - all nodes along the crack which are not lying on an internal extremity of the crack are duplicated (so the
- * coordinates array is extended). The
- * - new (-1)-level cells are built lying on those new nodes. So the edges/faces along the crack are duplicated.
- * After this operation a top-level cell bordering the crack will loose some neighbor (typically the cell which is on the
- * other side of the crack is no more a neighbor)
- * - finally, the connectivity of (part of) the top level-cells bordering the crack is also modified so that some cells
- * bordering the crack use the newly computed nodes.
+ * of the top level. This method build a "crack", or an inner boundary, in \b this along the group of level -1 named grpNameM1.
+ * The boundary is built according to the following method:
+ * - all nodes along the boundary which are not lying on an internal extremity of the (-1)-level group are duplicated (so the
+ * coordinates array is extended).
+ * - new (-1)-level cells are built lying on those new nodes. So the edges/faces along the group are duplicated.
+ * After this operation a top-level cell bordering the group will loose some neighbors (typically the cell which is on the
+ * other side of the group is no more a neighbor)
+ * - finally, the connectivity of (part of) the top level-cells bordering the group is also modified so that some cells
+ * bordering the newly created boundary use the newly computed nodes.
*
- * \param[in] grpNameM1 name of the (-1)-level group defining the crack
+ * \param[in] grpNameM1 name of the (-1)-level group defining the boundary
* \param[out] nodesDuplicated ids of the initial nodes which have been duplicated (and whose copy is put at the end of
* the coord array)
* \param[out] cellsModified ids of the cells whose connectivity has been modified (to use the newly created nodes)
- * \param[out] cellsNotModified ids of the rest of cells bordering the crack whose connectivity remains unchanged.
+ * \param[out] cellsNotModified ids of the rest of cells bordering the new boundary whose connectivity remains unchanged.
*/
-void MEDFileUMesh::duplicateNodesOnM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated,
+void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated,
DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified)
{
std::vector<int> levs=getNonEmptyLevels();
if(std::find(levs.begin(),levs.end(),0)==levs.end() || std::find(levs.begin(),levs.end(),-1)==levs.end())
- throw INTERP_KERNEL::Exception("MEDFileUMesh::duplicateNodesOnM1Group : This method works only for mesh definied on level 0 and -1 !");
+ throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group : This method works only for mesh definied on level 0 and -1 !");
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m0=getMeshAtLevel(0);
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1=getMeshAtLevel(-1);
int nbNodes=m0->getNumberOfNodes();
newm1->setName(getName());
const DataArrayInt *fam=getFamilyFieldAtLevel(-1);
if(!fam)
- throw INTERP_KERNEL::Exception("MEDFileUMesh::duplicateNodesOnM1Group : internal problem !");
+ throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group : internal problem !");
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newFam=DataArrayInt::New();
newFam->alloc(newm1->getNumberOfCells(),1);
int idd=getMaxFamilyId()+1;
MEDLOADER_EXPORT void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum=false);
MEDLOADER_EXPORT void optimizeFamilies();
// tools
- MEDLOADER_EXPORT void duplicateNodesOnM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified);
+ MEDLOADER_EXPORT void buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified);
MEDLOADER_EXPORT bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell);
MEDLOADER_EXPORT DataArrayInt *zipCoords();
MEDLOADER_EXPORT MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
return const_cast<PartDefinition *>(ret);
}
- PyObject *duplicateNodesOnM1Group(const std::string& grpNameM1) throw(INTERP_KERNEL::Exception)
+ PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1) throw(INTERP_KERNEL::Exception)
{
DataArrayInt *ret0=0,*ret1=0,*ret2=0;
- self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
+ self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
PyObject *ret=PyTuple_New(3);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
pass
pass
- def testDuplicateNodesOnM1Group1(self):
+ def testBuildInnerBoundaryAlongM1Group1(self):
fname="Pyfile44.med"
m=MEDCouplingCMesh.New()
m.setCoordsAt(0,DataArrayDouble.New([0.,1.1,2.3,3.6,5.,6.5]))
self.assertEqual(ref0,mm.getMeshAtLevel(0)[[12,13,14]].getNodalConnectivity().getValues())
self.assertEqual(ref1,mm.getMeshAtLevel(0)[[7,8,9]].getNodalConnectivity().getValues())
#
- nodes,cells,cells2=mm.duplicateNodesOnM1Group("Grp")
+ nodes,cells,cells2=mm.buildInnerBoundaryAlongM1Group("Grp")
self.assertEqual([15,16,17],nodes.getValues());
self.assertEqual([7,8,9],cells.getValues());
self.assertEqual([12,13,14],cells2.getValues());
mm.write(fname,2)
pass
- def testDuplicateNodesOnM1Group2(self):
+ def testBuildInnerBoundaryAlongM1Group2(self):
fname="Pyfile45.med"
m=MEDCouplingCMesh.New()
m.setCoordsAt(0,DataArrayDouble.New([0.,1.1,2.3,3.6,5.,6.5]))
self.assertEqual(ref0,mm.getMeshAtLevel(0)[[12,13,14]].getNodalConnectivity().getValues())
self.assertEqual(ref1,mm.getMeshAtLevel(0)[[7,8]].getNodalConnectivity().getValues())
#
- nodes,cells,cells2=mm.duplicateNodesOnM1Group("Grp")
+ nodes,cells,cells2=mm.buildInnerBoundaryAlongM1Group("Grp")
self.assertEqual([15],nodes.getValues());
self.assertEqual([7,8],cells.getValues());
self.assertEqual([12,13],cells2.getValues());
mm.write(fname,2)
pass
- def testDuplicateNodesOnM1Group3(self):
- """ Test duplicateNodesOnM1Group() with *non-connex* cracks """
+ def testBuildInnerBoundaryAlongM1Group3(self):
+ """ Test buildInnerBoundaryAlongM1Group() with *non-connex* cracks """
fname = "Pyfile73.med"
m = MEDCouplingCMesh.New()
m.setCoordsAt(0, DataArrayDouble([0.0,1.1,2.3,3.6,5.0]))
mm.setMeshAtLevel(0,m)
mm.setMeshAtLevel(-1,m2)
mm.setGroupsAtLevel(-1,[grpSeg])
- nodes, cellsMod, cellsNotMod = mm.duplicateNodesOnM1Group("Grp")
+ nodes, cellsMod, cellsNotMod = mm.buildInnerBoundaryAlongM1Group("Grp")
self.assertEqual([1,13],nodes.getValues());
self.assertEqual([0,6],cellsMod.getValues());
self.assertEqual([1,7],cellsNotMod.getValues());