From: geay Date: Mon, 17 Feb 2014 09:24:17 +0000 (+0100) Subject: Feedback from Patrick : lack of geo types in new MEDReader X-Git-Tag: V7_3_1b1^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a6b9ede9bc497fc61446e5e499010713b2590913;p=tools%2Fmedcoupling.git Feedback from Patrick : lack of geo types in new MEDReader --- diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index 0412026a3..4358d7305 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -340,6 +340,11 @@ void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isW } } +std::vector< INTERP_KERNEL::NormalizedCellType > MEDMeshMultiLev::getGeoTypes() const +{ + return _geo_types; +} + void MEDMeshMultiLev::setFamilyIdsOnCells(DataArrayInt *famIds, bool isNoCopy) { _cell_fam_ids=famIds; diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index 4e5167da9..ff683a84e 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -85,6 +85,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const; MEDLOADER_EXPORT void retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isWithoutCopy) const; MEDLOADER_EXPORT void retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isWithoutCopy) const; + MEDLOADER_EXPORT std::vector< INTERP_KERNEL::NormalizedCellType > getGeoTypes() const; void setFamilyIdsOnCells(DataArrayInt *famIds, bool isNoCopy); void setNumberIdsOnCells(DataArrayInt *numIds, bool isNoCopy); void setFamilyIdsOnNodes(DataArrayInt *famIds, bool isNoCopy); diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index a4a759344..78b8243a0 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -2925,6 +2925,16 @@ namespace ParaMEDMEM PyTuple_SetItem(ret,1,ret1Py); return ret; } + + PyObject *getGeoTypes() const throw(INTERP_KERNEL::Exception) + { + std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes()); + std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin()); + PyObject *res(PyList_New(result.size())); + for(int i=0;iL!=result.end(); i++, iL++) + PyList_SetItem(res,i,PyInt_FromLong(*iL)); + return res; + } } }; diff --git a/src/MEDLoader/Swig/MEDLoaderTest4.py b/src/MEDLoader/Swig/MEDLoaderTest4.py index 88d57ede5..dd5975fb8 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest4.py +++ b/src/MEDLoader/Swig/MEDLoaderTest4.py @@ -3787,6 +3787,7 @@ class MEDLoaderTest4(unittest.TestCase): mml=fcscp.buildFromScratchDataSetSupport(0,fields) mml2=mml.prepare() self.assertTrue(isinstance(mml2,MEDUMeshMultiLev)) + self.assertEqual([3,4,0],mml2.getGeoTypes()) ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays() self.assertTrue(not ncc) self.assertTrue(a0.isEqual(DataArrayDouble([0.,1.,0.,1.,1.,0.,2.,1.,0.,0.,2.,0.,1.,2.,0.,0.,3.,0.],6,3),1e-12))