From 3659aea2a7846d1522f1b1497c2d472e427df306 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 20 Jan 2017 13:07:32 +0100 Subject: [PATCH] Connect by default read of struct elements in MEDFileData constructor --- src/MEDLoader/MEDFileData.cxx | 2 +- src/MEDLoader/MEDFileField.cxx | 11 +++++++---- src/MEDLoader/MEDFileField.hxx | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/MEDLoader/MEDFileData.cxx b/src/MEDLoader/MEDFileData.cxx index 2a722d0d6..945708556 100644 --- a/src/MEDLoader/MEDFileData.cxx +++ b/src/MEDLoader/MEDFileData.cxx @@ -309,7 +309,7 @@ try readHeader(fid); _mesh_supports=MEDFileMeshSupports::New(fid); _struct_elems=MEDFileStructureElements::New(fid,_mesh_supports); - _fields=MEDFileFields::New(fid); + _fields=MEDFileFields::NewWithDynGT(fid,_struct_elems,true); _meshes=MEDFileMeshes::New(fid); _params=MEDFileParameters::New(fid); } diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 240cab8e9..9c6b5d731 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -2674,8 +2674,7 @@ MFFPMIter *MFFPMIter::NewCell(const MEDFileEntities *entities) } return new MFFPMIter2(tmp); } - else - throw INTERP_KERNEL::Exception("MFFPMIter::NewCell : not recognized type !"); + return new MFFPMIterSimple;// for MEDFileAllStaticEntites and MEDFileAllStaticEntitiesPlusDyn cells are in } } @@ -2694,8 +2693,7 @@ bool MFFPMIter::IsPresenceOfNode(const MEDFileEntities *entities) return true; return false; } - else - throw INTERP_KERNEL::Exception("MFFPMIter::IsPresenceOfNode : not recognized type !"); + return true;// for MEDFileAllStaticEntites and MEDFileAllStaticEntitiesPlusDyn nodes are in } } @@ -10146,6 +10144,11 @@ MEDFileFields *MEDFileFields::New(const std::string& fileName, bool loadAll) MEDFileFields *MEDFileFields::NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll) { MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName)); + return NewWithDynGT(fid,se,loadAll); +} + +MEDFileFields *MEDFileFields::NewWithDynGT(med_idt fid, const MEDFileStructureElements *se, bool loadAll) +{ if(!se) throw INTERP_KERNEL::Exception("MEDFileFields::NewWithDynGT : null struct element pointer !"); INTERP_KERNEL::AutoCppPtr entities(MEDFileEntities::BuildFrom(*se)); diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 81cecdb8c..754a97778 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -1179,8 +1179,9 @@ namespace MEDCoupling public: MEDLOADER_EXPORT static MEDFileFields *New(); MEDLOADER_EXPORT static MEDFileFields *New(const std::string& fileName, bool loadAll=true); - MEDLOADER_EXPORT static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true); MEDLOADER_EXPORT static MEDFileFields *New(med_idt fid, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileFields *NewWithDynGT(med_idt fid, const MEDFileStructureElements *se, bool loadAll=true); MEDLOADER_EXPORT static MEDFileFields *New(DataArrayByte *db) { return BuildFromMemoryChunk(db); } MEDLOADER_EXPORT static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0); MEDLOADER_EXPORT static MEDFileFields *LoadSpecificEntities(const std::string& fileName, const std::vector< std::pair >& entities, bool loadAll=true); -- 2.39.2