From: abn Date: Mon, 18 Feb 2019 12:34:31 +0000 (+0100) Subject: MEDCoupling becomes medcoupling in tests. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b6a8043834f0a970a2b4606125560f83c9892520;p=tools%2Fmedcoupling.git MEDCoupling becomes medcoupling in tests. --- diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py index cf28e033b..79dff76c6 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py @@ -22,7 +22,7 @@ import sys if sys.platform == "win32": from MEDCouplingCompat import * else: - from MEDCoupling import * + from medcoupling import * import unittest from math import pi,e,sqrt,cos,sin diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py index a4e033473..332270c83 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py @@ -23,7 +23,7 @@ import sys if sys.platform == "win32": from MEDCouplingCompat import * else: - from MEDCoupling import * + from medcoupling import * import unittest from math import pi,e,sqrt,cos,sin from datetime import datetime @@ -705,7 +705,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertTrue(f1.isEqualWithoutConsideringStr(f2,1e-12,1e-12)); # pass - + def testGetNodeIdsOfCell1(self): mesh1=MEDCouplingDataForTest.build2DTargetMesh_1(); li=mesh1.getNodeIdsOfCell(1) @@ -876,7 +876,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): 132.680430393685,255.37973247196,96.15235602819]; volHexa8=3258520.29637466; baryHexa8=[43.925705821778, 155.31893955289, 65.874418109644] - + coordsForPenta6=[-68.199829618726,178.938498373416,62.608505919588, 8.461744647847,76.653979804423,165.00018874933, -27.273893776752,167.567731083961,192.830034145464, @@ -885,7 +885,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): 132.680430393685,255.37973247196,96.15235602819]; volPenta6=944849.868507338; baryPenta6=[39.631002313543,182.692711783428,106.98540473964] - + coordsForPyra5=[132.680430393685,255.37973247196,96.15235602819, -27.273893776752,167.567731083961,192.830034145464, 8.461744647847,76.653979804423,165.00018874933, @@ -1467,7 +1467,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertEqual(arr2[i],da3.getIJ(i,0)); pass pass - + def testKeepSetSelectedComponent1(self): arr1=[1.,2.,3.,4., 11.,12.,13.,14., 21.,22.,23.,24., 31.,32.,33.,34., 41.,42.,43.,44.] a1=DataArrayDouble.New(); @@ -1619,7 +1619,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): pass # pass - + def testElementaryDAThrowAndSpecialCases(self): da=DataArrayInt.New(); self.assertRaises(InterpKernelException, da.checkAllocated); @@ -1628,16 +1628,16 @@ class MEDCouplingBasicsTest2(unittest.TestCase): da.alloc(7,1); da.fillWithValue(11); #11,11,11,11... da.iota(10); #10,11,12,13... - + db=DataArrayInt.New(); db.alloc(7,2); - + dbl2=DataArrayDouble.New(); dbl2.alloc(7,2); self.assertRaises(InterpKernelException, dbl2.isUniform, 10., 1e-15); self.assertRaises(InterpKernelException, dbl2.sort); self.assertRaises(InterpKernelException, dbl2.iota, 10.); - + dbl=DataArrayDouble.New(); #DataArrayDouble not allocated yet self.assertRaises(InterpKernelException, dbl.iota, 10.); @@ -1645,7 +1645,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertRaises(InterpKernelException, dbl.sort); self.assertRaises(InterpKernelException, dbl.fromNoInterlace); self.assertRaises(InterpKernelException, dbl.toNoInterlace); - + dbl.alloc(7,1); dbl.iota(10.); self.assertTrue(not dbl.isUniform(10.,1e-15)); @@ -1658,16 +1658,16 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertTrue(dbl.isMonotonic(False, .99)); self.assertTrue(not dbl.isMonotonic(False, 1.1)); self.assertTrue(not dbl.isMonotonic(False, -1.1)); - + dc=DataArrayInt.New(); dc.alloc(14,1); - + dd=DataArrayDouble.New(); self.assertRaises(InterpKernelException, dd.checkAllocated); self.assertRaises(InterpKernelException, dd.fillWithValue, 1.); self.assertRaises(InterpKernelException, dd.iota, 1.); self.assertTrue(not ((dd.repr().find("No data"))==-1)); - + dd.alloc(0,1); #Allocated but nbOfElements==0! self.assertTrue(not ((dd.repr().find("Number of tuples : 0"))==-1)); self.assertTrue(not ((dd.repr().find("Empty Data"))==-1)); @@ -1675,7 +1675,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): dd.iota(10); #?!...ok self.assertTrue(dd.isMonotonic(True, 1.)); #nothing is monotonic self.assertTrue(dd.isMonotonic(False, 1.)); - + self.assertRaises(InterpKernelException, db.copyStringInfoFrom, da); self.assertRaises(InterpKernelException, db.copyStringInfoFrom, da); cIds=[2,2] @@ -1683,12 +1683,12 @@ class MEDCouplingBasicsTest2(unittest.TestCase): cIds[0]=1; cIds[0]=-1; self.assertRaises(InterpKernelException, da.copyPartOfStringInfoFrom, db, cIds); - + info=["infoOfOneComponent"]*2; self.assertRaises(InterpKernelException, da.setInfoOnComponents, info); self.assertRaises(InterpKernelException, da.setInfoOnComponent, 1, info[0]); db.setInfoOnComponents(info); - + self.assertRaises(InterpKernelException, da.getInfoOnComponent, -1); self.assertRaises(InterpKernelException, da.getInfoOnComponent, 2); self.assertTrue(db.getInfoOnComponent(1)==db.getInfoOnComponent(0)); @@ -1696,50 +1696,50 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertRaises(InterpKernelException, db.getVarOnComponent, 2); self.assertRaises(InterpKernelException, db.getUnitOnComponent, -1); self.assertRaises(InterpKernelException, db.getUnitOnComponent, 2); - + self.assertTrue(da.GetVarNameFromInfo("varname unit ")=="varname unit "); self.assertTrue(da.GetVarNameFromInfo("varname]unit[")=="varname]unit["); self.assertTrue(da.GetVarNameFromInfo("[unit]")==""); self.assertTrue(da.GetVarNameFromInfo("varname [unit]")=="varname"); - + self.assertTrue(da.GetUnitFromInfo("varname unit ")==""); self.assertTrue(da.GetUnitFromInfo("varname]unit[")==""); self.assertTrue(da.GetUnitFromInfo("[unit]")=="unit"); self.assertTrue(da.GetUnitFromInfo("varname [unit]")=="unit"); - + self.assertRaises(InterpKernelException, da.checkNbOfTuplesAndComp, db, "theMessageInThrow"); self.assertRaises(InterpKernelException, da.checkNbOfTuplesAndComp, dc, "theMessageInThrow"); self.assertRaises(InterpKernelException, db.checkNbOfTuplesAndComp, dc, "theMessageInThrow"); - + self.assertRaises(InterpKernelException, da.checkNbOfTuplesAndComp, 7, 2, "theMessageInThrow"); da.checkNbOfTuplesAndComp(7,1,"theMessageInThrow"); - + self.assertRaises(InterpKernelException, db.checkNbOfElems, 7*2+1, "theMessageInThrow"); db.checkNbOfElems(7*2,"theMessageInThrow"); - + self.assertRaises(InterpKernelException, db.GetNumberOfItemGivenBES, 10, 9, 1, "theMessageInThrow"); self.assertRaises(InterpKernelException, db.GetNumberOfItemGivenBES, 0, 1, -1, "theMessageInThrow"); self.assertEqual(10,db.GetNumberOfItemGivenBES(0,10,1,"theMessageInThrow")); self.assertEqual(5,db.GetNumberOfItemGivenBES(0,10,2,"theMessageInThrow")); self.assertEqual(6,db.GetNumberOfItemGivenBES(0,11,2,"theMessageInThrow")); - + self.assertTrue(not ((da.repr().find("Number of components : 1"))==-1)); self.assertTrue(not ((dd.repr().find("Number of components : 1"))==-1)); self.assertTrue(not ((dbl.repr().find("Number of components : 1"))==-1)); - + self.assertTrue(not ((da.reprZip().find("Number of components : 1"))==-1)); self.assertTrue(not ((dd.reprZip().find("Number of components : 1"))==-1)); self.assertTrue(not ((dbl.reprZip().find("Number of components : 1"))==-1)); - + self.assertRaises(InterpKernelException, dbl.selectByTupleIdSafeSlice, 0, 1, -1); self.assertRaises(InterpKernelException, dbl.subArray, -1, 1); self.assertRaises(InterpKernelException, dbl.subArray, 8, 1); self.assertRaises(InterpKernelException, dbl.subArray, 0, 8); self.assertRaises(InterpKernelException, dbl.meldWith, dd); - + self.assertRaises(InterpKernelException, dbl.setPartOfValuesAdv, dbl2, da); #dbl dbl2 not have the same number of components self.assertRaises(InterpKernelException, dbl.setPartOfValuesAdv, dd, da); #da tuple selector DataArrayInt instance not have exactly 2 components - + dbl3=DataArrayDouble.New(); dbl3.alloc(6,2); dbl3.fillWithValue(11.); @@ -1761,18 +1761,18 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertRaises(InterpKernelException, dbl3.inverse); self.assertRaises(InterpKernelException, dbl3.trace); self.assertRaises(InterpKernelException, dbl3.deviator); - + dbl3.setIJ(5,1,12.); self.assertTrue(dbl3.getMaxValueInArray()==12.); self.assertTrue(dbl3.getMinValueInArray()==11.); - + db.fillWithValue(100); #bad Ids self.assertRaises(InterpKernelException, dbl3.setPartOfValuesAdv, dbl2, db); db.fillWithValue(-1); #bad Ids self.assertRaises(InterpKernelException, dbl3.setPartOfValuesAdv, dbl2, db); db.fillWithValue(6); #bad Ids for dbl3 self.assertRaises(InterpKernelException, dbl3.setPartOfValuesAdv, dbl2, db); - + dbl3.checkNoNullValues(); dbl3.setIJ(5,0,0.); self.assertRaises(InterpKernelException, dbl3.checkNoNullValues); @@ -1781,12 +1781,12 @@ class MEDCouplingBasicsTest2(unittest.TestCase): a=[] self.assertRaises(InterpKernelException, DataArrayDouble_Aggregate, a); self.assertRaises(InterpKernelException, DataArrayDouble_Meld, a); - + a=[dbl2,dbl]; #Nb of components mismatch self.assertRaises(InterpKernelException, DataArrayDouble_Aggregate, a); - + self.assertRaises(InterpKernelException, DataArrayDouble_Dot, dbl2, dbl); - + self.assertRaises(InterpKernelException, DataArrayDouble_CrossProduct, dbl2, dbl); #Nb of components mismatch self.assertRaises(InterpKernelException, DataArrayDouble_CrossProduct, dbl2, dbl2); #Nb of components must be equal to 3 dbl4=DataArrayDouble.New(); @@ -1794,7 +1794,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): dbl5=DataArrayDouble.New(); dbl5.alloc(7,3); self.assertRaises(InterpKernelException, DataArrayDouble_CrossProduct, dbl4, dbl5); #Nb of tuples mismatch - + a[0]=dbl4; #Nb of tuple mismatch a[1]=dbl5; #Nb of tuple mismatch self.assertRaises(InterpKernelException, DataArrayDouble_Meld, a); @@ -1840,7 +1840,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertAlmostEqual(expected1[i],da4.getIJ(0,i),14); pass pass - + def testDAToNoInterlace1(self): tab1=[1,2,3,11,12,13,21,22,23,31,32,33,41,42,43] da=DataArrayInt.New(); @@ -1858,7 +1858,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertAlmostEqual(expected1[i],da4.getIJ(0,i),14); pass pass - + def testDAIsUniform1(self): tab1=[1,1,1,1,1] da=DataArrayInt.New(); @@ -1888,7 +1888,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): da=DataArrayInt() # non allocated array self.assertRaises(InterpKernelException, da.hasUniqueValues) pass - + def testDADFromPolarToCart1(self): tab1=[2.,0.2,2.5,0.7] da=DataArrayDouble.New(); @@ -1899,7 +1899,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertAlmostEqual(expected1[i],da2.getIJ(0,i),13); pass pass - + def testDADFromCylToCart1(self): tab1=[2.,0.2,4.,2.5,0.7,9.] da=DataArrayDouble.New(); @@ -1910,7 +1910,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertAlmostEqual(expected1[i],da2.getIJ(0,i),13); pass pass - + def testDADFromSpherToCart1(self): tab1=[2.,0.2,0.3,2.5,0.7,0.8] da=DataArrayDouble.New(); @@ -1996,7 +1996,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): coo = DataArrayDouble([0.0]*10) # Just to have some. Values do not matter. mesh = MEDCouplingUMesh("m", 2) mesh.setCoords(coo) - + # Linear c = [NORM_QUAD4, 0,1,0,2, NORM_TRI3, 0,1,1, NORM_TRI3, 0,1,2, NORM_QUAD4, 1,0,2,1, NORM_POLYGON, 1,0,1,1] cI = [0, 5, 9, 13, 18, 23] @@ -2006,30 +2006,30 @@ class MEDCouplingBasicsTest2(unittest.TestCase): c, cI = mesh.getNodalConnectivity().getValues(), mesh.getNodalConnectivityIndex().getValues() self.assertEqual(c, [NORM_QUAD4, 0,1,0,2, NORM_POLYGON, 0,1, NORM_TRI3, 0,1,2, NORM_TRI3, 1,0,2, NORM_POLYGON, 1,0]) self.assertEqual(cI, [0, 5, 8, 12, 16, 19]) - + res = mesh2.convertDegeneratedCellsAndRemoveFlatOnes() c, cI = mesh2.getNodalConnectivity().getValues(), mesh2.getNodalConnectivityIndex().getValues() self.assertEqual(c, [NORM_QUAD4, 0,1,0,2, NORM_TRI3, 0,1,2, NORM_TRI3, 1,0,2]) self.assertEqual(cI, [0, 5, 9, 13]) self.assertEqual(res.getValues(), [1,4]) - + # Quadratics now: c = [NORM_TRI6, 0,1,0, 2,3,0, NORM_QUAD8, 0,1,1,3, 4,1,6,7, NORM_QPOLYG, 0,1, NORM_QPOLYG, 0,1,2,2, NORM_TRI6, 0,1,2, 3,4,5] cI = [0, 7, 16, 19, 24, 31] mesh3.setConnectivity(DataArrayInt(c),DataArrayInt(cI)) - + mesh3.convertDegeneratedCells() c, cI = mesh3.getNodalConnectivity().getValues(), mesh3.getNodalConnectivityIndex().getValues() self.assertEqual(c, [NORM_QPOLYG, 0,1, 2,3, NORM_TRI6, 0,1,3, 4,6,7, NORM_QPOLYG, 0,1, NORM_QPOLYG, 0,1,2,2, NORM_TRI6, 0,1,2, 3,4,5]) self.assertEqual(cI, [0, 5, 12, 15, 20, 27]) mesh4 = mesh3.deepCopy() - + res = mesh4.convertDegeneratedCellsAndRemoveFlatOnes() c, cI = mesh4.getNodalConnectivity().getValues(), mesh4.getNodalConnectivityIndex().getValues() self.assertEqual(c, [NORM_QPOLYG, 0,1, 2,3, NORM_TRI6, 0,1,3, 4,6,7, NORM_TRI6, 0,1,2, 3,4,5]) self.assertEqual(cI, [0, 5, 12, 19]) self.assertEqual(res.getValues(), [2,3]) - + pass def testGetNodeIdsNearPoints1(self): @@ -3024,7 +3024,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertEqual(0,a.getIJ(1,0)); self.assertEqual(4,a.getIJ(2,0)); pass - + def testSwigErrorDaIntSelectByTupleId1(self): a=DataArrayInt.New(); arr1=[1,11,2,12,3,13,4,14,5,15,6,16,7,17] @@ -3060,7 +3060,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): da.renumberInPlace(d) da.renumber(d) pass - + pass if __name__ == '__main__': diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py index 887e0b73c..94ec01b73 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py @@ -22,7 +22,7 @@ import sys if sys.platform == "win32": from MEDCouplingCompat import * else: - from MEDCoupling import * + from medcoupling import * import unittest from math import pi,e,sqrt,cos,sin from datetime import datetime @@ -1971,14 +1971,14 @@ class MEDCouplingBasicsTest3(unittest.TestCase): res = d.normMaxPerComponent() self.assertAlmostEqual(-1.0, res[0],14) self.assertAlmostEqual(-1.0, res[1],14) - + tab=[2.3,-1.2,6.3,-7.8,2.9,7.7,2.1,0.,3.6,-7.6] d.setValues(tab,5,2); - + res = d.normMaxPerComponent() self.assertAlmostEqual(6.3, res[0],14) self.assertAlmostEqual(7.8, res[1],14) - + f.setArray(d); f.checkConsistencyLight(); # @@ -1988,7 +1988,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): # self.assertAlmostEqual(6.3,f.normMax(0),14); self.assertAlmostEqual(7.8,f.normMax(1),14); - + pass def testFindAndCorrectBadOriented3DExtrudedCells1(self): diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py index b513fb228..3bca65eeb 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py @@ -23,7 +23,7 @@ import sys if sys.platform == "win32": from MEDCouplingCompat import * else: - from MEDCoupling import * + from medcoupling import * import unittest from math import pi,e,sqrt,cos,sin from datetime import datetime @@ -49,7 +49,7 @@ def checkFreeMemory(size): dic['free'] = tmp dic['used'] = int(dic['total']) - int(dic['free']) ret = dic['free'] > size - #TODO: extend this method for Windows OS + #TODO: extend this method for Windows OS return ret @@ -565,7 +565,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): pass # pass - + def testComputeNeighborsOfCells1(self): m=MEDCouplingDataForTest.build2DTargetMesh_1(); d1,d2=m.computeNeighborsOfCells(); @@ -671,7 +671,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertTrue(subMesh.isEqual(m5,1e-12)) self.assertRaises(InterpKernelException,m.buildPartOfMySelf,[1,5],True); pass - + def testSwigGetItem3(self): da=DataArrayInt.New([4,5,6]) self.assertEqual(5,da[1]) @@ -926,14 +926,14 @@ class MEDCouplingBasicsTest4(unittest.TestCase): d-=2 d%=7 pass - + def testSwigDAIOp5(self): d=DataArrayInt.New([4,5,6,10,3,-1],2,3) self.toSeeIfDaIIopsAreOK(d) dExp=DataArrayInt.New([2,4,6,0,0,6],2,3) self.assertTrue(d.isEqual(dExp)); pass - + def toSeeIfDaDIopsAreOK(self,d): d+=5 d*=6 @@ -1044,7 +1044,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertAlmostEqual(expected4[i],ard2.getIJ(i,0),12) pass pass - + def testPartitionBySpreadZone1(self): m=MEDCouplingDataForTest.build2DTargetMesh_1(); m4=MEDCouplingUMesh.MergeUMeshes([m,m[-3:],m[0:2]]); @@ -1862,7 +1862,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): # m0=MEDCouplingUMesh("m",3) ; m0.allocateCells(0); m0.insertNextCell(NORM_TETRA4,[0,1,2,3]); #Well oriented m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,1,2,3,4]); #Well oriented - m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,1,2,3,4,5]); #Well oriented + m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,1,2,3,4,5]); #Well oriented m3=MEDCouplingUMesh("m",3) ; m3.allocateCells(0); m3.insertNextCell(NORM_HEXA8,[0,1,2,3,4,5,6,7]); #Well oriented m4=MEDCouplingUMesh("m",3) ; m4.allocateCells(0) self.assertRaises(InterpKernelException,m4.insertNextCell,NORM_HEXGP12,[0,1,2,3,4,5,6,7,8,9,10,11,12]); @@ -1890,8 +1890,8 @@ class MEDCouplingBasicsTest4(unittest.TestCase): # mOK=m.deepCopy() m0=MEDCouplingUMesh("m",3) ; m0.allocateCells(0); m0.insertNextCell(NORM_TETRA4,[0,2,1,3]); #Not well oriented - m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,1,2,3,4]); #Well oriented - m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,1,2,3,4,5]); #Well oriented + m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,1,2,3,4]); #Well oriented + m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,1,2,3,4,5]); #Well oriented m3=MEDCouplingUMesh("m",3) ; m3.allocateCells(0); m3.insertNextCell(NORM_HEXA8,[0,3,2,1,4,7,6,5]); #Not well oriented m4=MEDCouplingUMesh("m",3) ; m4.allocateCells(0); m4.insertNextCell(NORM_HEXGP12,[0,5,4,3,2,1,6,11,10,9,8,7]); #Not well oriented m0.setCoords(c0) ; m1.setCoords(c1) ; m2.setCoords(c2) ; m3.setCoords(c3) ; m4.setCoords(c4) @@ -1916,8 +1916,8 @@ class MEDCouplingBasicsTest4(unittest.TestCase): pass # m0=MEDCouplingUMesh("m",3) ; m0.allocateCells(0); m0.insertNextCell(NORM_TETRA4,[0,1,2,3]); #Well oriented - m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,3,2,1,4]); #Not well oriented - m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,2,1,3,5,4]); #Not well oriented + m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,3,2,1,4]); #Not well oriented + m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,2,1,3,5,4]); #Not well oriented m3=MEDCouplingUMesh("m",3) ; m3.allocateCells(0); m3.insertNextCell(NORM_HEXA8,[0,1,2,3,4,5,6,7]); #Well oriented m4 = MEDCouplingUMesh("m", 3) ; m4.allocateCells(0); m4.insertNextCell(NORM_HEXGP12, list(range(12))); # Well oriented m0.setCoords(c0) ; m1.setCoords(c1) ; m2.setCoords(c2) ; m3.setCoords(c3) ; m4.setCoords(c4) @@ -2272,7 +2272,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): pass def testSwigSetItem3(self): - # 1-2 + # 1-2 d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2) d[3]=[1,2] self.assertTrue(d.isEqual(DataArrayDouble([0,0,0,0,0,0,1,2,0,0,0,0],6,2),1e-14)) @@ -2332,7 +2332,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2) d[1::2,:]=[3,9] self.assertTrue(d.isEqual(DataArrayDouble([0,0,3,9,0,0,3,9,0,0,3,9],6,2),1e-14)) - # 1-2 + # 1-2 d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2) d[3]=[1,2] self.assertTrue(d.isEqual(DataArrayInt([0,0,0,0,0,0,1,2,0,0,0,0],6,2))) @@ -2889,7 +2889,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): d4**=d3 self.assertTrue(d4.isEqual(DataArrayDouble([1.,sqrt(2.),1.4422495703074083,sqrt(2.)]),1e-14)) pass - + def testSwig2Baryenter3DForCellsWithVolumeZero1(self): coo=DataArrayDouble([0.,0.,0.,1.,0.,0.,0.,1.,0.],3,3) m2=MEDCouplingUMesh("mesh",2) @@ -2970,7 +2970,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): d.alloc(1000,3) ; d.fillWithValue(127) self.assertTrue(len(d.__repr__())<500) pass - + def testSwig2MeshComputeIsoBarycenterOfNodesPerCell1(self): coo=DataArrayDouble([26.17509821414239,5.0374,200.,26.175098214142388,-5.0374,200.,17.450065476094927,20.1496,200.,8.725032738047464,25.187,200.,43.62516369023732,5.0374,200.,34.90013095218986,10.0748,200.,34.900130952189855,-10.0748,200.,43.625163690237315,-5.0374,200.,26.175098214142402,25.187,200.,26.175098214142395,35.2618,200.,17.45006547609493,40.2992,200.,8.725032738047469,35.2618,200.,26.17509821414239,5.0374,200.,26.175098214142388,-5.0374,200.,17.450065476094927,20.1496,200.,8.725032738047464,25.187,200.,43.62516369023732,5.0374,200.,34.90013095218986,10.0748,200.,34.900130952189855,-10.0748,200.,43.625163690237315,-5.0374,200.,26.175098214142402,25.187,200.,26.175098214142395,35.2618,200.,17.45006547609493,40.2992,200.,8.725032738047469,35.2618,200.],24,3) m=MEDCouplingUMesh.New("toto",3) @@ -3043,7 +3043,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertTrue(d.isEqual(DataArrayInt([0,0,0,0,0,0]))) self.assertTrue(e.isEqual(DataArrayInt([0,1,2,3,4,5,6]))) pass - + def testSwigAdvGauss(self): f=MEDCouplingFieldTemplate(ON_GAUSS_PT) f.setDiscretization(None) diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py index dbb54a78a..ee0056263 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py @@ -22,7 +22,7 @@ import sys if sys.platform == "win32": from MEDCouplingCompat import * else: - from MEDCoupling import * + from medcoupling import * import unittest from math import pi,e,sqrt,cos,sin diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py index 9198a554f..d82a7aa10 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py @@ -23,7 +23,7 @@ import sys if sys.platform == "win32": from MEDCouplingCompat import * else: - from MEDCoupling import * + from medcoupling import * import unittest from math import pi,e,sqrt,cos,sin from datetime import datetime @@ -194,7 +194,7 @@ class MEDCouplingBasicsTest6(unittest.TestCase): a1.rearrange(3) self.assertRaises(InterpKernelException,a1.findIdForEach,b1) # a1 is not single component pass - + def testAttractSeg3MidPtsAroundNodes1(self): """ Test of MEDCouplingUMesh.attractSeg3MidPtsAroundNodes methods """ ptsExpToBeModified=DataArrayInt([95,96,97,98,101,103,104,106,108,110]) @@ -272,7 +272,7 @@ class MEDCouplingBasicsTest6(unittest.TestCase): arrOfDisc=fGauss.getLocalizationOfDiscr() self.assertTrue(arrOfDisc.isEqual(DataArrayDouble([0.2,0.2,0.2,0.5,0.5,0.5,0.9,0.9,0.9],3,3),1e-12)) pass - + def testUMeshGetCellsContainingPtOn2DNonDynQuadraticCells(self): """getCellsContainingPoint is now dealing curves of quadratic 2D elements. This test is a mesh containing 2 QUAD8 cells. The input point is located at a special loc. diff --git a/src/MEDCoupling_Swig/MEDCouplingDataForTest.py b/src/MEDCoupling_Swig/MEDCouplingDataForTest.py index a4f0354d8..7f26f4b61 100644 --- a/src/MEDCoupling_Swig/MEDCouplingDataForTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingDataForTest.py @@ -23,7 +23,7 @@ import sys if sys.platform == "win32": from MEDCouplingCompat import * else: - from MEDCoupling import * + from medcoupling import * class MEDCouplingDataForTest: def build2DTargetMesh_1(cls): @@ -42,7 +42,7 @@ class MEDCouplingDataForTest: myCoords.setValues(targetCoords,9,2); targetMesh.setCoords(myCoords); return targetMesh; - + def build2DSourceMesh_1(cls): sourceCoords=[-0.3,-0.3, 0.7,-0.3, -0.3,0.7, 0.7,0.7] sourceConn=[0,3,1,0,2,3] @@ -55,7 +55,7 @@ class MEDCouplingDataForTest: myCoords.setValues(sourceCoords,4,2); sourceMesh.setCoords(myCoords); return sourceMesh; - + def build3DTargetMesh_1(cls): targetCoords=[ 0., 0., 0., 50., 0., 0. , 200., 0., 0. , 0., 50., 0., 50., 50., 0. , 200., 50., 0., 0., 200., 0., 50., 200., 0. , 200., 200., 0. , 0., 0., 50., 50., 0., 50. , 200., 0., 50. , 0., 50., 50., 50., 50., 50. , 200., 50., 50., 0., 200., 50., 50., 200., 50. , 200., 200., 50. , @@ -98,7 +98,7 @@ class MEDCouplingDataForTest: myCoords.setValues(sourceCoords,9,3); sourceMesh.setCoords(myCoords); return sourceMesh; - + def build3DSurfTargetMesh_1(self): targetCoords=[-0.3,-0.3,0.5, 0.2,-0.3,1., 0.7,-0.3,1.5, -0.3,0.2,0.5, 0.2,0.2,1., 0.7,0.2,1.5, -0.3,0.7,0.5, 0.2,0.7,1., 0.7,0.7,1.5] @@ -143,7 +143,7 @@ class MEDCouplingDataForTest: 30,41,31,33,45,56,46,48, 31,32,34,37,43,36,-1,31,46,51,36,-1,36,51,58,43,-1,43,37,52,58,-1,37,34,49,52,-1,34,32,47,49,-1,32,31,46,47,-1,46,51,58,52,49,47, 31,36,35,33,46,51,50,48, 43,40,39,36,58,55,54,51, 41,38,37,34,32,31,-1,41,56,46,31,-1,31,46,47,32,-1,32,47,49,34,-1,34,49,52,37,-1,37,38,53,52,-1,38,41,56,53,-1,56,46,47,49,52,53, - 37,42,44,43,52,57,59,58] + 37,42,44,43,52,57,59,58] conn2=[7,12,14,13, 11,8,7,4,2,1, 13,10,9,6, 1,6,5,3, 1,2,4,7,13,6, 0,11,1,3] # ret=MEDCouplingUMesh.New(); @@ -188,7 +188,7 @@ class MEDCouplingDataForTest: mesh2D.finishInsertingCells(); mesh2D.setCoords(myCoords); return ret,mesh2D - + def buildCU1DMesh_U(self): coords=[ 0.0, 0.3, 0.75, 1.0 ] conn=[ 0,1, 1,2, 2,3 ] @@ -284,7 +284,7 @@ class MEDCouplingDataForTest: myCoords.setValues(targetCoords,9,2); targetMesh.setCoords(myCoords); return targetMesh; - + def build1DSourceMesh_2(cls): ret=MEDCouplingUMesh.New("1DSourceMesh",1); ret.allocateCells(4); @@ -581,7 +581,7 @@ class MEDCouplingDataForTest: mesh2.insertNextCell(NORM_QUAD4,4,conn2[16:20]) mesh2.finishInsertingCells(); return [mesh,mesh2] - + # 2D usecase1 for interpolation Gauss Pt-> Gauss Pt. Coming from ASTER : Please, do not touch def buildFieldOnGauss_1(self): coo=DataArrayDouble([1.0,0.0,1.33333333333333,0.0,1.66666666666667,0.0,0.923879532511287,0.38268343236509006,1.23183937668172,0.510244576486786,1.53979922085214,0.6378057206084831,2.0,0.0,1.8477590650225701,0.7653668647301801,0.9428090415820631,0.9428090415820631,1.1785113019775801,1.1785113019775801,1.4142135623731,1.41421356237309,0.707106781186548,0.707106781186547,0.38268343236509006,0.923879532511287,0.510244576486786,1.23183937668172,0.6378057206084831,1.53979922085214,0.7653668647301801,1.8477590650225701,3.1550283219328204e-17,1.33333333333333,1.16009632455949e-17,1.66666666666667,-2.7620050344068196e-16,2.0,-1.3810025172034098e-16,1.0,-2.0,0.0,-1.53979922085214,0.6378057206084831,-1.66666666666667,0.0,-1.33333333333333,0.0,-0.923879532511287,0.38268343236509006,-1.8477590650225701,0.7653668647301801,-0.9428090415820631,0.9428090415820631,-1.23183937668172,0.510244576486786,-1.83333333333333,0.0,-1.6937791429373599,0.701586292669331,-1.5,0.0,-1.30771370720431,0.26012042935483803,-1.16666666666667,0.0,-1.0778594545965,0.44646400442593803,-1.38578268717091,0.9259503883660041,-1.38581929876693,0.574025148547635,-1.06066017177982,1.06066017177982,-0.8314696123025451,0.5555702330196021,-1.0,0.0,-1.1785113019775801,1.1785113019775801,-0.707106781186548,0.707106781186547,-1.63464213400538,0.325150536693547,-1.9615705608064598,0.390180644032256,-1.47117792060485,0.292635483024192,-0.9807852804032301,0.19509032201612803,-1.524360955888,1.0185454272026,-1.2963624321753402,1.2963624321753402,-1.10862614973673,0.740760310692803,-0.970047881019636,0.6481652718562021,-0.824957911384305,0.824957911384305,-1.4142135623731,1.41421356237309,-1.7981063474059198,0.357665590362902,-1.1442494938037702,0.227605375685483,-1.66293922460509,1.1111404660392,-1.24720441845382,0.833355349529403,-0.7653668647301801,1.8477590650225701,-0.6378057206084831,1.53979922085214,-0.510244576486786,1.23183937668172,-0.701586292669331,1.6937791429373599,-0.574025148547635,1.38581929876693,-0.44646400442593803,1.0778594545965,-0.38268343236509006,0.923879532511287,-0.9259503883660041,1.38578268717091,-0.740760310692803,1.10862614973673,-0.5555702330196021,0.8314696123025451,-0.325150536693547,1.63464213400538,-0.26012042935483803,1.30771370720431,-0.19509032201612803,0.9807852804032301,1.6805133673525298e-18,1.83333333333333,-2.4643915380595496e-16,1.5,-1.4799359654427099e-16,1.16666666666667,-1.1111404660392,1.66293922460509,-0.39018064403225705,1.9615705608064598],73,2) @@ -690,40 +690,40 @@ class MEDCouplingDataForTest: def buildCircle(self, center_X, center_Y, radius): from cmath import rect - from math import pi - + from math import pi + c = [rect(radius, i * pi / 4.0) for i in range(8)] coords = [c[-1].real,c[-1].imag, c[3].real,c[3].imag, c[5].real,c[5].imag, c[1].real,c[1].imag] connec = list(range(4)) - baseMesh = MEDCouplingUMesh.New("circle", 2) + baseMesh = MEDCouplingUMesh.New("circle", 2) baseMesh.allocateCells(1) meshCoords = DataArrayDouble.New(coords, len(coords) // 2, 2) meshCoords += (center_X, center_Y) baseMesh.setCoords(meshCoords) - - baseMesh.insertNextCell(NORM_QPOLYG, connec) - baseMesh.finishInsertingCells() + + baseMesh.insertNextCell(NORM_QPOLYG, connec) + baseMesh.finishInsertingCells() return baseMesh - def buildCircle2(self, center_X, center_Y, radius): + def buildCircle2(self, center_X, center_Y, radius): from cmath import rect - from math import pi - + from math import pi + c = [rect(radius, i * pi / 4.0) for i in range(8)] coords = [] for i in range(8): coords.extend([c[i].real,c[i].imag]) connec = [7,5,3,1, 6,4,2,0] - baseMesh = MEDCouplingUMesh.New("circle", 2) + baseMesh = MEDCouplingUMesh.New("circle", 2) baseMesh.allocateCells(1) meshCoords = DataArrayDouble.New(coords, len(coords) // 2, 2) meshCoords += (center_X, center_Y) baseMesh.setCoords(meshCoords) - - baseMesh.insertNextCell(NORM_QPOLYG, connec) - baseMesh.finishInsertingCells() - return baseMesh + + baseMesh.insertNextCell(NORM_QPOLYG, connec) + baseMesh.finishInsertingCells() + return baseMesh build2DTargetMesh_1=classmethod(build2DTargetMesh_1) build2DSourceMesh_1=classmethod(build2DSourceMesh_1) diff --git a/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py b/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py index 7c061c2d5..26499420c 100644 --- a/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py @@ -23,7 +23,7 @@ import sys if sys.platform == "win32": from MEDCouplingCompat import * else: - from MEDCoupling import * + from medcoupling import * import unittest from math import pi, sqrt @@ -72,11 +72,11 @@ class MEDCouplingBasicsTest(unittest.TestCase): field2 = MEDCouplingFieldDouble( ON_NODES ) field2.setArray( valsArr2 ) - # max field + # max field fieldMax = MEDCouplingFieldDouble.MaxFields( field1, field2 ) self.assertTrue( fieldMax.getArray().getValues() == valsMax ) - # min field + # min field fieldMin = MEDCouplingFieldDouble.MinFields( field1, field2 ) self.assertTrue( fieldMin.getArray().getValues() == valsMin ) #! [PySnippet_MEDCouplingFieldDouble_MaxFields_1] @@ -182,7 +182,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): # transform the field to a 3D vector field func = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10" varNames=["a","b"] # names used to refer to X and Y components - field.applyFuncNamedCompo( 3, varNames, func ) # require 3 components + field.applyFuncNamedCompo( 3, varNames, func ) # require 3 components self.assertTrue( field.getNumberOfComponents() == 3 ) # 3 components as required #! [PySnippet_MEDCouplingFieldDouble_applyFunc3_1] #! [PySnippet_MEDCouplingFieldDouble_applyFunc3_2] @@ -205,7 +205,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): field.setArray( array ) # transform the field to a 3D vector field func = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10" - field.applyFuncCompo( 3, func ) # require 3 components + field.applyFuncCompo( 3, func ) # require 3 components self.assertTrue( field.getNumberOfComponents() == 3 ) # 3 components as required #! [PySnippet_MEDCouplingFieldDouble_applyFunc2_1] #! [PySnippet_MEDCouplingFieldDouble_applyFunc2_2] @@ -226,7 +226,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): field.setArray( array ) # transform the field to a 3D vector field func = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10" - field.applyFunc( 3, func ) # require 3 components + field.applyFunc( 3, func ) # require 3 components self.assertTrue( field.getNumberOfComponents() == 3 ) # 3 components as required #! [PySnippet_MEDCouplingFieldDouble_applyFunc_1] #! [PySnippet_MEDCouplingFieldDouble_applyFunc_2] @@ -730,9 +730,9 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.setMeshDimension(2) mesh.allocateCells(5) conn=[0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4] - mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) - mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) - mesh.insertNextCell(NORM_TRI3,3, conn[7:10]) + mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) + mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) + mesh.insertNextCell(NORM_TRI3,3, conn[7:10]) mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]) mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]) mesh.finishInsertingCells() @@ -876,9 +876,9 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.setMeshDimension(2) mesh.allocateCells(5) conn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4] - mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) - mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) - mesh.insertNextCell(NORM_TRI3,3, conn[7:10]) + mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) + mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) + mesh.insertNextCell(NORM_TRI3,3, conn[7:10]) mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]) mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]) mesh.finishInsertingCells() @@ -888,7 +888,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): #! [PySnippet_MEDCouplingUMesh_findBoundaryNodes_1] #! [PySnippet_MEDCouplingUMesh_findBoundaryNodes_2] nodeIdsArr=mesh.findBoundaryNodes() - assert nodeIdsArr.getNumberOfTuples() == mesh.getNumberOfNodes() - 1 + assert nodeIdsArr.getNumberOfTuples() == mesh.getNumberOfNodes() - 1 #! [PySnippet_MEDCouplingUMesh_findBoundaryNodes_2] return @@ -898,9 +898,9 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.setMeshDimension(2) mesh.allocateCells(5) conn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4] - mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) - mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) - mesh.insertNextCell(NORM_TRI3,3, conn[7:10]) + mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) + mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) + mesh.insertNextCell(NORM_TRI3,3, conn[7:10]) mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]) mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]) mesh.finishInsertingCells() @@ -1003,9 +1003,9 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.setMeshDimension(2) mesh.allocateCells(5) conn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4] - mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) - mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) - mesh.insertNextCell(NORM_TRI3,3, conn[7:10]) + mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) + mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) + mesh.insertNextCell(NORM_TRI3,3, conn[7:10]) mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]) mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]) mesh.finishInsertingCells() @@ -1058,8 +1058,8 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.setMeshDimension(2) mesh.allocateCells(5) conn=[0,3,4,1, 1,4,2, 4,5,2] - mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) - mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) + mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) + mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) mesh.insertNextCell(NORM_TRI3,3, conn[7:10]) mesh.finishInsertingCells() coords=[0.3,-0.301, # 0 @@ -1121,9 +1121,9 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.setMeshDimension(2) mesh.allocateCells(5) conn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4] - mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) - mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) - mesh.insertNextCell(NORM_TRI3,3, conn[7:10]) + mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) + mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) + mesh.insertNextCell(NORM_TRI3,3, conn[7:10]) mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]) mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]) mesh.finishInsertingCells() @@ -1146,9 +1146,9 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.setMeshDimension(2) mesh.allocateCells(5) conn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4] - mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) - mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) - mesh.insertNextCell(NORM_TRI3,3, conn[7:10]) + mesh.insertNextCell(NORM_QUAD4,4,conn[0:4]) + mesh.insertNextCell(NORM_TRI3,3, conn[4:7]) + mesh.insertNextCell(NORM_TRI3,3, conn[7:10]) mesh.insertNextCell(NORM_QUAD4,4,conn[10:14]) mesh.insertNextCell(NORM_QUAD4,4,conn[14:18]) mesh.finishInsertingCells() @@ -1904,7 +1904,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): def testExample_DataArrayDouble_findCommonTuples1(self): #! [PySnippet_DataArrayDouble_findCommonTuples1] array2=[2.3,2.3, 1.2,1.2, 1.3,1.3, 2.3,2.3, 2.301,2.301, 0.8,0.8] - da=DataArrayDouble(array2,6,2) + da=DataArrayDouble(array2,6,2) #! [PySnippet_DataArrayDouble_findCommonTuples1] #! [PySnippet_DataArrayDouble_findCommonTuples2] c,cI=da.findCommonTuples(1.01e-1) @@ -1976,7 +1976,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): #! [SnippeDataArrayIntKeepSelectedComponents1_1] arr1=[1,2,3,4, # tuple 0 11,12,13,14, # tuple 1 - 21,22,23,24, # + 21,22,23,24, # 31,32,33,34, 41,42,43,44] a1=DataArrayInt() @@ -2111,7 +2111,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): def testExampleUMeshStdBuild1(self): # ! [PySnippetUMeshStdBuild1_1] - coords=[-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., + coords=[-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0. ] nodalConnPerCell=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4] # ! [PySnippetUMeshStdBuild1_1] @@ -2130,7 +2130,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh.finishInsertingCells() # ! [PySnippetUMeshStdBuild1_3] # ! [PySnippetUMeshStdBuild1_4] - coordsArr=DataArrayDouble(coords,9,3)#here coordsArr are declared to have 3 components, mesh will deduce that its spaceDim==3. + coordsArr=DataArrayDouble(coords,9,3)#here coordsArr are declared to have 3 components, mesh will deduce that its spaceDim==3. mesh.setCoords(coordsArr)#coordsArr contains 9 tuples, that is to say mesh contains 9 nodes. # ! [PySnippetUMeshStdBuild1_4] # ! [PySnippetUMeshStdBuild1_5] @@ -2172,7 +2172,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): def testExampleUMeshAdvBuild1(self): # ! [PySnippetUMeshAdvBuild1_1] - coords=[-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., + coords=[-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0. ] nodalConnPerCell=[4,0,3,4,1, 3,1,4,2, 3,4,5,2, 4,6,7,4,3, 4,7,8,5,4] nodalConnPerCellIndex=[0,5,9,13,18,23] diff --git a/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py b/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py index a53fe2f59..a66015aa0 100644 --- a/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py @@ -23,7 +23,7 @@ import sys if sys.platform == "win32": from MEDCouplingCompat import * else: - from MEDCoupling import * + from medcoupling import * import unittest from math import pi,e,sqrt,cos,sin from datetime import datetime diff --git a/src/MEDCoupling_Swig/MEDCouplingPickleTest.py b/src/MEDCoupling_Swig/MEDCouplingPickleTest.py index e89cc5296..8ce564d43 100644 --- a/src/MEDCoupling_Swig/MEDCouplingPickleTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingPickleTest.py @@ -23,7 +23,7 @@ import sys if sys.platform == "win32": from MEDCouplingCompat import * else: - from MEDCoupling import * + from medcoupling import * from MEDCouplingDataForTest import MEDCouplingDataForTest if MEDCouplingHasNumPyBindings(): @@ -72,7 +72,7 @@ class MEDCouplingPickleTest(unittest.TestCase): xx=pickle.loads(pickled) self.assertTrue(xx.isEqual(x)) pass - + @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy") def test3(self): """ Test of a MEDCouplingUMesh pickeling.""" @@ -119,7 +119,7 @@ class MEDCouplingPickleTest(unittest.TestCase): self.assertTrue(m2.isEqual(m,1e-16)) self.assertTrue(m2.getCoordsAt(0).isEqual(arrX,1e-16)) pass - + @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy") def test6(self): """ Test of a MEDCoupling1SGTUMesh pickeling.""" @@ -131,7 +131,7 @@ class MEDCouplingPickleTest(unittest.TestCase): m2=pickle.loads(st) self.assertTrue(m2.isEqual(m,1e-16)) pass - + @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy") def test7(self): """ Test of a MEDCoupling1DGTUMesh pickeling.""" @@ -348,7 +348,7 @@ class MEDCouplingPickleTest(unittest.TestCase): self.assertTrue(f2.isEqual(f,1e-16,0)) self.assertTrue(f2.getMesh().isEqual(f.getMesh(),1e-16)) pass - + @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy") def test17(self): """ Test of MEDCouplingFieldInt lying on MEDCouplingCMesh pickeling. """ diff --git a/src/MEDCoupling_Swig/UsersGuideExamplesTest.py b/src/MEDCoupling_Swig/UsersGuideExamplesTest.py index 89cdf74ee..bc1e5e0b2 100755 --- a/src/MEDCoupling_Swig/UsersGuideExamplesTest.py +++ b/src/MEDCoupling_Swig/UsersGuideExamplesTest.py @@ -23,7 +23,7 @@ import sys if sys.platform == "win32": from MEDCouplingCompat import * else: - from MEDCoupling import * + from medcoupling import * from math import pi, sqrt # ! [PySnippetUMeshStdBuild1_1] diff --git a/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py b/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py index 21e3ab367..6ad489506 100644 --- a/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py +++ b/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py @@ -21,7 +21,7 @@ import sys if sys.platform == "win32": from MEDCouplingCompat import * else: - from MEDCoupling import * + from medcoupling import * from math import pi, sqrt diff --git a/src/RENUMBER_Swig/UsersGuideExamplesTest.py b/src/RENUMBER_Swig/UsersGuideExamplesTest.py index 7aba34319..63b66c9ff 100644 --- a/src/RENUMBER_Swig/UsersGuideExamplesTest.py +++ b/src/RENUMBER_Swig/UsersGuideExamplesTest.py @@ -23,7 +23,7 @@ import sys if sys.platform == "win32": from MEDCouplingCompat import * else: - from MEDCoupling import * + from medcoupling import * from math import pi, sqrt