]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
First draft
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 9 Oct 2018 15:00:57 +0000 (17:00 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 9 Oct 2018 15:00:57 +0000 (17:00 +0200)
src/MEDLoader/MEDFileField1TS.cxx
src/MEDLoader/MEDFileFieldMultiTS.cxx
src/MEDLoader/MEDFileJoint.cxx
src/MEDLoader/MEDFileJoint.hxx

index f317f381bd866e2f2a5fca85416da83ac84d91d0..c174e7a78f4f84c9ca96ae7d98bde79617f83051 100644 (file)
@@ -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)
index 7c3ba4d514acdffe58b08fbe82de27f9ad6ecfa5..7becb451dfbfaad47d1c0149357e100a2184f384 100644 (file)
@@ -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<med_entity_type> 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<nentitype;i++)
-    {
-      int ngeotype(MEDfieldnGeotype(fid,_name.c_str(),MED_ALL_NUMDT,MED_ALL_NUMDT,types[i]));
-      INTERP_KERNEL::AutoPtr<med_geometry_type> 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<MEDFileEntities> entitiesFast;
+  const MEDFileEntities *entitiesForSubInstances(entities);
+  if(!entities)
+    {
+      int nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_NUMDT,MED_ALL_NUMDT));
+      INTERP_KERNEL::AutoPtr<med_entity_type> 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<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesFastP;
+      for(int i=0;i<nentitype;i++)
+        {
+          int ngeotype(MEDfieldnGeotype(fid,_name.c_str(),MED_ALL_NUMDT,MED_ALL_NUMDT,types[i]));
+          INTERP_KERNEL::AutoPtr<med_geometry_type> 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<ngeotype;j++)
+            {
+              std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> p(MEDFileMesh::ConvertFromMEDFileEntity(types[i]),MEDFileJointOneStep::ConvertGeometryType(geotypes[j]));
+              entitiesFastP.push_back(p);
+            }
+        }
+      entitiesFast=new MEDFileStaticEntities(entitiesFastP);
+      entitiesForSubInstances=entitiesFast;
     }
   for(int i=0;i<nbPdt;i++)
     {
@@ -532,9 +545,9 @@ 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);
+        _time_steps[i]->loadOnlyStructureOfDataRecursively(fid,*this,ms,entitiesForSubInstances);
       synchronizeNameScope();
     }
 }
index 35b356d0901551a89b8d3108ec213968854ef37f..cc8052f071c3ab97cd3e1bc7d047f7c31f426db5 100644 (file)
@@ -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<MED_N_CELL_FIXED_GEO; i++)
index 0606f3c17673128c0b26ce2256e9d24d888486a1..9bb11cb843c4426f83b519d8f4fc860c93f4ba58 100644 (file)
@@ -99,10 +99,10 @@ public:
 
   MEDLOADER_EXPORT std::string simpleRepr() const;
   MEDLOADER_EXPORT void writeLL(med_idt fid, const std::string& localMeshName, const std::string& jointName) const;
+  MEDLOADER_EXPORT static INTERP_KERNEL::NormalizedCellType ConvertGeometryType(med_geometry_type geotype);
 private:
   MEDFileJointOneStep();
   MEDFileJointOneStep(med_idt fid, const std::string& mName, const std::string& jointName, int number);
-  MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType convertGeometryType(med_geometry_type geotype);
 protected:
   int _order;
   int _iteration;