]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Tue, 25 Oct 2011 09:15:22 +0000 (09:15 +0000)
committerageay <ageay>
Tue, 25 Oct 2011 09:15:22 +0000 (09:15 +0000)
src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py

index 7cbb56c7ed46600f233f8b28002c02849500f3cb..330b7612952dc0a193cc642f10d497290aba238a 100644 (file)
@@ -1701,3 +1701,40 @@ void MEDCouplingBasicsTest4::testUMeshMergeMeshesCVW1()
   m->decrRef();
   m2->decrRef();
 }
+
+void MEDCouplingBasicsTest4::testChangeUnderlyingMeshWithCMesh1()
+{
+  MEDCouplingCMesh* mesh=MEDCouplingCMesh::New();
+  DataArrayDouble* coordsX=DataArrayDouble::New();
+  double arrX[4] = { -1., 1., 2., 4. };
+  coordsX->useArray(arrX,false, CPP_DEALLOC,4,1);
+  DataArrayDouble* coordsY=DataArrayDouble::New();
+  double arrY[4] = { -2., 2., 4., 8. };
+  coordsY->useArray(arrY,false, CPP_DEALLOC,4,1);
+  DataArrayDouble* coordsZ=DataArrayDouble::New();
+  double arrZ[4] = { -3., 3., 6., 12. };
+  coordsZ->useArray(arrZ,false, CPP_DEALLOC,4,1);
+  mesh->setCoords(coordsX,coordsY,coordsZ);
+  coordsX->decrRef();
+  coordsY->decrRef();
+  coordsZ->decrRef();
+  MEDCouplingMesh *mesh2=mesh->deepCpy();
+  //
+  static const int ids1[9]={0,1,2,10,11,12,20,21,22};
+  for(const int *myId=ids1;myId!=ids1+9;myId++)
+    {
+      MEDCouplingFieldDouble *f=mesh->getMeasureField(true);
+      f->changeUnderlyingMesh(mesh2,*myId,1e-12);
+      f->decrRef();
+    }
+  mesh2->setName("uuuu");
+  for(const int *myId=ids1+1;myId!=ids1+9;myId++)
+    {
+      MEDCouplingFieldDouble *f=mesh->getMeasureField(true);
+      f->changeUnderlyingMesh(mesh2,*myId,1e-12);
+      f->decrRef();
+    }
+  //
+  mesh2->decrRef();
+  mesh->decrRef();
+}
index bd7cdbaecf3de2ad6d2a41c2c1601d8a1a8e548a..cefcc4046b1aa5cc9e7180c4686404e38e0b8d6e 100644 (file)
@@ -130,6 +130,7 @@ namespace ParaMEDMEM
     void testDaDSetPartOfValuesAdv1();
     void testUMeshBuildSetInstanceFromThis1();
     void testUMeshMergeMeshesCVW1();
+    void testChangeUnderlyingMeshWithCMesh1();
   };
 }
 
index 1e9465aebd0951aab671b9c262659a829f650ef0..5c088955687c19e39e88f61170ef26c1964d03f8 100644 (file)
@@ -7887,6 +7887,31 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertTrue(m.isEqual(m3,1e-12));
         pass
     
+    def testChangeUnderlyingMeshWithCMesh1(self):
+        mesh=MEDCouplingCMesh.New();
+        coordsX=DataArrayDouble.New();
+        arrX=[ -1., 1., 2., 4. ]
+        coordsX.setValues(arrX,4,1);
+        coordsY=DataArrayDouble.New();
+        arrY=[ -2., 2., 4., 8. ]
+        coordsY.setValues(arrY,4,1);
+        coordsZ=DataArrayDouble.New();
+        arrZ=[ -3., 3., 6., 12. ]
+        coordsZ.setValues(arrZ,4,1);
+        mesh.setCoords(coordsX,coordsY,coordsZ);
+        f=mesh.getMeasureField(True)
+        mesh2=mesh.deepCpy()
+        for myId in [0,1,2,10,11,12,20,21,22]:
+            f=mesh.getMeasureField(True)
+            f.changeUnderlyingMesh(mesh2,myId,1e-12);
+            pass
+        mesh2.setName("uuuu")
+        for myId in [1,2,10,11,12,20,21,22]:
+            f=mesh.getMeasureField(True)
+            f.changeUnderlyingMesh(mesh2,myId,1e-12);
+            pass
+        pass
+    
     def setUp(self):
         pass
     pass