From: Anthony Geay Date: Mon, 20 Jul 2015 14:59:21 +0000 (+0200) Subject: Generalize __getitem__ from MEDFileUMesh to MEDFileMesh. X-Git-Tag: V7_7_0a1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f28af7e142f57c2e1b9c707b956ed87d8c8cac1d;p=modules%2Fmed.git Generalize __getitem__ from MEDFileUMesh to MEDFileMesh. --- diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 2512825f8..36fdbadb8 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -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) diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index bb5ec84d4..58bab804a 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -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)