]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
VTK wants coordinates array with exactly 3 components.
authorageay <ageay>
Thu, 7 Nov 2013 13:20:21 +0000 (13:20 +0000)
committerageay <ageay>
Thu, 7 Nov 2013 13:20:21 +0000 (13:20 +0000)
src/MEDLoader/MEDFileFieldOverView.cxx
src/MEDLoader/Swig/MEDLoaderTest4.py

index 291cedaf02e4b7203c0d02a63e77738ecc7ab2f1..d12e0c36657bc2bdc904e1ef6651bf932a0713fd 100644 (file)
@@ -638,6 +638,8 @@ void MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *
     reorderNodesIfNecessary(a,d,0);
   else
     reorderNodesIfNecessary(a,d,f);
+  if(a->getNumberOfComponents()!=3)
+    a=a->changeNbOfComponents(3,0.);
   coords=a.retn(); types=b.retn(); cellLocations=c.retn(); cells=d.retn();
   if(!isPolyh)
     { faceLocations=0; faces=0; }
index c6b2c1ba6f1ed454c39a75ed77b94ff29bc96089..fb775116eb7a2480d8c86dbae326814b75791ba1 100644 (file)
@@ -176,7 +176,7 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(fcscp.isDataSetSupportEqualToThePreviousOne(i,fields))
             pass
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
-        self.assertTrue(a0.isEqual(a0Exp,1e-12))
+        self.assertTrue(a0.isEqual(a0Exp.changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,5,5,5,9,9,9,9,9])))
         self.assertTrue(a2.isEqual(DataArrayInt([2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,67,70,73,76,80,84,88,92,96])))
         self.assertTrue(a3.isEqual(DataArrayInt([2,0,1,2,1,2,2,2,0,2,3,4,2,4,5,2,5,3,2,6,7,2,7,8,2,8,6,2,9,10,2,10,11,2,11,9,2,12,13,2,13,14,2,14,15,2,15,12,2,16,17,2,17,18,2,18,19,2,19,16,2,20,21,2,21,22,2,22,23,2,23,20,2,24,25,2,25,26,2,26,27,2,27,24,2,28,29,2,29,30,2,30,31,2,31,28,3,0,1,2,3,3,4,5,3,6,7,8,3,9,10,11,4,12,13,14,15,4,16,17,18,19,4,20,21,22,23,4,24,25,26,27,4,28,29,30,31])))
@@ -381,7 +381,7 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(fcscp.isDataSetSupportEqualToThePreviousOne(i,fields))
             pass
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
-        self.assertTrue(a0.isEqual(a0Exp,1e-12))
+        self.assertTrue(a0.isEqual(a0Exp.changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,5,5,5,9,9,9,9,9])))
         self.assertTrue(a2.isEqual(DataArrayInt([2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,67,70,73,76,80,84,88,92,96])))
         self.assertTrue(a3.isEqual(DataArrayInt([2,0,1,2,1,2,2,2,0,2,3,4,2,4,5,2,5,3,2,6,7,2,7,8,2,8,6,2,9,10,2,10,11,2,11,9,2,12,13,2,13,14,2,14,15,2,15,12,2,16,17,2,17,18,2,18,19,2,19,16,2,20,21,2,21,22,2,22,23,2,23,20,2,24,25,2,25,26,2,26,27,2,27,24,2,28,29,2,29,30,2,30,31,2,31,28,3,0,1,2,3,3,4,5,3,6,7,8,3,9,10,11,4,12,13,14,15,4,16,17,18,19,4,20,21,22,23,4,24,25,26,27,4,28,29,30,31])))
@@ -539,7 +539,7 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(fcscp.isDataSetSupportEqualToThePreviousOne(i,fields))
             pass
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
-        self.assertTrue(a0.isEqual(a0Exp,1e-12))
+        self.assertTrue(a0.isEqual(a0Exp.changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,5,5,5,9,9,9,9,9])))
         self.assertTrue(a2.isEqual(DataArrayInt([2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,67,70,73,76,80,84,88,92,96])))
         self.assertTrue(a3.isEqual(DataArrayInt([2,0,1,2,1,2,2,2,0,2,3,4,2,4,5,2,5,3,2,6,7,2,7,8,2,8,6,2,9,10,2,10,11,2,11,9,2,12,13,2,13,14,2,14,15,2,15,12,2,16,17,2,17,18,2,18,19,2,19,16,2,20,21,2,21,22,2,22,23,2,23,20,2,24,25,2,25,26,2,26,27,2,27,24,2,28,29,2,29,30,2,30,31,2,31,28,3,0,1,2,3,3,4,5,3,6,7,8,3,9,10,11,4,12,13,14,15,4,16,17,18,19,4,20,21,22,23,4,24,25,26,27,4,28,29,30,31])))
