Salome HOME
Non regression tests for MEDLoader.GetTypesOfField bug
[tools/medcoupling.git] / src / MEDLoader / Swig / VTKReader.py
index 8359d26da69b7a0f4d167c14d4838ea8781de56b..1746564d7dab770b1badb845eda4026506c7bd76 100644 (file)
@@ -1,10 +1,10 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+# Copyright (C) 2007-2014  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,7 +17,7 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-# Author Anthony GEAY (CEA/DEN/DM2S/STMF)
+# Author Anthony GEAY (CEA/DEN/DM2S/STMF)
 
 from MEDLoader import *
 
@@ -171,11 +171,12 @@ class VTURawReader:
         m.checkCoherency() ; mm=MEDFileUMesh() ; mm.setMeshAtLevel(0,m) ; ms.pushMesh(mm)
         # Fields on nodes and on cells
         for spatialDisc,nbEnt,fields in [(ON_NODES,rd._nb_nodes,rd._node_fields),(ON_CELLS,rd._nb_cells,rd._cell_fields)]: 
-            for name,typ,nbCompo,off in rd._node_fields:
+            for name,typ,nbCompo,off in fields:
                 ff=MEDFileFieldMultiTS()
                 f=MEDCouplingFieldDouble(spatialDisc,ONE_TIME)
                 f.setName(name) ; f.setMesh(m)
                 vals=np.memmap(fd,dtype=typ,mode='r',offset=ref+off,shape=(nbEnt*nbCompo))
+                vals=self.__swapIfNecessary(rd._bo,vals)
                 arr=DataArrayDouble(np.array(vals,dtype='float64')) ; arr.rearrange(nbCompo)
                 f.setArray(arr) ; f.checkCoherency()
                 f.setTime(self._time[0],self._time[1],0)