]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Generalize __getitem__ from MEDFileUMesh to MEDFileMesh.
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 20 Jul 2015 14:59:21 +0000 (16:59 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 20 Jul 2015 14:59:21 +0000 (16:59 +0200)
src/MEDLoader/Swig/MEDLoaderCommon.i
src/MEDLoader/Swig/MEDLoaderTest3.py

index 2512825f8e8a427b0b43c2e46c5f772c5f661f38..36fdbadb8028095de3889417ddf1a786d112d79b 100644 (file)
@@ -88,6 +88,7 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileMesh::deepCpy;
 %newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
+%newobject ParaMEDMEM::MEDFileMesh::__getitem__;
 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
@@ -118,7 +119,6 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileUMesh::extractNumberFieldOnGeoType;
 %newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
 %newobject ParaMEDMEM::MEDFileUMesh::buildExtrudedMesh;
-%newobject ParaMEDMEM::MEDFileUMesh::__getitem__;
 %newobject ParaMEDMEM::MEDFileUMesh::linearToQuadratic;
 %newobject ParaMEDMEM::MEDFileUMesh::quadraticToLinear;
 %newobject ParaMEDMEM::MEDFileCMesh::New;
@@ -827,6 +827,11 @@ namespace ParaMEDMEM
            return self->simpleRepr();
          }
 
+         MEDCouplingMesh *__getitem__(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
+         {
+           return self->getGenMeshAtLevel(meshDimRelToMaxExt,false);
+         }
+
          PyObject *getTime() throw(INTERP_KERNEL::Exception)
          {
            int tmp1,tmp2;
@@ -1149,11 +1154,6 @@ namespace ParaMEDMEM
            }
          }
 
-         MEDCouplingUMesh *__getitem__(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
-         {
-           return self->getMeshAtLevel(meshDimRelToMaxExt,false);
-         }
-
          void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh) throw(INTERP_KERNEL::Exception)
          {
            if(!mesh)
index bb5ec84d4312db52600e4630feca9335a8c82afc..58bab804acd33aa35bee307bfccb05c4d75baee0 100644 (file)
@@ -333,6 +333,8 @@ class MEDLoaderTest(unittest.TestCase):
         da.setInfoOnComponent(0,"ZZ [um]")
         m1.setCoordsAt(2,da)
         m.setMesh(m1)
+        self.assertTrue(m[0].isEqual(m1,1e-12))
+        self.assertTrue(isinstance(m[0],MEDCouplingCMesh))
         m.setName("myFirstCartMesh")
         m.setDescription("mmmmpppppppp")
         m.setTimeValue(2.3)