From: ageay Date: Mon, 24 Jun 2013 15:08:37 +0000 (+0000) Subject: On the road of single geo type meshes X-Git-Tag: B4CMakeModifs~43 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0a730a7ee279b2c83ce4f744760f694d92a92bf2;p=modules%2Fmed.git On the road of single geo type meshes --- diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index 2f88693ad..002298a14 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -384,6 +384,22 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::clone(bool recDeepCpy) const return new MEDCoupling1SGTUMesh(*this,recDeepCpy); } +/*! + * This method behaves mostly like MEDCoupling1SGTUMesh::deepCpy method, except that only nodal connectivity arrays are deeply copied. + * The coordinates are shared between \a this and the returned instance. + * + * \return MEDCouplingUMesh * - A new object instance holding the copy of \a this (deep for connectivity, shallow for coordiantes) + * \sa MEDCoupling1SGTUMesh::deepCpy + */ +MEDCouplingPointSet *MEDCoupling1SGTUMesh::deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception) +{ + checkCoherency(); + MEDCouplingAutoRefCountObjectPtr ret(clone(false)); + MEDCouplingAutoRefCountObjectPtr c(_conn->deepCpy()); + ret->setNodalConnectivity(c); + return ret.retn(); +} + void MEDCoupling1SGTUMesh::shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception) { if(!other) @@ -1354,6 +1370,22 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::clone(bool recDeepCpy) const return new MEDCoupling1DGTUMesh(*this,recDeepCpy); } +/*! + * This method behaves mostly like MEDCoupling1DGTUMesh::deepCpy method, except that only nodal connectivity arrays are deeply copied. + * The coordinates are shared between \a this and the returned instance. + * + * \return MEDCouplingUMesh * - A new object instance holding the copy of \a this (deep for connectivity, shallow for coordiantes) + * \sa MEDCoupling1DGTUMesh::deepCpy + */ +MEDCouplingPointSet *MEDCoupling1DGTUMesh::deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception) +{ + checkCoherency(); + MEDCouplingAutoRefCountObjectPtr ret(clone(false)); + MEDCouplingAutoRefCountObjectPtr c(_conn->deepCpy()),ci(_conn_indx->deepCpy()); + ret->setNodalConnectivity(c,ci); + return ret.retn(); +} + void MEDCoupling1DGTUMesh::updateTime() const { MEDCoupling1GTUMesh::updateTime(); @@ -1741,7 +1773,7 @@ DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() cons for(int i=0;i=nodali[1])// >= to avoid division by 0. + if(nodali[0]= to avoid division by 0. { for(int j=nodali[0];j=nodali[1])// >= to avoid division by 0. + if(nodali[0]= to avoid division by 0. { int nbOfNod=0; for(int j=nodali[0];jcheckAndPreparePermutation(); // + const int *o2nPtr=o2n->getPointer(); const int *conn=_conn->begin(),*conni=_conn_indx->begin(); - MEDCouplingAutoRefCountObjectPtr n2o=o2n->invertArrayO2N2N2O(nbCells); - const int *n2oPtr=n2o->begin(); MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); MEDCouplingAutoRefCountObjectPtr newConnI=DataArrayInt::New(); newConn->alloc(_conn->getNumberOfTuples(),1); newConnI->alloc(nbCells,1); @@ -1821,9 +1852,10 @@ void MEDCoupling1DGTUMesh::renumberCells(const int *old2NewBg, bool check) throw int *newC=newConn->getPointer(),*newCI=newConnI->getPointer(); for(int i=0;i=0) - newCI[n2oPtr[i]]=sz; + newCI[newPos]=sz; else { std::ostringstream oss; oss << "MEDCoupling1DGTUMesh::renumberCells : the index nodal array is invalid for cell #" << i << " !"; @@ -1835,10 +1867,11 @@ void MEDCoupling1DGTUMesh::renumberCells(const int *old2NewBg, bool check) throw for(int i=0;i& a) throw(INTERP_KERNEL::Exception); private: MEDCouplingAutoRefCountObjectPtr _conn_indx; diff --git a/src/MEDCoupling/MEDCouplingPointSet.hxx b/src/MEDCoupling/MEDCouplingPointSet.hxx index e9e265881..d824ae196 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.hxx +++ b/src/MEDCoupling/MEDCouplingPointSet.hxx @@ -70,6 +70,7 @@ namespace ParaMEDMEM bool areCoordsEqualIfNotWhy(const MEDCouplingPointSet& other, double prec, std::string& reason) const; bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const; bool areCoordsEqualWithoutConsideringStr(const MEDCouplingPointSet& other, double prec) const; + virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception) = 0; virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception) = 0; virtual DataArrayInt *mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes); virtual DataArrayInt *mergeNodes2(double precision, bool& areNodesMerged, int& newNbOfNodes); diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index fe6f8f71f..f99bcc0d2 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -89,6 +89,22 @@ MEDCouplingUMesh *MEDCouplingUMesh::clone(bool recDeepCpy) const return new MEDCouplingUMesh(*this,recDeepCpy); } +/*! + * This method behaves mostly like MEDCouplingUMesh::deepCpy method, except that only nodal connectivity arrays are deeply copied. + * The coordinates are shared between \a this and the returned instance. + * + * \return MEDCouplingUMesh * - A new object instance holding the copy of \a this (deep for connectivity, shallow for coordiantes) + * \sa MEDCouplingUMesh::deepCpy + */ +MEDCouplingPointSet *MEDCouplingUMesh::deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception) +{ + checkConnectivityFullyDefined(); + MEDCouplingAutoRefCountObjectPtr ret=clone(false); + MEDCouplingAutoRefCountObjectPtr c(getNodalConnectivity()->deepCpy()),ci(getNodalConnectivityIndex()->deepCpy()); + ret->setConnectivity(c,ci); + return ret.retn(); +} + void MEDCouplingUMesh::shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception) { if(!other) diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index 3fdf03809..0eec1a163 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -42,6 +42,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(const char *meshName, int meshDim); MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const; MEDCOUPLING_EXPORT MEDCouplingUMesh *clone(bool recDeepCpy) const; + MEDCOUPLING_EXPORT MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const; diff --git a/src/MEDCoupling/MEDCouplingUMeshDesc.cxx b/src/MEDCoupling/MEDCouplingUMeshDesc.cxx index e712dd004..883889f4b 100644 --- a/src/MEDCoupling/MEDCouplingUMeshDesc.cxx +++ b/src/MEDCoupling/MEDCouplingUMeshDesc.cxx @@ -79,6 +79,11 @@ MEDCouplingMesh *MEDCouplingUMeshDesc::deepCpy() const return 0; } +MEDCouplingPointSet *MEDCouplingUMeshDesc::deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception) +{ + throw INTERP_KERNEL::Exception("Not implemented yet !"); +} + void MEDCouplingUMeshDesc::shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception) { throw INTERP_KERNEL::Exception("Not implemented yet !"); diff --git a/src/MEDCoupling/MEDCouplingUMeshDesc.hxx b/src/MEDCoupling/MEDCouplingUMeshDesc.hxx index 62bdbcf11..086e55234 100644 --- a/src/MEDCoupling/MEDCouplingUMeshDesc.hxx +++ b/src/MEDCoupling/MEDCouplingUMeshDesc.hxx @@ -36,6 +36,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT static MEDCouplingUMeshDesc *New(const char *meshName, int meshDim); MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const; MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const; + MEDCOUPLING_EXPORT MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void checkCoherency() const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 0a05392e7..c8d01311f 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -13168,6 +13168,13 @@ class MEDCouplingBasicsTest(unittest.TestCase): ## mcpy.setCoords(DataArrayDouble.Aggregate([mcpy.getCoords(),mcpy.getCoords()])) mcpy.checkCoherency2() + ## + mcppy=mcpy.deepCpyConnectivityOnly() + self.assertTrue(mcppy.isEqual(mcpy,1e-12)) + self.assertTrue(mcppy.getCoords().getHiddenCppPointer()==mcpy.getCoords().getHiddenCppPointer()) + self.assertTrue(mcppy.getNodalConnectivity().isEqual(mcpy.getNodalConnectivity())) + self.assertTrue(mcppy.getNodalConnectivity().getHiddenCppPointer()!=mcpy.getNodalConnectivity().getHiddenCppPointer()) + ## a,b=mcpy.getReverseNodalConnectivity() self.assertTrue(a.isEqual(DataArrayInt([0,5,0,1,5,1,2,2,3,3,4,4,0,5,0,1,5,1,2,2,3,3,4,4]))) self.assertTrue(b.isEqual(DataArrayInt([0,2,5,7,9,11,12,14,17,19,21,23,24,24,24,24,24,24,24,24,24,24,24,24,24]))) @@ -13194,6 +13201,161 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertRaises(InterpKernelException,mcpy.checkGeoEquivalWith,mcpy2,1,1e-12)#fast equal pass + def testSwig21DGTUMesh1(self): + a0=DataArrayInt([0,2,3,5,6,8]) + a1=DataArrayInt([0,4,7,11,14,18,21,25]) + a2=DataArrayInt([0,1,4,5]) + self.assertTrue(DataArrayInt.AggregateIndexes([a0,a1,a2]).isEqual(DataArrayInt([0,2,3,5,6,8,12,15,19,22,26,29,33,34,37,38]))) + self.assertEqual(a1[3:].front(),11) + self.assertEqual(a1[4:].convertToDblArr().front(),14.) + a1c=DataArrayInt([5,7,1,2, 8,11,0, 5,6,3,12, 1,5,2, 13,12,11,7, 6,1,0, 20,21,19,17]) + d,e=MEDCouplingUMesh.ExtractFromIndexedArrays2(1,5,2,a1c,a1) + self.assertTrue(d.isEqual(DataArrayInt([8,11,0,1,5,2]))) + self.assertTrue(e.isEqual(DataArrayInt([0,3,6]))) + # + m=MEDCouplingDataForTest.build2DTargetMesh_1()[0,3,4] + ref=DataArrayInt([0,3,4,1,6,7,4,3,7,8,5,4]) + self.assertTrue(m.convertNodalConnectivityToStaticGeoTypeMesh().isEqual(ref)) + d,e=m.convertNodalConnectivityToDynamicGeoTypeMesh() + self.assertTrue(d.isEqual(ref)) + self.assertTrue(e.isEqual(DataArrayInt.Range(0,13,4))) + self.assertTrue(m.fillCellIdsToKeepFromNodeIds(DataArrayInt([6,7]),False).isEqual(DataArrayInt([1,2]))) + # + m=MEDCoupling1GTUMesh.New("m",NORM_POLYHED) + self.assertTrue(isinstance(m,MEDCoupling1DGTUMesh)) + m.__repr__() ; m.__str__() + m.setCoords(DataArrayDouble(20,3)) + m.allocateCells() + m.__repr__() ; m.__str__() + m.insertNextCell([0,1,2,5,7,2,-1,1,3]) + self.assertEqual(1,m.getNumberOfCells()) + self.assertTrue(DataArrayInt([8]).isEqual(m.computeNbOfNodesPerCell())) + self.assertTrue(DataArrayInt([2]).isEqual(m.computeNbOfFacesPerCell())) + m.__repr__() ; m.__str__() + m.checkCoherency() + m.checkCoherency2() + # + cm=MEDCouplingCMesh() ; cm.setName("m") + arr0=DataArrayDouble(6) ; arr0.iota() + arr1=DataArrayDouble([0,1]) + cm.setCoords(arr0,arr1,arr1) ; um=cm.buildUnstructured() ; um.convertAllToPoly() + um2=um.deepCpyConnectivityOnly() + self.assertTrue(um2.isEqual(um,1e-12)) + self.assertEqual(um2.getCoords().getHiddenCppPointer(),um.getCoords().getHiddenCppPointer()) + self.assertTrue(um2.getNodalConnectivity().isEqual(um.getNodalConnectivity())) + self.assertTrue(um2.getNodalConnectivity().getHiddenCppPointer()!=um.getNodalConnectivity().getHiddenCppPointer()) + self.assertTrue(um2.getNodalConnectivityIndex().isEqual(um.getNodalConnectivityIndex())) + self.assertTrue(um2.getNodalConnectivityIndex().getHiddenCppPointer()!=um.getNodalConnectivityIndex().getHiddenCppPointer()) + # + self.assertRaises(InterpKernelException,MEDCoupling1SGTUMesh.New,"m",NORM_POLYHED) + m=MEDCoupling1DGTUMesh("m",NORM_POLYHED) + m.allocateCells(5) + self.assertEqual(15,m.getNodalConnectivity().getNbOfElemAllocated()) + self.assertEqual(6,m.getNodalConnectivityIndex().getNbOfElemAllocated()) + m.setCoords(um.getCoords()) + m.insertNextCell([1,0,6,7,-1,7,6,1]) + self.assertEqual(1,m.getNumberOfCells()) + m.insertNextCell([2,1,7,8,-1,2,1,-1,8,-1,7]) + m.insertNextCell([3,2,8,9]) + m.insertNextCell([4,3,9,10,-1,5,3,9]) + m.insertNextCell([5,4,10,11,-1,11,10,-1,5]) + m.checkCoherency() + m.checkCoherency2() + self.assertEqual(5,m.getNumberOfCells()) + self.assertTrue(m.getNodalConnectivityIndex().isEqual(DataArrayInt([0,8,19,23,31,40]))) + self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([1,0,6,7,-1,7,6,1,2,1,7,8,-1,2,1,-1,8,-1,7,3,2,8,9,4,3,9,10,-1,5,3,9,5,4,10,11,-1,11,10,-1,5]))) + # + m4=m.deepCpy() + self.assertTrue(m.isEqual(m4,1e-12)) + m4.getNodalConnectivity().setIJ(2,0,5) + self.assertTrue(not m.isEqual(m4,1e-12)) + m4.getNodalConnectivity().setIJ(2,0,6) + self.assertTrue(m.isEqual(m4,1e-12)) + m4.getNodalConnectivityIndex().setIJ(2,0,21) + self.assertTrue(not m.isEqual(m4,1e-12)) + m4.getNodalConnectivityIndex().setIJ(2,0,19) + self.assertTrue(m.isEqual(m4,1e-12)) + m4.getCoords().setIJ(10,1,1.1) + self.assertTrue(not m.isEqual(m4,1e-12)) + m4.getCoords().setIJ(10,1,1.) + self.assertTrue(m.isEqual(m4,1e-12)) + m4.getNodalConnectivity().pushBackSilent(7) + self.assertTrue(not m.isEqual(m4,1e-12)) + self.assertEqual(7,m4.getNodalConnectivity().popBackSilent()) + self.assertTrue(m.isEqual(m4,1e-12)) + m4.setName("m4") + self.assertTrue(not m.isEqual(m4,1e-12)) + m4.setName("m") + self.assertTrue(m.isEqual(m4,1e-12)) + # + self.assertEqual(6,m.getNodalConnectivityIndex().getNbOfElemAllocated()) + self.assertEqual(60,m.getNodalConnectivity().getNbOfElemAllocated()) + self.assertTrue(m.computeNbOfNodesPerCell().isEqual(DataArrayInt([7,8,4,7,7]))) + self.assertTrue(m.computeNbOfFacesPerCell().isEqual(DataArrayInt([2,4,1,2,3]))) + self.assertEqual(m.getNodeIdsOfCell(1),[2,1,7,8,-1,2,1,-1,8,-1,7]) + f=m.computeIsoBarycenterOfNodesPerCell() + self.assertTrue(DataArrayDouble([(0.5714285714285714,0.5714285714285714,0),(1.5,0.5,0),(2.5,0.5,0),(3.5714285714285712,0.42857142857142855,0),(4.5714285714285712,0.5714285714285714,0)]).isEqual(f,1e-14)) + mu0=m.buildUnstructured() + o2n=[1,2,0,4,3] + m2=m.deepCpy() + m3=m.deepCpyConnectivityOnly() + self.assertTrue(m3.isEqual(m,1e-12)) + self.assertEqual(m3.getCoords().getHiddenCppPointer(),m.getCoords().getHiddenCppPointer()) + self.assertTrue(m3.getNodalConnectivity().getHiddenCppPointer()!=m.getNodalConnectivity().getHiddenCppPointer()) + self.assertTrue(m3.getNodalConnectivity().isEqual(m.getNodalConnectivity())) + self.assertTrue(m3.getNodalConnectivityIndex().getHiddenCppPointer()!=m.getNodalConnectivityIndex().getHiddenCppPointer()) + self.assertTrue(m3.getNodalConnectivityIndex().isEqual(m.getNodalConnectivityIndex())) + m.renumberCells(o2n) + mu0.renumberCells(o2n) + self.assertTrue(mu0.isEqual(m.buildUnstructured(),1e-12)) + self.assertTrue(m.getNodalConnectivityIndex().isEqual(DataArrayInt([0,4,12,23,32,40]))) + self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([3,2,8,9,1,0,6,7,-1,7,6,1,2,1,7,8,-1,2,1,-1,8,-1,7,5,4,10,11,-1,11,10,-1,5,4,3,9,10,-1,5,3,9]))) + # + mcpy0=m.buildUnstructured() + self.assertTrue(isinstance(mcpy0,MEDCouplingUMesh)) + self.assertTrue(mcpy0.getNodalConnectivity().isEqual(DataArrayInt([31,3,2,8,9,31,1,0,6,7,-1,7,6,1,31,2,1,7,8,-1,2,1,-1,8,-1,7,31,5,4,10,11,-1,11,10,-1,5,31,4,3,9,10,-1,5,3,9]))) + self.assertTrue(mcpy0.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,14,26,36,45]))) + self.assertEqual(mcpy0.getAllTypes(),[NORM_POLYHED]) + mcpy0.checkCoherency() + mcpy0.checkCoherency2() + mcpy1=mcpy0.convertIntoSingleGeoTypeMesh() + self.assertTrue(mcpy1.isEqual(m,1e-12)) + # + m_mrg=MEDCoupling1DGTUMesh.Merge1DGTUMeshes([m2,m,m2]) + self.assertTrue(m_mrg.getNodalConnectivityIndex().isEqual(DataArrayInt([0,8,19,23,31,40,44,52,63,72,80,88,99,103,111,120]))) + self.assertTrue(m_mrg.getNodalConnectivity().isEqual(DataArrayInt([1,0,6,7,-1,7,6,1,2,1,7,8,-1,2,1,-1,8,-1,7,3,2,8,9,4,3,9,10,-1,5,3,9,5,4,10,11,-1,11,10,-1,5,27,26,32,33,25,24,30,31,-1,31,30,25,26,25,31,32,-1,26,25,-1,32,-1,31,29,28,34,35,-1,35,34,-1,29,28,27,33,34,-1,29,27,33,49,48,54,55,-1,55,54,49,50,49,55,56,-1,50,49,-1,56,-1,55,51,50,56,57,52,51,57,58,-1,53,51,57,53,52,58,59,-1,59,58,-1,53]))) + m_mrg2=MEDCoupling1DGTUMesh.Merge1DGTUMeshesOnSameCoords([m3,m,m3]) + self.assertTrue(m_mrg2.getNodalConnectivityIndex().isEqual(DataArrayInt([0,8,19,23,31,40,44,52,63,72,80,88,99,103,111,120]))) + self.assertTrue(m_mrg2.getNodalConnectivity().isEqual(DataArrayInt([1,0,6,7,-1,7,6,1,2,1,7,8,-1,2,1,-1,8,-1,7,3,2,8,9,4,3,9,10,-1,5,3,9,5,4,10,11,-1,11,10,-1,5,3,2,8,9,1,0,6,7,-1,7,6,1,2,1,7,8,-1,2,1,-1,8,-1,7,5,4,10,11,-1,11,10,-1,5,4,3,9,10,-1,5,3,9,1,0,6,7,-1,7,6,1,2,1,7,8,-1,2,1,-1,8,-1,7,3,2,8,9,4,3,9,10,-1,5,3,9,5,4,10,11,-1,11,10,-1,5]))) + a,b=m_mrg2.getReverseNodalConnectivity() + self.assertTrue(b.isEqual(DataArrayInt([0,3,15,24,33,39,48,54,66,75,84,93,99,99,99,99,99,99,99,99,99,99,99,99,99]))) + self.assertTrue(a.isEqual(DataArrayInt([0,6,10,0,0,1,1,6,6,7,7,10,10,11,11,1,1,2,5,7,7,11,11,12,2,3,3,5,9,9,12,13,13,3,4,8,9,13,14,3,4,4,8,8,9,13,14,14,0,0,6,6,10,10,0,0,1,1,6,6,7,7,10,10,11,11,1,1,2,5,7,7,11,11,12,2,3,3,5,9,9,12,13,13,3,4,4,8,8,9,13,14,14,4,4,8,8,14,14]))) + self.assertTrue(m_mrg2.fillCellIdsToKeepFromNodeIds([7],False).isEqual(DataArrayInt([0,1,6,7,10,11]))) + self.assertTrue(m_mrg2.fillCellIdsToKeepFromNodeIds([0,1,6,7],True).isEqual(DataArrayInt([0,6,10]))) + # + self.assertTrue(m_mrg2.isPacked()) + self.assertEqual(120,m_mrg2.getNodalConnectivityIndex().popBackSilent()) + self.assertEqual(m_mrg2.getNumberOfCells(),14) + m_mrg2.checkCoherency2() + self.assertTrue(not m_mrg2.isPacked()) + m_mrg4,b=m_mrg2.copyWithNodalConnectivityPacked() + self.assertTrue(not b) + m_mrg4.checkCoherency2() + self.assertEqual(m_mrg4.getNumberOfCells(),14) + self.assertTrue(m_mrg4.getNodalConnectivityIndex().isEqual(m_mrg2.getNodalConnectivityIndex())) + self.assertEqual(len(m_mrg4.getNodalConnectivity()),111) + self.assertEqual(len(m_mrg2.getNodalConnectivity()),120) + self.assertTrue(m_mrg4.getNodalConnectivity().isEqual(m_mrg2.getNodalConnectivity()[:111])) + # + m0=m_mrg2[:5] + m1=m_mrg2[[5,6,7,8,9]] + m2=m_mrg2[10:] + self.assertTrue(m1.isEqualWithoutConsideringStr(m,1e-12)) + a,b=m.checkGeoEquivalWith(m0,12,1e-12) + self.assertTrue(a.isEqual(DataArrayInt(o2n))) + self.assertTrue(b is None) + pass + def setUp(self): pass pass diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 1854d889d..af81565d1 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -396,6 +396,7 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords; %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds; %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes; +%newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly; %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__; %newobject ParaMEDMEM::MEDCouplingUMesh::New; %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity; @@ -1154,6 +1155,7 @@ namespace ParaMEDMEM virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception); virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception); virtual bool isEmptyMesh(const std::vector& tinyInfo) const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception); %extend { std::string __str__() const throw(INTERP_KERNEL::Exception)