From: Anthony Geay Date: Fri, 20 Jan 2017 12:07:32 +0000 (+0100) Subject: Connect by default read of struct elements in MEDFileData constructor X-Git-Tag: V8_3_0a2~38^2~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3659aea2a7846d1522f1b1497c2d472e427df306;p=tools%2Fmedcoupling.git Connect by default read of struct elements in MEDFileData constructor --- 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);