@@ -568,7 +568,7 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(fcscp.isDataSetSupportEqualToThePreviousOne(i,fields))
             pass
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
-        self.assertTrue(a0.isEqual(a0Exp,1e-12))
+        self.assertTrue(a0.isEqual(a0Exp.changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([5,5,5,5,9,9,9,9,9])))
         self.assertTrue(a2.isEqual(DataArrayInt([3,6,9,12,16,20,24,28,32])))
         self.assertTrue(a3.isEqual(DataArrayInt([3,0,1,2,3,3,4,5,3,6,7,8,3,9,10,11,4,12,13,14,15,4,16,17,18,19,4,20,21,22,23,4,24,25,26,27,4,28,29,30,31])))
@@ -789,7 +789,7 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(fcscp.isDataSetSupportEqualToThePreviousOne(i,fields))
             pass
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
-        self.assertTrue(a0.isEqual(a0Exp,1e-12))
+        self.assertTrue(a0.isEqual(a0Exp.changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([5,5,5,5,9,9,9,9,9])))
         self.assertTrue(a2.isEqual(DataArrayInt([3,6,9,12,16,20,24,28,32])))
         self.assertTrue(a3.isEqual(DataArrayInt([3,0,1,2,3,3,4,5,3,6,7,8,3,9,10,11,4,12,13,14,15,4,16,17,18,19,4,20,21,22,23,4,24,25,26,27,4,28,29,30,31])))
@@ -912,7 +912,7 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
-        self.assertTrue(a0.isEqual(a0Exp[pfl2],1e-12))
+        self.assertTrue(a0.isEqual(a0Exp[pfl2].changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([5,5,5,5,5,5])))
         self.assertTrue(a2.isEqual(DataArrayInt([3,6,9,12,15,18])))
         self.assertTrue(a3.isEqual(DataArrayInt([3,0,3,1,3,3,4,1,3,1,4,2,3,4,5,2,3,6,5,4,3,6,7,5])))
@@ -942,7 +942,7 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(fcscp.isDataSetSupportEqualToThePreviousOne(i,fields))
             pass
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
-        self.assertTrue(a0.isEqual(a0Exp,1e-12))
+        self.assertTrue(a0.isEqual(a0Exp.changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([5,5,5,5,5,5,9,9])))
         self.assertTrue(a2.isEqual(DataArrayInt([3,6,9,12,15,18,22,26])))
         self.assertTrue(a3.isEqual(DataArrayInt([3,2,7,3,3,7,8,3,3,3,8,4,3,8,9,4,3,13,9,8,3,13,14,9,4,6,11,12,7,4,12,13,8,7])))
@@ -1116,7 +1116,7 @@ class MEDLoaderTest4(unittest.TestCase):
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
         a0Exp=DataArrayDouble([0.,0.,1.1,0.,2.2,0.,3.3,0.,4.4,0.,0.,1.7,1.1,1.7,2.2,1.7,3.3,1.7,4.4,1.7,0.,3.4,1.1,3.4,2.2,3.4,3.3,3.4,4.4,3.4],15,2)
         a0Exp.setInfoOnComponents(["XX [m]","YYY [km]"])
-        self.assertTrue(a0.isEqual(a0Exp,1e-12))
+        self.assertTrue(a0.isEqual(a0Exp.changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([9,9,9,9])))
         self.assertTrue(a2.isEqual(DataArrayInt([4,8,12,16])))
         self.assertTrue(a3.isEqual(DataArrayInt([4,3,2,7,8,4,4,3,8,9,4,7,6,11,12,4,9,8,13,14])))
