]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To split the large Build method into less parts.
authorapo <apo@opencascade.com>
Thu, 11 Aug 2005 06:10:33 +0000 (06:10 +0000)
committerapo <apo@opencascade.com>
Thu, 11 Aug 2005 06:10:33 +0000 (06:10 +0000)
Second step - extraction BuildFieldMap functionality

src/CONVERTOR/VISU_MedConvertor.cxx

index 3bf0b7847c5e42120fde4a020f9feb2fe39f8755..18c1ed16b109f1476b7a81b158f0378e281dc93b 100644 (file)
@@ -512,6 +512,85 @@ namespace
     }
   }
 
+
+  //---------------------------------------------------------------
+  void
+  BuildFieldMap(PMEDMesh theMesh,
+               const MED::TEntityInfo& theEntityInfo,
+               const MED::TMKey2Profile& theMKey2Profile,
+               const MED::TKey2Gauss& theKey2Gauss,
+               MED::PWrapper theMEDWrapper)
+  {
+    TInt aNbFields = theMEDWrapper->GetNbFields(); 
+    MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
+    const std::string& aMeshName = theMesh->myName;
+    INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<<aNbFields<<"\n");
+    for(TInt iField = 1; iField <= aNbFields; iField++){
+      MED::PFieldInfo aFieldInfo = theMEDWrapper->GetPFieldInfo(aMeshInfo,iField);
+      TInt aNbComp = aFieldInfo->GetNbComp();
+      std::string aFieldName = aFieldInfo->GetName();
+      
+      MED::TGeom2Size aGeom2Size;
+      MED::EEntiteMaillage aMEntity;
+      TInt aNbTimeStamps = theMEDWrapper->GetNbTimeStamps(aFieldInfo,
+                                                         theEntityInfo,
+                                                         aMEntity,
+                                                         aGeom2Size);
+      if(aNbTimeStamps < 1)
+       continue;
+      
+      TEntity aVEntity = MEDEntityToVTK(aMEntity);
+      PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
+      TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+      PMEDField aField = aFieldMap[aFieldName](new TMEDField());
+      aField->myId = iField;
+      aField->myNbComp = aNbComp;
+      aField->myEntity = aVEntity;
+      aField->myName = aFieldName;
+      aField->myMeshName = aMeshName;
+      aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
+      aField->myCompNames.resize(aNbComp);
+      aField->myUnitNames.resize(aNbComp);
+      
+      INITMSG(MYDEBUG,"myName = '"<<aField->myName<<"'"<<
+             "; myId = "<<aField->myId<<
+             "; myEntity = "<<aField->myEntity<<
+             "; myDataSize = "<<aField->myDataSize<<
+             "; myNbComp = "<<aField->myNbComp<<"\n");
+      
+      for(TInt iComp = 0; iComp < aNbComp; iComp++){
+       aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
+       aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
+      }
+      
+      for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
+       MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo,
+                                                                             aMEntity,
+                                                                             aGeom2Size,
+                                                                             iTimeStamp);
+       TFloat aDt = aTimeStampInfo->GetDt();
+       std::string anUnitDt = aTimeStampInfo->GetUnitDt();
+       MED::PTimeStampVal aTimeStampVal = theMEDWrapper->GetPTimeStampVal(aTimeStampInfo,
+                                                                          theMKey2Profile,
+                                                                          theKey2Gauss);
+       TValField& aValField = aField->myValField;
+       PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
+       aValForTime->myId = iTimeStamp;
+       aValForTime->myFieldName = aField->myName;
+       aValForTime->myEntity = aField->myEntity;
+       aValForTime->myMeshName = aField->myMeshName;
+       aValForTime->myNbGauss = aTimeStampInfo->GetNbGauss();
+       aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
+       INITMSG(MYDEBUG,"aDt = '"<<aDt<<", "<<anUnitDt<<"'\n");
+       
+       InitGaussProfile(aTimeStampVal,
+                        aMeshOnEntity,
+                        aGeom2Size,
+                        aValForTime);
+      }
+    }
+  }
+
 }
 
 
@@ -584,74 +663,11 @@ VISU_MedConvertor
                           aNodeInfo,
                           aMed);
       
-      TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
-
-      TInt aNbFields = aMed->GetNbFields(); 
-      BEGMSG(MYDEBUG,"TField: aNbFields = "<<aNbFields<<"\n");
-      for(TInt iField = 1; iField <= aNbFields; iField++){
-       MED::PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
-       TInt aNbComp = aFieldInfo->GetNbComp();
-       const std::string& aFieldName = aFieldInfo->GetName();
-       
-       MED::TGeom2Size aGeom2Size;
-       MED::EEntiteMaillage aMEntity;
-       TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,
-                                                  aEntityInfo,
-                                                  aMEntity,
-                                                  aGeom2Size);
-       if(aNbTimeStamps < 1)
-         continue;
-       
-       TEntity aVEntity = MEDEntityToVTK(aMEntity);
-       PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
-       TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
-       PMEDField aField = aFieldMap[aFieldName](new TMEDField());
-       aField->myId = iField;
-       aField->myNbComp = aNbComp;
-       aField->myEntity = aVEntity;
-       aField->myName = aFieldName;
-       aField->myMeshName = aMeshName;
-       aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
-       aField->myCompNames.resize(aNbComp);
-       aField->myUnitNames.resize(aNbComp);
-       
-       INITMSG(MYDEBUG,"myName = '"<<aField->myName<<
-               "'; myId = "<<aField->myId<<
-               "; myEntity = "<<aField->myEntity<<
-               "; myDataSize = "<<aField->myDataSize<<
-               "; myNbComp = "<<aField->myNbComp<<"\n");
-       
-       for(TInt iComp = 0; iComp < aNbComp; iComp++){
-         aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
-         aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
-       }
-       
-       for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
-         MED::PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo,
-                                                                      aMEntity,
-                                                                      aGeom2Size,
-                                                                      iTimeStamp);
-         TFloat aDt = aTimeStampInfo->GetDt();
-         const std::string& anUnitDt = aTimeStampInfo->GetUnitDt();
-         MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo,
-                                                                   aMKey2Profile,
-                                                                   aKey2Gauss);
-         TValField& aValField = aField->myValField;
-         PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
-         aValForTime->myId = iTimeStamp;
-         aValForTime->myFieldName = aField->myName;
-         aValForTime->myEntity = aField->myEntity;
-         aValForTime->myMeshName = aField->myMeshName;
-         aValForTime->myNbGauss = aTimeStampInfo->GetNbGauss();
-         aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
-         INITMSG(MYDEBUG,"aDt = '"<<aDt<<", "<<anUnitDt<<"'\n");
-
-         InitGaussProfile(aTimeStampVal,
-                          aMeshOnEntity,
-                          aGeom2Size,
-                          aValForTime);
-       }
-      }
+      BuildFieldMap(aMesh,
+                   aEntityInfo,
+                   aMKey2Profile,
+                   aKey2Gauss,
+                   aMed);
 
 #ifndef _LOAD_FAMILIES_
       continue;