]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
WIP
authorAnthony Geay <anthony.geay@edf.fr>
Wed, 4 Mar 2020 17:00:25 +0000 (18:00 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Wed, 4 Mar 2020 17:00:25 +0000 (18:00 +0100)
src/MEDLoader/MEDFileField1TS.cxx
src/MEDLoader/MEDFileFieldMultiTS.cxx
src/MEDLoader/MEDFileMesh.cxx
src/MEDLoader/MEDLoader.cxx

index dc51ad550b7c9f69bd5986e6e359aff383cfc308..1e4e091cae814db7429af8cb166010b4d91a4b38 100644 (file)
@@ -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<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));
+    }*/
+  /*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);
index 3f19a60c9abcf960c1c3c6947e952040fbdfbc8d..a1449764289133e0c4ad288ce6306916b2714374 100644 (file)
@@ -42,6 +42,8 @@ template class MEDCoupling::MEDFileTemplateFieldMultiTS<double>;
 template class MEDCoupling::MEDFileNDTemplateFieldMultiTS<int>;
 template class MEDCoupling::MEDFileNDTemplateFieldMultiTS<float>;
 
+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<MEDFileEntities> 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<med_entity_type> 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<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesFastP;
+      for(int i=0;i<nentitype;i++)
+        {
+          int ngeotype(MEDfieldnGeometryType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types[i]));
+          INTERP_KERNEL::AutoPtr<med_geometry_type> 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<ngeotype;j++)
+            {
+              std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> p(MEDFileMesh::ConvertFromMEDFileEntity(types[i]),ConvertGeometryType(geotypes[j]));
+              entitiesFastP.push_back(p);
+            }
+        }
+      entitiesFast=new MEDFileStaticEntities(entitiesFastP);
+      entitiesForSubInstances=entitiesFast;
+    }
   for(int i=0;i<nbPdt;i++)
     {
       std::vector< std::pair<int,int> > 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();
     }
 }
 
index b74224efbbad74f6a07f1a98d3301ff4445e04b2..f1dd3771c71f0a4ecffbfd9cda2906e38348f547 100644 (file)
@@ -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());
       }
     }
index 597b25fc14396a1b8500e95bd4966a08aab57ee7..7f1a4d3a3d37785bc98356617f351b4451ef289b 100644 (file)
@@ -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<MED_N_CELL_FIXED_GEO; i++)
+    {
+      if (typmai[i]==geotype)
+        {
+          result=typmai2[i];
+          break;
+        }
+    }
+  return result;
+}
+
 /*!
  * This method returns a first quick overview of mesh with name \a meshName into the file \a fileName.
  * @param possibilities the relativeToMeshDim authorized to returned maxdim. This vector is systematically cleared at the begin of this method.