throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::allocIfNecessaryTheArrayToReceiveDataFromFile : internal error !");
}
-void MEDFileAnyTypeField1TSWithoutSDA::loadOnlyStructureOfDataRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities)
+void MEDFileAnyTypeField1TSWithoutSDA::loadOnlyStructureOfDataRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities, const MEDFileCapability *capability)
{
med_int numdt,numit;
med_float dt;
- med_int meshnumdt,meshnumit;
+ med_int meshnumdt(-1),meshnumit(-1);
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&_dt));
- /*{
+ if(!capability || !capability->isFastReader())
+ {
med_bool localMesh;
med_int nmesh;
INTERP_KERNEL::AutoPtr<char> meshName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
MEDFILESAFECALLERRD0(MEDfield23ComputingStepMeshInfo,(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&dt,&nmesh,meshName,&localMesh,&meshnumdt,&meshnumit)); // to check with Adrien for legacy MED files
- }*/
- /*MEDFILESAFECALLERRD0(MEDfieldComputingStepMeshInfo,(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&_dt,&meshnumdt,&meshnumit));
+ }
if(_iteration!=numdt || _order!=numit)
- throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively : unexpected exception internal error !");*/
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively : unexpected exception internal error !");
_field_per_mesh.resize(1);
//
MEDFileMesh *mm(0);
public:
MEDLOADER_EXPORT void allocNotFromFile(mcIdType newNbOfTuples);
MEDLOADER_EXPORT bool allocIfNecessaryTheArrayToReceiveDataFromFile();
- MEDLOADER_EXPORT void loadOnlyStructureOfDataRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities);
+ MEDLOADER_EXPORT void loadOnlyStructureOfDataRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities, const MEDFileCapability *capability = nullptr);
MEDLOADER_EXPORT void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
MEDLOADER_EXPORT void loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc);
MEDLOADER_EXPORT void loadStructureAndBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities);
//
INTERP_KERNEL::AutoCppPtr<MEDFileEntities> entitiesFast;
const MEDFileEntities *entitiesForSubInstances(entities);
- if(!entities)
+ MEDFileCapability mfcap(fid);
+ if(!entities && mfcap.isFastReader())
{// no entities
int nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT));
INTERP_KERNEL::AutoPtr<med_entity_type> types(new med_entity_type[nentitype]);
if(loadAll)
_time_steps[i]->loadStructureAndBigArraysRecursively(fid,*this,ms,entitiesForSubInstances);
else
- _time_steps[i]->loadOnlyStructureOfDataRecursively(fid,*this,ms,entitiesForSubInstances);
- //synchronizeNameScope();
+ _time_steps[i]->loadOnlyStructureOfDataRecursively(fid,*this,ms,entitiesForSubInstances,&mfcap);
}
+ synchronizeNameScope();
}
void MEDFileAnyTypeFieldMultiTSWithoutSDA::writeLL(med_idt fid, const MEDFileWritable& opts) const
std::ostringstream oss; oss << DFT_FILENAME_IN_MEM << "_" << ii++;
return oss.str();
}
+
+MEDCoupling::MEDFileCapability::MEDFileCapability(med_idt fid)
+{
+ MEDFILESAFECALLERRD0(MEDfileNumVersionRd,(fid,&_maj,&_min,&_rel));
+}
static T *BuildFromMemoryChunk(DataArrayByte *db);
};
+ class MEDFileCapability
+ {
+ public:
+ MEDFileCapability(med_idt fid);
+ bool isFastReader() const { return _maj>=4 && _min >=1; }
+ private:
+ med_int _maj;
+ med_int _min;
+ med_int _rel;
+ };
MEDFileUtilities::AutoFid OpenMEDFileForRead(const std::string& fileName);
}