From: ageay Date: Tue, 25 Oct 2011 09:15:22 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: V6_main_FINAL~925 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0a12441e91c1603ef6369be08961bc33526dc261;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx index 7cbb56c7e..330b76129 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx @@ -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(); +} diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx index bd7cdbaec..cefcc4046 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx @@ -130,6 +130,7 @@ namespace ParaMEDMEM void testDaDSetPartOfValuesAdv1(); void testUMeshBuildSetInstanceFromThis1(); void testUMeshMergeMeshesCVW1(); + void testChangeUnderlyingMeshWithCMesh1(); }; } diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 1e9465aeb..5c0889556 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -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