]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To store MED::ProfileInfo inside of corresponding VISU CONVERTER class - TMEDSubProfile
authorapo <apo@opencascade.com>
Fri, 22 Jul 2005 16:14:12 +0000 (16:14 +0000)
committerapo <apo@opencascade.com>
Fri, 22 Jul 2005 16:14:12 +0000 (16:14 +0000)
src/CONVERTOR/VISU_MedConvertor.cxx
src/CONVERTOR/VISU_MedConvertor.hxx

index 9a06c6b882a0da94ebf43f97d81e076e55eae8c3..4bb1a353b838402649c60edd7002fefc1c1bd9e6 100644 (file)
@@ -43,8 +43,12 @@ using namespace VISU;
 
 #ifdef _DEBUG_
 static int MYDEBUG = 1;
+static int MY_FAMILY_DEBUG = 0;
+static int MY_GROUP_DEBUG = 0;
 #else
 static int MYDEBUG = 0;
+static int MY_FAMILY_DEBUG = 0;
+static int MY_GROUP_DEBUG = 0;
 #endif
 
 
@@ -143,8 +147,6 @@ namespace{
               const MED::TGeom2Size& theGeom2Size,
               const MED::TGeom2Profile& theGeom2Profile)
   {
-    INITMSG(MYDEBUG,"CrSubProfile()"<<endl);
-
     vtkIdType aVGeom = MEDGeomToVTK(theMGeom);
     vtkIdType aVNbNodes = VTKGeom2NbNodes(aVGeom);
 
@@ -160,20 +162,23 @@ namespace{
       TGeom2Profile::const_iterator aProfileIter = theGeom2Profile.find(theMGeom);
       if(aProfileIter != theGeom2Profile.end()){
        PProfileInfo aProfileInfo = aProfileIter->second;
+
        aSubProfile->myNbCells = aProfileInfo->myElemNum.size();
        aSubProfile->myName = aProfileInfo->GetName();
+       aSubProfile->myProfileInfo = aProfileInfo;
+
        aSubProfile->myStatus = eAddPart;
       }
     }
     aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes;
     
-    INITMSGA(MYDEBUG,0,
-            "- aVGeom = "<<aVGeom<<
-            "; aName = '"<<aSubProfile->myName<<"'"<<
-            "; aStatus = "<<aSubProfile->myStatus<<
-            "; aNbCells = "<<aSubProfile->myNbCells<<
-            "; aCellsSize = "<<aSubProfile->myCellsSize<<
-            endl);
+    INITMSG(MYDEBUG,
+           "- aVGeom = "<<aVGeom<<
+           "; aName = '"<<aSubProfile->myName<<"'"<<
+           "; aStatus = "<<aSubProfile->myStatus<<
+           "; aNbCells = "<<aSubProfile->myNbCells<<
+           "; aCellsSize = "<<aSubProfile->myCellsSize<<
+           endl);
     
     return aSubProfile;
   }
@@ -220,6 +225,7 @@ namespace{
     TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
     if(anIter != aProfileMap.end()){
       theValForTime.myProfile = anIter->second;
+      INITMSG(MYDEBUG,"aProfileMap.find(aProfileKey)"<<endl);
     }else{
       PMEDProfile aProfile(new TMEDProfile());
       TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
@@ -247,6 +253,7 @@ namespace{
              const MED::TGeom2Size& theGeom2Size,
              VISU::TMEDValForTime& theValForTime)
   {
+    int MYDEBUG = true;
     INITMSG(MYDEBUG,"GetGaussKey"<<endl);
 
     PMEDProfile aProfile = theValForTime.myProfile;
@@ -342,6 +349,7 @@ namespace{
     TGaussMeshMap::const_iterator anIter = aGaussMeshMap.find(aGaussKey);
     if(anIter != aGaussMeshMap.end()){
       theValForTime.myGaussMesh = anIter->second;
+      INITMSG(MYDEBUG,"aGaussMeshMap.find(aGaussKey)"<<endl);
     }else{
       PMEDGaussMesh aGaussMesh(new TMEDGaussMesh());
       TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
@@ -416,12 +424,6 @@ VISU_MedConvertor
       
       TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
       
-      TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
-      
-      TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup);
-      
-      TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
-      
       // creating TMesh structure and TMeshOnEntityMap
       typedef map<TInt,TInt> TFamilyCounterMap;
       TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
@@ -569,8 +571,91 @@ VISU_MedConvertor
        }
       }
       
+      TInt aNbFields = aMed->GetNbFields(); 
+      BEGMSG(MYDEBUG,"TField: aNbFields = "<<aNbFields<<"\n");
+      for(TInt iField = 1; iField <= aNbFields; iField++){
+       PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
+       TInt aNbComp = aFieldInfo->GetNbComp();
+       const string& aFieldName = aFieldInfo->GetName();
+       
+       MED::TGeom2Size aGeom2Size;
+       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++){
+         PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo,
+                                                                 aMEntity,
+                                                                 aGeom2Size,
+                                                                 iTimeStamp);
+         TFloat aDt = aTimeStampInfo->GetDt();
+         const string& anUnitDt = aTimeStampInfo->GetUnitDt();
+         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);
+         
+         TGaussMap& aGaussMap = aValForTime->myGaussMap;
+         const TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
+         TGeom2Gauss::const_iterator anIter = aGeom2Gauss.begin();
+         for(; anIter != aGeom2Gauss.end(); anIter++){
+           EGeometrieElement aMGeom = anIter->first;
+           PGaussInfo aGaussInfo = anIter->second;
+           PMEDGauss aMEDGauss(new TMEDGauss());
+           aMEDGauss->myGaussInfo = aGaussInfo;
+           aMEDGauss->myNbPoints = aGaussInfo->GetNbGauss();
+           aGaussMap[MEDGeomToVTK(aMGeom)] = aMEDGauss;
+         }
+       }
+      }
+
+      continue;
+
+      TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
+      TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup);
       TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin();
