From: Anthony Geay Date: Fri, 19 Jul 2019 05:30:58 +0000 (+0200) Subject: MEDLoader and MEDPartitioner_Swig are now OK X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f35eca830754d9f1a3ebc59ad58bea52d0a0ac9e;p=tools%2Fmedcoupling.git MEDLoader and MEDPartitioner_Swig are now OK --- diff --git a/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py b/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py index 5103c7e59..4bdc6233c 100644 --- a/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py +++ b/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py @@ -22,6 +22,10 @@ from MEDLoader import * from MEDCouplingRemapper import * import math, os +import tempfile,os,shutil + +zeDir = tempfile.mkdtemp() +os.chdir(zeDir) d=DataArrayDouble.New(6,2) d[:,0]=3. @@ -596,3 +600,4 @@ omega=sum(angle2)/(ts[-1][2]-ts[0][2]) print(sum(angle2)) ; assert abs(sum(angle2)-1.12)<1e-2 print("Au pdt (%d,%d) a %r s le couple est de : %r N.m, power/omega=%r N.m"%(ts[2][0],ts[2][1],ts[2][2],zeTorque[2],power/omega)) assert abs(power/omega-0.37)<1e-2 +shutil.rmtree(zeDir) diff --git a/src/MEDPartitioner_Swig/MEDPartitionerTest.py b/src/MEDPartitioner_Swig/MEDPartitionerTest.py index 4414b2286..86bd05e0d 100644 --- a/src/MEDPartitioner_Swig/MEDPartitionerTest.py +++ b/src/MEDPartitioner_Swig/MEDPartitionerTest.py @@ -20,9 +20,10 @@ from MEDPartitioner import * from MEDLoader import * import unittest -from MEDLoaderDataForTest import MEDLoaderDataForTest +from MEDLoaderDataForTest import MEDLoaderDataForTest,WriteInTmpDir class MEDPartitionerTest(unittest.TestCase): + @WriteInTmpDir def testPartition(self): fname="PyPartitionTest.med" data=MEDLoaderDataForTest.buildACompleteMEDDataStructureWithFieldsOnCells_1() @@ -38,7 +39,8 @@ class MEDPartitionerTest(unittest.TestCase): m1d=data1.getMeshes().getMeshAtPos(0) m2d=data2.getMeshes().getMeshAtPos(0) self.assertTrue(m1d.isEqual(m2d,1e-12)) - pass + pass + @WriteInTmpDir def testPartitionGraph(self): data=MEDLoaderDataForTest.buildACompleteMEDDataStructureWithFieldsOnCells_1() m=data.getMeshes().getMeshAtPos(0) @@ -47,7 +49,8 @@ class MEDPartitionerTest(unittest.TestCase): tool=MEDPartitioner(data,graph) data2=tool.getMEDFileData() self.assertEqual( 2, data2.getMeshes().getNumberOfMeshes() ) - pass + pass + @WriteInTmpDir def testPartitionWithJoints(self): # cartesian mesh 4x4 arr=DataArrayDouble(5) ; arr.iota() @@ -90,6 +93,7 @@ class MEDPartitionerTest(unittest.TestCase): pass self.assertEqual(1,found) pass + @WriteInTmpDir def testPartitionPartGraph(self): arr=DataArrayDouble(5) ; arr.iota() c=MEDCouplingCMesh() ; c.setCoords(arr,arr)