From 50bd49fe5abc534dcd18226b6891178acb145f74 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Wed, 4 Mar 2020 18:00:25 +0100 Subject: [PATCH] WIP --- src/MEDLoader/MEDFileField1TS.cxx | 8 +++---- src/MEDLoader/MEDFileFieldMultiTS.cxx | 33 ++++++++++++++++++++++++--- src/MEDLoader/MEDFileMesh.cxx | 4 +++- src/MEDLoader/MEDLoader.cxx | 14 ++++++++++++ 4 files changed, 51 insertions(+), 8 deletions(-) diff --git a/src/MEDLoader/MEDFileField1TS.cxx b/src/MEDLoader/MEDFileField1TS.cxx index dc51ad550..1e4e091ca 100644 --- a/src/MEDLoader/MEDFileField1TS.cxx +++ b/src/MEDLoader/MEDFileField1TS.cxx @@ -745,15 +745,15 @@ void MEDFileAnyTypeField1TSWithoutSDA::loadOnlyStructureOfDataRecursively(med_id med_float dt; med_int meshnumdt,meshnumit; MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&_dt)); - { + /*{ med_bool localMesh; med_int nmesh; INTERP_KERNEL::AutoPtr 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)); + }*/ + /*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); diff --git a/src/MEDLoader/MEDFileFieldMultiTS.cxx b/src/MEDLoader/MEDFileFieldMultiTS.cxx index 3f19a60c9..a14497642 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.cxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.cxx @@ -42,6 +42,8 @@ template class MEDCoupling::MEDFileTemplateFieldMultiTS; template class MEDCoupling::MEDFileNDTemplateFieldMultiTS; template class MEDCoupling::MEDFileNDTemplateFieldMultiTS; +extern INTERP_KERNEL::NormalizedCellType ConvertGeometryType(med_geometry_type geotype); + //= MEDFileAnyTypeFieldMultiTSWithoutSDA MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA() @@ -484,6 +486,31 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope() void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) { _time_steps.resize(nbPdt); + // + INTERP_KERNEL::AutoCppPtr entitiesFast; + const MEDFileEntities *entitiesForSubInstances(entities); + if(!entities) + {// no entities + int nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT)); + INTERP_KERNEL::AutoPtr types(new med_entity_type[nentitype]); + med_int usedbyncs; + MEDFILESAFECALLERRD0(MEDfieldEntityType,(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types,&usedbyncs)); + std::vector< std::pair > entitiesFastP; + for(int i=0;i geotypes(new med_geometry_type[ngeotype]); + med_int geousedbyncs; + MEDFILESAFECALLERRD0(MEDfieldGeometryType,(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types[i],geotypes,&geousedbyncs)); + for(int j=0;j p(MEDFileMesh::ConvertFromMEDFileEntity(types[i]),ConvertGeometryType(geotypes[j])); + entitiesFastP.push_back(p); + } + } + entitiesFast=new MEDFileStaticEntities(entitiesFastP); + entitiesForSubInstances=entitiesFast; + } for(int i=0;i > ts; @@ -519,10 +546,10 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysR throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively : managed field type are : FLOAT64, INT32, FLOAT32 !"); } if(loadAll) - _time_steps[i]->loadStructureAndBigArraysRecursively(fid,*this,ms,entities); + _time_steps[i]->loadStructureAndBigArraysRecursively(fid,*this,ms,entitiesForSubInstances); else - _time_steps[i]->loadOnlyStructureOfDataRecursively(fid,*this,ms,entities); - synchronizeNameScope(); + _time_steps[i]->loadOnlyStructureOfDataRecursively(fid,*this,ms,entitiesForSubInstances); + //synchronizeNameScope(); } } diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index b74224efb..f1dd3771c 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -7763,9 +7763,11 @@ TypeOfField MEDFileMesh::ConvertFromMEDFileEntity(med_entity_type etype) return ON_NODES; case MED_CELL: return ON_CELLS; + case MED_NODE_ELEMENT: + return ON_GAUSS_NE; default: { - std::ostringstream oss; oss << "EDFileMesh::ConvertFromMEDFileEntity : not recognized entity " << etype << " !"; + std::ostringstream oss; oss << "MEDFileMesh::ConvertFromMEDFileEntity : not recognized entity " << etype << " !"; throw INTERP_KERNEL::Exception(oss.str()); } } diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index 597b25fc1..7f1a4d3a3 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -146,6 +146,20 @@ using namespace MEDCoupling; /// @cond INTERNAL +INTERP_KERNEL::NormalizedCellType ConvertGeometryType(med_geometry_type geotype) +{ + INTERP_KERNEL::NormalizedCellType result=INTERP_KERNEL::NORM_ERROR; + for(int i=0; i