@@ -1291,7 +1291,7 @@ class MEDLoaderTest4(unittest.TestCase):
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
         a0Exp=DataArrayDouble([0.,0.,1.1,0.,2.2,0.,3.3,0.,4.4,0.,0.,1.7,1.1,1.7,2.2,1.7,3.3,1.7,4.4,1.7,0.,3.4,1.1,3.4,2.2,3.4,3.3,3.4,4.4,3.4],15,2)
         a0Exp.setInfoOnComponents(["XX [m]","YYY [km]"])
-        self.assertTrue(a0.isEqual(a0Exp,1e-12))
+        self.assertTrue(a0.isEqual(a0Exp.changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([9,9,9,9])))
         self.assertTrue(a2.isEqual(DataArrayInt([4,8,12,16])))
         self.assertTrue(a3.isEqual(DataArrayInt([4,3,2,7,8,4,4,3,8,9,4,7,6,11,12,4,9,8,13,14])))
@@ -1400,7 +1400,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
-        self.assertTrue(a0.isEqual(a0Exp,1e-12))
+        self.assertTrue(a0.isEqual(a0Exp.changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([5,5,5,5,5,5,9,9,9,9,9])))
         self.assertTrue(a2.isEqual(DataArrayInt([3,6,9,12,15,18,22,26,30,34,38])))
         self.assertTrue(a3.isEqual(DataArrayInt([3,2,7,3,3,7,8,3,3,3,8,4,3,8,9,4,3,13,9,8,3,13,14,9,4,0,5,6,1,4,1,6,7,2,4,5,10,11,6,4,6,11,12,7,4,12,13,8,7])))
@@ -1542,7 +1542,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
-        self.assertTrue(a0.isEqual(a0Exp[pfl2],1e-12))
+        self.assertTrue(a0.isEqual(a0Exp[pfl2].changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([5,5,9,9,9])))
         self.assertTrue(a2.isEqual(DataArrayInt([3,6,10,14,18])))
         self.assertTrue(a3.isEqual(DataArrayInt([3,1,4,2,3,4,5,2,4,0,3,4,1,4,3,6,7,4,4,7,8,5,4])))
@@ -1669,7 +1669,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
-        self.assertTrue(a0.isEqual(a0Exp[pfl1],1e-12))
+        self.assertTrue(a0.isEqual(a0Exp[pfl1].changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([5,5,9,9,9])))
         self.assertTrue(a2.isEqual(DataArrayInt([3,6,10,14,18])))
         self.assertTrue(a3.isEqual(DataArrayInt([3,1,4,2,3,4,5,2,4,0,3,4,1,4,3,6,7,4,4,7,8,5,4])))
@@ -1766,7 +1766,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
-        self.assertTrue(a0.isEqual(a0Exp,1e-12))
+        self.assertTrue(a0.isEqual(a0Exp.changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9])))
         self.assertTrue(a2.isEqual(DataArrayInt([4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64])))
         self.assertTrue(a3.isEqual(DataArrayInt([4,1,0,5,6,4,3,2,7,8,4,4,3,8,9,4,6,5,10,11,4,9,8,13,14,4,19,18,23,24,4,2,1,6,7,4,7,6,11,12,4,11,10,15,16,4,12,11,16,17,4,8,7,12,13,4,13,12,17,18,4,17,16,21,22,4,14,13,18,19,4,16,15,20,21,4,18,17,22,23]))) # <- here the mesh is renumbered : the mesh is equal to m[[0,2,3,4,7,15, 1,5,8,9, 6,10,13, 11,12,14]]
@@ -1855,7 +1855,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
         a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
-        self.assertTrue(a0.isEqual(a0Exp,1e-12))
+        self.assertTrue(a0.isEqual(a0Exp.changeNbOfComponents(3,0.),1e-12))
         self.assertTrue(a1.isEqual(DataArrayByte([9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9])))
         self.assertTrue(a2.isEqual(DataArrayInt([4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64])))
         self.assertTrue(a3.isEqual(DataArrayInt([4,1,0,5,6,4,2,1,6,7,4,3,2,7,8,4,4,3,8,9,4,6,5,10,11,4,7,6,11,12,4,8,7,12,13,4,9,8,13,14,4,11,10,15,16,4,12,11,16,17,4,13,12,17,18,4,14,13,18,19,4,16,15,20,21,4,17,16,21,22,4,18,17,22,23,4,19,18,23,24]))) # <- here the mesh is NOT renumbered : the mesh is equal to m