From 6554a43753cad1b77922520ace03ef6e08ecb068 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 9 Oct 2018 17:00:57 +0200 Subject: [PATCH] First draft --- src/MEDLoader/MEDFileField1TS.cxx | 4 +-- src/MEDLoader/MEDFileFieldMultiTS.cxx | 37 ++++++++++++++++++--------- src/MEDLoader/MEDFileJoint.cxx | 6 ++--- src/MEDLoader/MEDFileJoint.hxx | 2 +- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/src/MEDLoader/MEDFileField1TS.cxx b/src/MEDLoader/MEDFileField1TS.cxx index f317f381b..c174e7a78 100644 --- a/src/MEDLoader/MEDFileField1TS.cxx +++ b/src/MEDLoader/MEDFileField1TS.cxx @@ -752,8 +752,8 @@ void MEDFileAnyTypeField1TSWithoutSDA::loadOnlyStructureOfDataRecursively(med_id } // _field_per_mesh[0]=MEDFileFieldPerMesh::NewOnRead(fid,this,0,meshnumdt,meshnumit,nasc,mm,entities); - _nb_of_tuples_to_be_allocated=0; - _field_per_mesh[0]->loadOnlyStructureOfDataRecursively(fid,_nb_of_tuples_to_be_allocated,nasc); + //_nb_of_tuples_to_be_allocated=0; + //_field_per_mesh[0]->loadOnlyStructureOfDataRecursively(fid,_nb_of_tuples_to_be_allocated,nasc); } void MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) diff --git a/src/MEDLoader/MEDFileFieldMultiTS.cxx b/src/MEDLoader/MEDFileFieldMultiTS.cxx index 7c3ba4d51..7becb451d 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.cxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.cxx @@ -486,16 +486,29 @@ 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); - int nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_NUMDT,MED_ALL_NUMDT)); - INTERP_KERNEL::AutoPtr types(new med_entity_type[nentitype]); - med_int usedbyncs; - MEDFILESAFECALLERRD0(MEDfieldEntityType,(fid,_name.c_str(),MED_ALL_NUMDT,MED_ALL_NUMDT,types,&usedbyncs)); - for(int i=0;i geotypes(new med_geometry_type[ngeotype]); - med_int geousedbyncs; - MEDFILESAFECALLERRD0(MEDfieldGeotype,(fid,_name.c_str(),MED_ALL_NUMDT,MED_ALL_NUMDT,types[i],geotypes,&geousedbyncs)); + INTERP_KERNEL::AutoCppPtr entitiesFast; + const MEDFileEntities *entitiesForSubInstances(entities); + if(!entities) + { + int nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_NUMDT,MED_ALL_NUMDT)); + INTERP_KERNEL::AutoPtr types(new med_entity_type[nentitype]); + med_int usedbyncs; + MEDFILESAFECALLERRD0(MEDfieldEntityType,(fid,_name.c_str(),MED_ALL_NUMDT,MED_ALL_NUMDT,types,&usedbyncs)); + std::vector< std::pair > entitiesFastP; + for(int i=0;i geotypes(new med_geometry_type[ngeotype]); + med_int geousedbyncs; + MEDFILESAFECALLERRD0(MEDfieldGeotype,(fid,_name.c_str(),MED_ALL_NUMDT,MED_ALL_NUMDT,types[i],geotypes,&geousedbyncs)); + for(int j=0;j p(MEDFileMesh::ConvertFromMEDFileEntity(types[i]),MEDFileJointOneStep::ConvertGeometryType(geotypes[j])); + entitiesFastP.push_back(p); + } + } + entitiesFast=new MEDFileStaticEntities(entitiesFastP); + entitiesForSubInstances=entitiesFast; } for(int i=0;iloadStructureAndBigArraysRecursively(fid,*this,ms,entities); + _time_steps[i]->loadStructureAndBigArraysRecursively(fid,*this,ms,entitiesForSubInstances); else - _time_steps[i]->loadOnlyStructureOfDataRecursively(fid,*this,ms,entities); + _time_steps[i]->loadOnlyStructureOfDataRecursively(fid,*this,ms,entitiesForSubInstances); synchronizeNameScope(); } } diff --git a/src/MEDLoader/MEDFileJoint.cxx b/src/MEDLoader/MEDFileJoint.cxx index 35b356d09..cc8052f07 100644 --- a/src/MEDLoader/MEDFileJoint.cxx +++ b/src/MEDLoader/MEDFileJoint.cxx @@ -281,8 +281,8 @@ MEDFileJointOneStep::MEDFileJointOneStep(med_idt fid, const std::string& mName, loc_geo_type, rem_ent_type, rem_geo_type, correspondence->getPointer())); MEDFileJointCorrespondence *cor=MEDFileJointCorrespondence::New(); cor->setIsNodal( loc_ent_type == MED_NODE ); - cor->setLocalGeometryType ( convertGeometryType( loc_geo_type )); - cor->setRemoteGeometryType( convertGeometryType( rem_geo_type )); + cor->setLocalGeometryType ( ConvertGeometryType( loc_geo_type )); + cor->setRemoteGeometryType( ConvertGeometryType( rem_geo_type )); cor->setCorrespondence( correspondence ); _correspondences.push_back(cor); } @@ -411,7 +411,7 @@ std::string MEDFileJointOneStep::simpleRepr() const return oss.str(); } -INTERP_KERNEL::NormalizedCellType MEDFileJointOneStep::convertGeometryType(med_geometry_type geotype) +INTERP_KERNEL::NormalizedCellType MEDFileJointOneStep::ConvertGeometryType(med_geometry_type geotype) { INTERP_KERNEL::NormalizedCellType result=INTERP_KERNEL::NORM_ERROR; for(int i=0; i