-      BEGMSG(MYDEBUG,"TFamilyByEntity:\n");
+      BEGMSG(MY_FAMILY_DEBUG,"TFamilyByEntity:\n");
       for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){
        const EEntiteMaillage& aMEntity = aFamilyByEntityIter->first;
        const TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
@@ -582,7 +667,7 @@ VISU_MedConvertor
        if(aFamilyGroup.empty())
          continue;
        
-       INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
+       INITMSG(MY_FAMILY_DEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
        TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
        for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
          const PFamilyInfo& aFamilyInfo = *aFamilyGroupIter;
@@ -598,7 +683,7 @@ VISU_MedConvertor
          aFamily->myNbCells = aFamilyNbCellsCounterMap[aFamily->myId];
          aFamily->myCellsSize = aFamilyCellsSizeCounterMap[aFamily->myId];
          
-         INITMSG(MYDEBUG,"aFamilyName = '"<<aFamily->myName<<
+         INITMSG(MY_FAMILY_DEBUG,"aFamilyName = '"<<aFamily->myName<<
                  "'; myId = "<<aFamily->myId<<"; "<<
                  "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
                  "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
@@ -611,14 +696,14 @@ VISU_MedConvertor
          for(TInt i = 0; i < aNbGroup; i++){
            const string& aGroupName = aFamilyInfo->GetGroupName(i);
            aBindGroups.insert(aGroupName);
-           INITMSG(MYDEBUG,"aGroupName = '"<<aGroupName<<"'\n");
+           INITMSG(MY_FAMILY_DEBUG,"aGroupName = '"<<aGroupName<<"'\n");
          }
        }
       }
       
-      BEGMSG(MYDEBUG,"TGroup:\n");
-      
+      BEGMSG(MY_GROUP_DEBUG,"TGroup:\n");
       VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
+      TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
       TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
       for(;aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
        const string& aGroupName = aGroupInfoIter->first;
@@ -627,7 +712,7 @@ VISU_MedConvertor
        aGroup->myName = aGroupName;
        aGroup->myMeshName = aMesh->myName;
        
-       INITMSG(MYDEBUG,"aGroup->myName = '"<<aGroup->myName<<"'\n");
+       INITMSG(MY_GROUP_DEBUG,"aGroup->myName = '"<<aGroup->myName<<"'\n");
        
        TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin();
        for(; aFamilyIter != aFamilyGroup.end(); aFamilyIter++){
@@ -656,97 +741,25 @@ VISU_MedConvertor
        exit_lable:
          if(aFamily && aVEntity >= 0){
            aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity));
-           INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyName<<"'; '"<<aFamily->myName<<"'; aVEntity = "<<aVEntity<<"\n");
+           INITMSG(MY_GROUP_DEBUG,
+                   "aFamilyName = '"<<aFamilyName<<"'"<<
+                   "; '"<<aFamily->myName<<"'"<<
+                   "; aVEntity = "<<aVEntity<<
+                   "\n");
            
            aGroup->myNbCells += aFamily->myNbCells;
            aGroup->myCellsSize += aFamily->myCellsSize;
          }
        }
        if(!aGroup->myFamilyAndEntitySet.empty() && aGroup->myNbCells > 0){
-         BEGMSG(MYDEBUG,"myNbCells = "<<aGroup->myNbCells<<
-                "; myCellsSize = "<<aGroup->myCellsSize<<"\n");
+         BEGMSG(MY_GROUP_DEBUG,
+                "myNbCells = "<<aGroup->myNbCells<<
+                "; myCellsSize = "<<aGroup->myCellsSize<<
+                "\n");
          aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
        }
       }
       
