Salome HOME
Copyright update 2022
[tools/medcoupling.git] / src / MEDLoader / Swig / CaseReader.py
index e2d419306b0c5d1e9dd4fbf1582978adb4e1f97f..d629818d0f2d81486ebd7ddc13b953f9df5f5385 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2020  CEA/DEN, EDF R&D
+# Copyright (C) 2007-2022  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
@@ -21,7 +21,7 @@
 
 # http://www-vis.lbl.gov/NERSC/Software/ensight/doc/OnlineHelp/UM-C11.pdf
 import numpy as np
-from MEDLoader import *
+from medcoupling import *
 from CaseIO import CaseIO
 import sys,re,os
 
@@ -56,11 +56,7 @@ class CaseReader(CaseIO):
         cI=DataArrayInt(len(cells)+1) ; cI.iota() ; cI*=nbNodesPerCell+1
         #
         cells2=cells.reshape(len(cells),nbNodesPerCell)
-        if cells2.dtype=='int32':
-            c2=DataArrayInt(cells2)
-        else:
-            c2=DataArrayInt(np.array(cells2,dtype="int32"))
-            pass
+        c2=DataArrayInt(np.array(cells2,dtype="int{}".format(MEDCouplingSizeOfIDs())) )
         c=DataArrayInt(len(cells),nbNodesPerCell+1) ; c[:,0]=ct ; c[:,1:]=c2-1 ; c.rearrange(1)
         m.setConnectivity(c,cI,True)
         m.checkConsistency()