]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
On the road of single geo type meshes
authorageay <ageay>
Mon, 24 Jun 2013 15:08:37 +0000 (15:08 +0000)
committerageay <ageay>
Mon, 24 Jun 2013 15:08:37 +0000 (15:08 +0000)
src/MEDCoupling/MEDCoupling1GTUMesh.cxx
src/MEDCoupling/MEDCoupling1GTUMesh.hxx
src/MEDCoupling/MEDCouplingPointSet.hxx
src/MEDCoupling/MEDCouplingUMesh.cxx
src/MEDCoupling/MEDCouplingUMesh.hxx
src/MEDCoupling/MEDCouplingUMeshDesc.cxx
src/MEDCoupling/MEDCouplingUMeshDesc.hxx
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py
src/MEDCoupling_Swig/MEDCouplingCommon.i

index 2f88693add84404ac9a12e91572a694d6f663b4b..002298a14829ccd5696bd475c6a1cbd9716fe655 100644 (file)
@@ -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<MEDCoupling1SGTUMesh> ret(clone(false));
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> 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<MEDCoupling1DGTUMesh> ret(clone(false));
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> 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<nbOfCells;i++,ptToFill+=spaceDim,nodali++)
         {
           std::fill(ptToFill,ptToFill+spaceDim,0.);
-          if(nodali[0]>=nodali[1])// >= to avoid division by 0.
+          if(nodali[0]<nodali[1])// >= to avoid division by 0.
             {
               for(int j=nodali[0];j<nodali[1];j++,nodal++)
                 {
@@ -1767,7 +1799,7 @@ DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() cons
       for(int i=0;i<nbOfCells;i++,ptToFill+=spaceDim,nodali++)
         {
           std::fill(ptToFill,ptToFill+spaceDim,0.);
-          if(nodali[0]>=nodali[1])// >= to avoid division by 0.
+          if(nodali[0]<nodali[1])// >= to avoid division by 0.
             {
               int nbOfNod=0;
               for(int j=nodali[0];j<nodali[1];j++,nodal++)
@@ -1810,9 +1842,8 @@ void MEDCoupling1DGTUMesh::renumberCells(const int *old2NewBg, bool check) throw
   if(check)
     o2n=o2n->checkAndPreparePermutation();
   //
+  const int *o2nPtr=o2n->getPointer();
   const int *conn=_conn->begin(),*conni=_conn_indx->begin();
-  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> n2o=o2n->invertArrayO2N2N2O(nbCells);
-  const int *n2oPtr=n2o->begin();
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New();
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> 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<nbCells;i++)
     {
+      int newPos=o2nPtr[i];
       int sz=conni[i+1]-conni[i];
       if(sz>=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<nbCells;i++,conni++)
     {
       int sz=conni[1]-conni[0];
-      int newp=n2oPtr[i];
+      int newp=o2nPtr[i];
       std::copy(conn+conni[0],conn+conni[1],newC+newCI[newp]);
     }
   _conn=newConn;
+  _conn_indx=newConnI;
 }
 
 MEDCouplingMesh *MEDCoupling1DGTUMesh::mergeMyselfWith(const MEDCouplingMesh *other) const
index d9e8ee60aa92c6aad8867be1bf61a91db82bae5b..7de7b997b9c6917bc905c5ff7f31c754bc7c45bd 100644 (file)
@@ -79,6 +79,7 @@ namespace ParaMEDMEM
   public:
     MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *clone(bool recDeepCpy) const;
+    MEDCOUPLING_EXPORT MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
     // overload of TimeLabel and RefCountObject
     MEDCOUPLING_EXPORT void updateTime() const;
     MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const;
@@ -145,6 +146,7 @@ namespace ParaMEDMEM
   public:
     MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *clone(bool recDeepCpy) const;
+    MEDCOUPLING_EXPORT MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
     // overload of TimeLabel and RefCountObject
     MEDCOUPLING_EXPORT void updateTime() const;
     MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const;
@@ -199,7 +201,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh(const char *name, const INTERP_KERNEL::CellModel& cm);
     MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh(const MEDCoupling1DGTUMesh& other, bool recDeepCpy);
   private:
-    void checkDynamicGeoType() const throw(INTERP_KERNEL::Exception);
+    void checkDynamicGeoT2ype() const throw(INTERP_KERNEL::Exception);
     static MEDCoupling1DGTUMesh *Merge1DGTUMeshesLL(std::vector<const MEDCoupling1DGTUMesh *>& a) throw(INTERP_KERNEL::Exception);
   private:
     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _conn_indx;
index e9e2658818222fc5867fd329309cdb3406f409a7..d824ae1961312153db7a2c1a2bdbdeeae81ec5b3 100644 (file)
@@ -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);
index fe6f8f71f00d178e2cd62e522d546a8a69d99d78..f99bcc0d25a82fa635d8f34418a0b889176dcfcb 100644 (file)
@@ -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<MEDCouplingUMesh> ret=clone(false);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> 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)
index 3fdf038098475e1691c188eeacf44808af77b834..0eec1a163f190310b8d665ac1ea44b940e85df5d 100644 (file)
@@ -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;
index e712dd004f8c8dbbf191aaebb1dd005ccfc9725d..883889f4b496475f8b87f9698da184b5f71e3f89 100644 (file)
@@ -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 !");
index 62bdbcf1101ead7b21cf3f3c74d22c97010e7bf0..086e55234a175fd64aa05815ef5886d315677f3c 100644 (file)
@@ -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);
index 0a05392e707b1c48a37edbb7e1e5cf8c931b9cb4..c8d01311f8b6b2daf88f85e743be66713fb5144c 100644 (file)
@@ -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
index 1854d889d588e96381a347d3bfeb21c81d59104f..af81565d14bbcb3cfc1cbba9dc7f327bba8bec5f 100644 (file)
@@ -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<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+      virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
       %extend 
          {
            std::string __str__() const throw(INTERP_KERNEL::Exception)