-      TInt aNbFields = aMed->GetNbFields(); 
-      BEGMSG(MYDEBUG,"TField: aNbFields = "<<aNbFields<<"\n");
-      for(TInt iField = 1; iField <= aNbFields; iField++){
-       PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
-       TInt aNbComp = aFieldInfo->GetNbComp();
-       const string& aFieldName = aFieldInfo->GetName();
-       
-       MED::TGeom2Size aGeom2Size;
-       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++){
-         PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo,
-                                                                 aMEntity,
-                                                                 aGeom2Size,
-                                                                 iTimeStamp);
-         TFloat aDt = aTimeStampInfo->GetDt();
-         const string& anUnitDt = aTimeStampInfo->GetUnitDt();
-         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);
-         
-         TGaussMap& aGaussMap = aValForTime->myGaussMap;
-         const TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
-         TGeom2Gauss::const_iterator anIter = aGeom2Gauss.begin();
-         for(; anIter != aGeom2Gauss.end(); anIter++){
-           EGeometrieElement aMGeom = anIter->first;
-           PGaussInfo aGaussInfo = anIter->second;
-           PMEDGauss aMEDGauss(new TMEDGauss());
-           aMEDGauss->myGaussInfo = aGaussInfo;
-           aMEDGauss->myNbPoints = aGaussInfo->GetNbGauss();
-           aGaussMap[MEDGeomToVTK(aMGeom)] = aMEDGauss;
-         }
-       }
-      }
     } catch(std::exception& exc){
       MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
     } catch(...){
@@ -1104,7 +1117,15 @@ LoadProfile(MED::TTimeStampVal& theTimeStampVal,
     TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aVGeom);
     if(anIter2 != aGeom2SubProfile.end()){
       PMEDSubProfile aSubProfile = anIter2->second;
-      aSubProfile->mySubMeshID = aProfileInfo->myElemNum;
+
+      MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
+      if(!anElemNum.empty()){
+       TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
+       TInt aSize = anElemNum.size();
+       aSubMeshID.resize(aSize);
+       for(TInt anId = 0; anId < aSize; anId++)
+         aSubMeshID[anId] = anElemNum[anId] - 1;
+      }
 
       INITMSG(MYDEBUG,
              "- aVGeom = "<<aVGeom<<
@@ -1123,6 +1144,7 @@ LoadGaussMesh(const MED::PWrapper& theMed,
              VISU::TMEDValForTime& theValForTime,
              VISU::TMEDMeshOnEntity& theMeshOnEntity)
 {
+  int MYDEBUG = true;
   INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
 
   PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
@@ -1156,17 +1178,29 @@ LoadGaussMesh(const MED::PWrapper& theMed,
                                                        aMEntity, 
                                                        aMGeom);
 
-       PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
-       TElemNum anElemNum = aSubProfile->mySubMeshID;
-       
        MED::TGaussCoord aGaussCoord;
-       MED::GetGaussCoord3D(aGaussInfo,
-                            aCellInfo,
-                            aNodeInfo,
-                            aGaussCoord,
-                            anElemNum);
 
-       TPoints& aPoints = aGaussSubMesh->myPoints;
+       PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
+       const TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
+
+       if(!aSubMeshID.empty()){
+         MED::PProfileInfo aProfileInfo = aSubProfile->myProfileInfo;
+         const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
+         MED::GetGaussCoord3D(aGaussInfo,
+                              aCellInfo,
+                              aNodeInfo,
+                              aGaussCoord,
+                              anElemNum);
+       }else
+         MED::GetGaussCoord3D(aGaussInfo,
+                              aCellInfo,
+                              aNodeInfo,
+                              aGaussCoord);
+
+       TInt aSize = aGaussCoord.size();
+       if(aSize){
+         TPoints& aPoints = aGaussSubMesh->myPoints;
+       }
 
        INITMSG(MYDEBUG,
                "- aVGeom = "<<aVGeom<<
index 58b2afb16f0d6ca6c5352611ef63430c93c10047..77bcb45d60e8dc21d46823a79f6051941a20785b 100644 (file)
@@ -27,7 +27,9 @@ namespace VISU{
 
   //---------------------------------------------------------------
   struct TMEDSubProfile: TSubProfileImpl
-  {};
+  {
+    MED::PProfileInfo myProfileInfo;
+  };
   typedef SharedPtr<TMEDSubProfile> PMEDSubProfile;