]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Addition of MEDFileUMesh.__setitem__ in python bindings.
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 13 Apr 2015 09:16:40 +0000 (11:16 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 13 Apr 2015 09:16:40 +0000 (11:16 +0200)
src/MEDLoader/Swig/MEDLoaderCommon.i
src/MEDLoader/Swig/MEDLoaderTest3.py

index f9143b5a8d3efb8d93f9ffb5b45b6f32cd145578..bf383c64297d6bf90d987bf83f927fc63cbc3cf7 100644 (file)
@@ -906,6 +906,25 @@ namespace ParaMEDMEM
            return self->getMeshAtLevel(meshDimRelToMaxExt,false);
          }
 
+         void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh) throw(INTERP_KERNEL::Exception)
+         {
+           if(!mesh)
+             throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Input mesh is NULL !");
+           MEDCouplingUMesh *m0(dynamic_cast<MEDCouplingUMesh *>(mesh));
+           if(m0)
+             {
+               self->setMeshAtLevel(meshDimRelToMax,m0,false);
+               return ;
+             }
+           MEDCoupling1GTUMesh *m1(dynamic_cast<MEDCoupling1GTUMesh *>(mesh));
+           if(m1)
+             {
+               self->setMeshAtLevel(meshDimRelToMax,m1);
+               return ;
+             }
+           throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
+         }
+
          void setMeshes(PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
          {
            std::vector<const MEDCouplingUMesh *> ms;
index c4bfe888dd49d41b2ed0995be0289f366f730081..c91562c626a22e695c95503125e59a95c6dae15c 100644 (file)
@@ -3986,10 +3986,10 @@ class MEDLoaderTest(unittest.TestCase):
         mm.setName("MyFirstMEDCouplingMEDmesh")
         mm.setDescription("IHopeToConvinceLastMEDMEMUsers")
         mm.setCoords(c)
-        mm.setMeshAtLevel(-1,m1);
-        mm.setMeshAtLevel(0,m);
+        mm[-1]=m1;
+        mm[0]=m;
         mm.setRenumFieldArr(0,DataArrayInt([32,41,50,56,7]))
-        mm.setMeshAtLevel(-2,m2);
+        mm[-2]=m2;
         mm.setRenumFieldArr(-2,DataArrayInt([102,52,45,63]))
         # playing with groups
         g1_2=DataArrayInt.New()