From e02d4a175623a902681785c76a51d422875cd995 Mon Sep 17 00:00:00 2001 From: ageay Date: Mon, 8 Apr 2013 12:34:04 +0000 Subject: [PATCH] Bug correction on substractInPlaceDM --- src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 7c1ec56fe..af38ebbc9 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -11935,6 +11935,35 @@ class MEDCouplingBasicsTest(unittest.TestCase): gl.__repr__() ; gl.__str__() pass + def testSwig2NonRegressionBugSubstractInPlaceDM(self): + m0=MEDCouplingCMesh() + arr=DataArrayDouble(5,1) ; arr.iota(0.) + m0.setCoords(arr,arr) + m0=m0.buildUnstructured() + m00=m0[::2] ; m00.simplexize(0) ; m01=m0[1::2] + m0=MEDCouplingUMesh.MergeUMeshes([m00,m01]) + m0.getCoords()[:]*=1/4. + m0.setName("mesh") + # + NodeField=MEDCouplingFieldDouble(ON_NODES,ONE_TIME) ; NodeField.setTime(5.6,5,6) ; NodeField.setMesh(m0) + NodeField.setName("NodeField") + NodeField.fillFromAnalytic(1,"exp(-((x-1)*(x-1)+(y-1)*(y-1)))") ; NodeField.getArray().setInfoOnComponent(0,"powernode [W]") + proc0=m0.getCellsInBoundingBox([(0.,0.4),(0.,0.4)],1e-10) + proc1=proc0.buildComplement(m0.getNumberOfCells()) + # + NodeField0=NodeField[proc0] ; NodeField0.getMesh().setName(m0.getName()) + NodeField1=NodeField[proc1] ; NodeField1.getMesh().setName(m0.getName()) + # + NodeField_read=MEDCouplingFieldDouble.MergeFields([NodeField0,NodeField1]) + NodeField_read.mergeNodes(1e-10) + NodeFieldCpy=NodeField.deepCpy() + NodeFieldCpy.mergeNodes(1e-10) + NodeField.checkCoherency() + self.assertTrue(not NodeField.getArray().isUniform(0.,1e-12)) + NodeField.substractInPlaceDM(NodeField_read,10,1e-12) + self.assertTrue(NodeField.getArray().isUniform(0.,1e-12)) + pass + def setUp(self): pass pass -- 2.39.2