]> 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:44:18 +0000 (06:44 +0000)
committerapo <apo@opencascade.com>
Thu, 11 Aug 2005 06:44:18 +0000 (06:44 +0000)
Third step - extraction BuildFamilyMap functionality

src/CONVERTOR/VISU_MedConvertor.cxx

index 18c1ed16b109f1476b7a81b158f0378e281dc93b..5f579fecaa4bbdeeb268a5006ce496dc0f5fac36 100644 (file)
@@ -591,6 +591,83 @@ namespace
     }
   }
 
+
+  //---------------------------------------------------------------
+  void
+  BuildFamilyMap(PMEDMesh theMesh,
+                const TFamilyCounterMap& theFamilyNbCellsCounterMap,
+                const TFamilyCounterMap& theFamilyCellsSizeCounterMap,
+                const MED::TEntityInfo& theEntityInfo,
+                const MED::TElemGroup& theElemGroup,
+                const MED::TFamilyGroup& theFamilyGroup,
+                MED::PWrapper theMEDWrapper)
+  {
+    MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
+    MED::TFamilyByEntity aFamilyByEntity = MED::GetFamiliesByEntity(theMEDWrapper,theElemGroup,theFamilyGroup);
+    MED::TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin();
+    INITMSG(MY_FAMILY_DEBUG,"BuildFamilyMap:\n");
+    for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){
+      const MED::EEntiteMaillage& aMEntity = aFamilyByEntityIter->first;
+      const MED::TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
+      
+      TEntity aVEntity = MEDEntityToVTK(aMEntity);
+      PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
+      TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+       
+      if(aFamilyGroup.empty())
+       continue;
+       
+      INITMSG(MY_FAMILY_DEBUG,
+             "- aMEntity = "<<aMEntity<<
+             "; aVEntity = "<<aVEntity<<
+             endl);
+
+      MED::TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
+      for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
+       const MED::PFamilyInfo& aFamilyInfo = *aFamilyGroupIter;
+       if (aFamilyInfo->GetId() == 0) 
+         continue;
+       
+       TInt anId = aFamilyInfo->GetId();
+       std::string aFamilyName = aFamilyInfo->GetName();
+       PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
+
+       aFamily->myId = anId;
+       aFamily->myName = aFamilyInfo->GetName();
+       aFamily->myEntity = aVEntity;
+       {       
+         aFamily->myNbCells = 0;
+         TFamilyCounterMap::const_iterator anIter = theFamilyNbCellsCounterMap.find(anId);
+         if(anIter != theFamilyNbCellsCounterMap.end())
+           aFamily->myNbCells = anIter->second;
+       }
+       {       
+         aFamily->myCellsSize = 0;
+         TFamilyCounterMap::const_iterator anIter = theFamilyCellsSizeCounterMap.find(anId);
+         if(anIter != theFamilyCellsSizeCounterMap.end())
+           aFamily->myCellsSize = anIter->second;
+       }
+       
+       INITMSG(MY_FAMILY_DEBUG,
+               "- aFamilyName = '"<<aFamily->myName<<"'"<<
+               "; myId = "<<aFamily->myId<<"; "<<
+               "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
+               "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
+               "; myEntity = "<<aFamily->myEntity<<
+               "; myNbCells = "<<aFamily->myNbCells<<
+               "; myCellsSize = "<<aFamily->myCellsSize<<
+               endl);
+       
+       VISU::TBindGroups& aBindGroups = aFamily->myGroups;
+       const TInt aNbGroup = aFamilyInfo->GetNbGroup();
+       for(TInt i = 0; i < aNbGroup; i++){
+         std::string aGroupName = aFamilyInfo->GetGroupName(i);
+         aBindGroups.insert(aGroupName);
+         INITMSG(MY_FAMILY_DEBUG,"- aGroupName = '"<<aGroupName<<"'\n");
+       }
+      }
+    }
+  }
 }
 
 
@@ -636,7 +713,7 @@ VISU_MedConvertor
       
       MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
       
-      MED::TElemGroup aElemGroup = MED::GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
+      MED::TElemGroup anElemGroup = MED::GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
       
       // creating TMesh structure and TMeshOnEntityMap     
       TInt aDim = aMeshInfo->GetDim();
@@ -674,54 +751,15 @@ VISU_MedConvertor
 #endif
 
       MED::TFamilyGroup aFamilyGroup = MED::GetFamilies(aMed,aMeshInfo);
-      MED::TFamilyByEntity aFamilyByEntity = MED::GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup);
-      MED::TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin();
-      BEGMSG(MY_FAMILY_DEBUG,"TFamilyByEntity:\n");
-      for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){
-       const MED::EEntiteMaillage& aMEntity = aFamilyByEntityIter->first;
-       const MED::TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
-       
-       TEntity aVEntity = MEDEntityToVTK(aMEntity);
-       PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
-       TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
-       
-       if(aFamilyGroup.empty())
-         continue;
-       
-       INITMSG(MY_FAMILY_DEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
-       MED::TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
-       for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
-         const MED::PFamilyInfo& aFamilyInfo = *aFamilyGroupIter;
-         if (aFamilyInfo->GetId() == 0) 
-           continue;
-         
-         const std::string& aFamilyName = aFamilyInfo->GetName();
-         PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
-         
-         aFamily->myId = aFamilyInfo->GetId();
-         aFamily->myName = aFamilyInfo->GetName();
-         aFamily->myEntity = aVEntity;
-         aFamily->myNbCells = aFamilyNbCellsCounterMap[aFamily->myId];
-         aFamily->myCellsSize = aFamilyCellsSizeCounterMap[aFamily->myId];
-         
-         INITMSG(MY_FAMILY_DEBUG,"aFamilyName = '"<<aFamily->myName<<
-                 "'; myId = "<<aFamily->myId<<"; "<<
-                 "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
-                 "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
-                 "; myEntity = "<<aFamily->myEntity<<
-                 "; myNbCells = "<<aFamily->myNbCells<<
-                 "; myCellsSize = "<<aFamily->myCellsSize<<"\n");
-         
-         VISU::TBindGroups& aBindGroups = aFamily->myGroups;
-         const TInt aNbGroup = aFamilyInfo->GetNbGroup();
-         for(TInt i = 0; i < aNbGroup; i++){
-           const string& aGroupName = aFamilyInfo->GetGroupName(i);
-           aBindGroups.insert(aGroupName);
-           INITMSG(MY_FAMILY_DEBUG,"aGroupName = '"<<aGroupName<<"'\n");
-         }
-       }
-      }
       
+      BuildFamilyMap(aMesh,
+                    aFamilyNbCellsCounterMap,
+                    aFamilyCellsSizeCounterMap,
+                    aEntityInfo,
+                    anElemGroup,
+                    aFamilyGroup,
+                    aMed);
+
       BEGMSG(MY_GROUP_DEBUG,"TGroup:\n");
       TGroupMap& aGroupMap = aMesh->myGroupMap;
       MED::TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);