]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Minor changes
authorapo <apo@opencascade.com>
Wed, 31 Aug 2005 04:30:20 +0000 (04:30 +0000)
committerapo <apo@opencascade.com>
Wed, 31 Aug 2005 04:30:20 +0000 (04:30 +0000)
src/CONVERTOR/VISU_Convertor.hxx
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/CONVERTOR/VISU_MedConvertor.cxx
src/VISU_I/VISU_CorbaMedConvertor.cxx

index dcf3b10c06674a583c587bd8cb1985572e08be4e..8097a6607b7b110e8cdc4ac256de64dcfc1bc387 100644 (file)
@@ -222,7 +222,6 @@ namespace VISU
 
 
   //---------------------------------------------------------------
-  typedef std::pair<TName,TEntity> TFamilyAndEntity;
   typedef std::set<PFamily> TFamilySet;
 
   struct TGroup: virtual TBaseStructure
index 0cc816a3f00c3b86b4244d398033a072d8b8486f..82568e224ef171bff32c6f2139e673a474866462 100644 (file)
@@ -59,7 +59,7 @@ static int MYVTKDEBUG = 0;
 
 #ifdef _DEBUG_
 static int MYDEBUG = 1;
-static int MYDEBUGWITHFILES = 0;
+static int MYDEBUGWITHFILES = 1;
 #else
 static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
@@ -342,7 +342,6 @@ namespace VISU
   ::TGaussMeshImpl()
   {}
 
-  //---------------------------------------------------------------
   TGaussPointID 
   TGaussMeshImpl
   ::GetObjID(int theVtkI) const
@@ -360,21 +359,41 @@ namespace VISU
     return aRetVID;
   }
 
+
   //---------------------------------------------------------------
-  pair<int,int> 
+  vtkIdType
   TMeshOnEntityImpl
-  ::GetCellsDims(const string& theFamilyName) const
+  ::GetElemVTKID(vtkIdType theID) const
   {
-    if(theFamilyName == "")
-      return make_pair(myNbCells,myCellsSize);
+    TObj2VTKID::const_iterator anIter = std::find(myObj2VTKID.begin(),
+                                                 myObj2VTKID.end(),
+                                                 theID);
+    if(anIter != myObj2VTKID.end())
+      return *anIter;
+    return -1;
+  }
 
-    TFamilyMap::const_iterator aFamilyMapIter = myFamilyMap.find(theFamilyName);
-    if(aFamilyMapIter == myFamilyMap.end())
-      throw std::runtime_error("GetCellsDims >> There is no family on the mesh with entity !!!");
+  vtkIdType
+  TMeshOnEntityImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    return myObj2VTKID[theID];
+  }
 
-    PFamilyImpl aFamily = aFamilyMapIter->second; 
 
-    return make_pair(aFamily->myNbCells,aFamily->myCellsSize);
+  //---------------------------------------------------------------
+  TNbASizeCells 
+  TGroupImpl
+  ::GetNbASizeCells() const
+  {
+    vtkIdType aNbCells = 0, aCellsSize = 0;
+    TFamilySet::const_iterator anIter = myFamilySet.begin();
+    for(; anIter == myFamilySet.end(); anIter++){
+      PFamilyImpl aFamily = *anIter; 
+      aNbCells += aFamily->myNbCells;
+      aCellsSize += aFamily->myCellsSize;
+    }
+    return make_pair(aNbCells,aCellsSize);
   }
   
   
@@ -691,53 +710,30 @@ namespace
   //---------------------------------------------------------------
   void
   GetCellsOnEntity(const TVTKSource& theSource,
-                  const PMeshOnEntityImpl& theMeshOnEntity, 
-                  const std::string& theFamilyName = "") 
+                  const PMeshOnEntityImpl& theMeshOnEntity) 
   {
-    //Check on existing family
-    PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
-    //Main part of code
-    pair<int,int> aCellsDim = theMeshOnEntity->GetCellsDims(theFamilyName);
-    int aNbCells = aCellsDim.first, aCellsSize = aCellsDim.second;
+    INITMSG(MYDEBUG,"GetCellsOnEntity"<<endl);
+
+    vtkIdType aNbCells = theMeshOnEntity->myNbCells;
+    vtkIdType aCellsSize = theMeshOnEntity->myCellsSize;
+
     vtkCellArray* aConnectivity = vtkCellArray::New();
     aConnectivity->Allocate(aCellsSize,0);
     vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
     aCellTypesArray->SetNumberOfComponents(1);
     aCellTypesArray->SetNumberOfTuples(aNbCells);
-    INITMSG(MYDEBUG,"GetCellsOnEntity - isFamilyPresent = "<<bool(aFamily)<<
-           endl);
+
     const VISU::TGeom2Cell2Connect& aGeom2Cell2Connect = theMeshOnEntity->myGeom2Cell2Connect;
     VISU::TGeom2Cell2Connect::const_iterator aGeom2Cell2ConnectIter = aGeom2Cell2Connect.begin();
-    for(int i = 0, j = 0; aGeom2Cell2ConnectIter != aGeom2Cell2Connect.end(); aGeom2Cell2ConnectIter++){
+    for(vtkIdType i = 0, j = 0; aGeom2Cell2ConnectIter != aGeom2Cell2Connect.end(); aGeom2Cell2ConnectIter++){
       const VISU::TCell2Connect& anArray = aGeom2Cell2ConnectIter->second;
       vtkIdType aGeom = aGeom2Cell2ConnectIter->first;
       INITMSG(MYDEBUG,"aGeom = "<<aGeom<<
              "; anArray.size() = "<<anArray.size()<<
              endl);
-      if(!aFamily)
-       for(int k = 0, kEnd = anArray.size(); k < kEnd; k++, i++){
-         PrintCells(i,aConnectivity,anArray[k]);
-         aCellTypesArray->SetValue(j++,(unsigned char)aGeom);
-       }
-      else{
-       const VISU::TGeom2SubMeshID& aGeom2SubMeshID = aFamily->myGeom2SubMeshID;
-       if(aGeom2SubMeshID.empty()) 
-         EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
-
-       VISU::TGeom2SubMeshID::const_iterator aGeom2SubMeshIDIter = aGeom2SubMeshID.find(aGeom);
-       if(aGeom2SubMeshIDIter == aGeom2SubMeshID.end()) 
-         continue;
-
-       const VISU::TSubMeshID& aSubMeshID = aGeom2SubMeshIDIter->second;
-
-       INITMSG(MYDEBUG,"aSubMeshID.size() = "<<aSubMeshID.size()<<
-               endl);
-
-       VISU::TSubMeshID::const_iterator aSubMeshIDIter = aSubMeshID.begin();
-       for(; aSubMeshIDIter != aSubMeshID.end(); aSubMeshIDIter++, i++){
-         PrintCells(i,aConnectivity,anArray[*aSubMeshIDIter]);
-         aCellTypesArray->SetValue(j++,(unsigned char)aGeom);
-       }
+      for(vtkIdType k = 0, kEnd = anArray.size(); k < kEnd; k++, i++){
+       PrintCells(i,aConnectivity,anArray[k]);
+       aCellTypesArray->SetValue(j++,(unsigned char)aGeom);
       }
     }
     vtkIdType *pts = 0, npts = 0;
@@ -748,7 +744,9 @@ namespace
     for(int i=0; aConnectivity->GetNextCell(npts,pts); i++)
       aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
     theSource->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+
     if(MYVTKDEBUG) aConnectivity->DebugOn();
+
     aCellLocationsArray->Delete();
     aCellTypesArray->Delete();
     aConnectivity->Delete();
@@ -757,51 +755,44 @@ namespace
   
   //---------------------------------------------------------------
   void
-  GetCellsOnGroup(const TVTKSource& theSource,
-                 const PMeshImpl& theMesh,
-                 const TFamilySet& theFamilySet
+  GetCellsOnFamily(const TVTKSource& theSource,
+                  const PMeshOnEntityImpl& theMeshOnEntity, 
+                  const PFamilyImpl& theFamily
   {
-    //Calculate dimentions of the group
-    INITMSG(MYDEBUG,"GetCellsOnGroup\n");
-    int aNbCells = 0, aCellsSize = 0;
-    VISU::TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
-    for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){
-      VISU::PFamilyImpl aFamily = *aFamilyIter;
-      aCellsSize += aFamily->myCellsSize;
-      aNbCells += aFamily->myNbCells;
-    }
+    INITMSG(MYDEBUG,"GetCellsOnFamily"<<endl);
+
+    vtkIdType aNbCells = theFamily->myNbCells;
+    vtkIdType aCellsSize = theFamily->myCellsSize;
+
     vtkCellArray* aConnectivity = vtkCellArray::New();
     aConnectivity->Allocate(aCellsSize,0);
     vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
     aCellTypesArray->SetNumberOfComponents(1);
     aCellTypesArray->SetNumberOfTuples(aNbCells);
-    aFamilyIter = theFamilySet.begin();
-    for(int i = 0, j = 0; aFamilyIter != theFamilySet.end(); aFamilyIter++){
-      VISU::PFamilyImpl aFamily = *aFamilyIter;
-      const std::string& aFamilyName = aFamily->myName;
-      const VISU::TEntity& anEntity = aFamily->myEntity;
-      PMeshOnEntityImpl aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
-      const VISU::TGeom2Cell2Connect &aGeom2Cell2Connect = aMeshOnEntity->myGeom2Cell2Connect;
-      VISU::TGeom2Cell2Connect::const_iterator aGeom2Cell2ConnectIter = aGeom2Cell2Connect.begin();
-      for(; aGeom2Cell2ConnectIter != aGeom2Cell2Connect.end(); aGeom2Cell2ConnectIter++){
-       const VISU::TCell2Connect& anArray = aGeom2Cell2ConnectIter->second;
-       vtkIdType aGeom = aGeom2Cell2ConnectIter->first;
-       INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; anArray.size() = "<<anArray.size()<<"\n");
-
-       const VISU::TGeom2SubMeshID& aGeom2SubMeshID = aFamily->myGeom2SubMeshID;
-       if(aGeom2SubMeshID.empty()) 
-         EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
-
-       VISU::TGeom2SubMeshID::const_iterator aGeom2SubMeshIDIter = aGeom2SubMeshID.find(aGeom);
-       if(aGeom2SubMeshIDIter != aGeom2SubMeshID.end()){
-         const VISU::TSubMeshID& aSubMeshID = aGeom2SubMeshIDIter->second;
-         INITMSG(MYDEBUG,"aSubMeshID.size() = "<<aSubMeshID.size()<<"\n");
-         VISU::TSubMeshID::const_iterator aSubMeshIDIter = aSubMeshID.begin();
-         for(; aSubMeshIDIter != aSubMeshID.end(); aSubMeshIDIter++, i++){
-           PrintCells(i,aConnectivity,anArray[*aSubMeshIDIter]);
-           aCellTypesArray->SetValue(j++,(unsigned char)aGeom);
-         }
-       }
+
+    const VISU::TGeom2Cell2Connect& aGeom2Cell2Connect = theMeshOnEntity->myGeom2Cell2Connect;
+    VISU::TGeom2Cell2Connect::const_iterator aGeom2Cell2ConnectIter = aGeom2Cell2Connect.begin();
+    for(vtkIdType i = 0, j = 0; aGeom2Cell2ConnectIter != aGeom2Cell2Connect.end(); aGeom2Cell2ConnectIter++){
+      const VISU::TCell2Connect& anArray = aGeom2Cell2ConnectIter->second;
+      vtkIdType aGeom = aGeom2Cell2ConnectIter->first;
+      const VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
+      if(aGeom2SubMeshID.empty()) 
+       EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
+
+      VISU::TGeom2SubMeshID::const_iterator aGeom2SubMeshIDIter = aGeom2SubMeshID.find(aGeom);
+      if(aGeom2SubMeshIDIter == aGeom2SubMeshID.end()) 
+       continue;
+
+      const VISU::TSubMeshID& aSubMeshID = aGeom2SubMeshIDIter->second;
+
+      INITMSG(MYDEBUG,"aGeom = "<<aGeom<<
+             "; aSubMeshID.size() = "<<aSubMeshID.size()<<
+             endl);
+
+      VISU::TSubMeshID::const_iterator aSubMeshIDIter = aSubMeshID.begin();
+      for(; aSubMeshIDIter != aSubMeshID.end(); aSubMeshIDIter++, i++){
+       PrintCells(i,aConnectivity,anArray[*aSubMeshIDIter]);
+       aCellTypesArray->SetValue(j++,(unsigned char)aGeom);
       }
     }
     vtkIdType *pts = 0, npts = 0;
@@ -809,13 +800,16 @@ namespace
     aCellLocationsArray->SetNumberOfComponents(1);
     aCellLocationsArray->SetNumberOfTuples(aNbCells);
     aConnectivity->InitTraversal();
-    for(int i = 0; aConnectivity->GetNextCell(npts,pts); i++)
+    for(int i=0; aConnectivity->GetNextCell(npts,pts); i++)
       aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
     theSource->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+
+    if(MYVTKDEBUG) aConnectivity->DebugOn();
+
     aCellLocationsArray->Delete();
     aCellTypesArray->Delete();
     aConnectivity->Delete();
-  } 
+  }
   
   
   //---------------------------------------------------------------
@@ -1355,7 +1349,7 @@ VISU_Convertor_impl
 
       if(MYDEBUGWITHFILES){
        std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
-       std::string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+       std::string aFileName = string(getenv("HOME"))+"/"+getenv("USER")+"-";
        aFileName += aMeshName + dtos("-%d-",int(theEntity)) + "-Conv.vtk";
        VISU::WriteToFile(aSource.GetPointer(),aFileName);
       }
@@ -1405,16 +1399,18 @@ VISU_Convertor_impl
     if(!aFamily->myIsVTKDone){
       if(MYVTKDEBUG) aSource->DebugOn();
 
+      GetMeshOnEntity(theMeshName,theEntity);
+
       LoadFamilyOnEntity(aMesh,aMeshOnEntity,aFamily);
       GetPoints(aSource,aMesh);
-      GetCellsOnEntity(aSource,aMeshOnEntity,theFamilyName);
+      GetCellsOnFamily(aSource,aMeshOnEntity,aFamily);
 
       aFamily->myIsVTKDone = true;
 
       if(MYDEBUGWITHFILES){
        std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
        std::string aFamilyName = QString(theFamilyName.c_str()).simplifyWhiteSpace().latin1();
-       std::string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+       std::string aFileName = string(getenv("HOME"))+"/"+getenv("USER")+"-";
        aFileName += aMeshName + dtos("-%d-",int(theEntity)) + aFamilyName + "-Conv.vtk";
        VISU::WriteToFile(aSource.GetPointer(),aFileName);
       }
@@ -1475,7 +1471,7 @@ VISU_Convertor_impl
       if(MYDEBUGWITHFILES){
        std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
        std::string aGroupName = QString(theGroupName.c_str()).simplifyWhiteSpace().latin1();
-       std::string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+       std::string aFileName = string(getenv("HOME"))+"/"+getenv("USER")+"-";
        aFileName += aMeshName + "-" + aGroupName + "-Conv.vtk";
        VISU::WriteToFile(anAppendFilter->GetOutput(),aFileName);
       }
@@ -1550,7 +1546,7 @@ VISU_Convertor_impl
       if(MYDEBUGWITHFILES){
        string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
        string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
-       string aPrefix = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+       string aPrefix = string(getenv("HOME"))+"/"+getenv("USER")+"-";
        string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) + 
          aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
        VISU::WriteToFile(aSource.GetPointer(),aFileName);
@@ -1647,7 +1643,7 @@ VISU_Convertor_impl
       if(MYDEBUGWITHFILES){
        string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
        string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
-       string aPrefix = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+       string aPrefix = string(getenv("HOME"))+"/"+getenv("USER")+"-";
        string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) + 
          aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
        VISU::WriteToFile(aSource.GetPointer(),aFileName);
@@ -1915,7 +1911,9 @@ VISU_Convertor_impl
   PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
 
   vtkIdType aPointsSize = 3*aMesh->myNbPoints*sizeof(VISU::TCoord);
-  vtkIdType aNbCells = aGroup->myNbCells, aCellsSize = aGroup->myCellsSize;
+  TNbASizeCells aNbASizeCells = aGroup->GetNbASizeCells();
+  vtkIdType aNbCells = aNbASizeCells.first;
+  vtkIdType aCellsSize = aNbASizeCells.second;
   vtkIdType aConnectivityAndTypesSize = aCellsSize*sizeof(vtkIdType);
   vtkIdType aLocationsSize = aNbCells*sizeof(int);
   float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
index 398bd58566e32a99b0124d0b1a59a6bb4bb16b18..7e5eed046ef4fa1951313ea819e0189c6a83528c 100644 (file)
@@ -168,7 +168,6 @@ namespace VISU
 
   //---------------------------------------------------------------
   typedef TVector<vtkIdType> TSubMeshID;
-  typedef std::map<vtkIdType,TSubMeshID> TGeom2SubMeshID;
   typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus; 
 
   struct TSubProfileImpl: virtual TSubProfile, virtual TSource
@@ -190,7 +189,7 @@ namespace VISU
 
   //---------------------------------------------------------------
   typedef std::map<vtkIdType,vtkIdType> TElemObj2VTKID;
-  typedef std::vector<PSubProfileImpl> TSubProfileArr;
+  typedef TVector<PSubProfileImpl> TSubProfileArr;
   typedef std::map<vtkIdType,PSubProfileImpl> TGeom2SubProfile;
 
   struct TProfileImpl: virtual TProfile, virtual TAppendFilter
@@ -258,7 +257,7 @@ namespace VISU
 
 
   //---------------------------------------------------------------
-  typedef std::vector<PGaussSubMeshImpl> TGaussSubMeshArr;
+  typedef TVector<PGaussSubMeshImpl> TGaussSubMeshArr;
   typedef std::map<vtkIdType,PGaussSubMeshImpl> TGeom2GaussSubMesh;
 
   struct TGaussMeshImpl: virtual TGaussMesh, virtual TAppendFilter
@@ -280,12 +279,17 @@ namespace VISU
   typedef TVector<TConnect> TCell2Connect;
   typedef std::map<vtkIdType,TCell2Connect> TGeom2Cell2Connect;
 
+  typedef TVector<vtkIdType> TObj2VTKID;
+
   struct TMeshOnEntityImpl: virtual TMeshOnEntity, virtual TSource
   {
     TGeom2Cell2Connect myGeom2Cell2Connect;
 
-    std::pair<int,int> 
-    GetCellsDims(const std::string& theFamilyName = "") const;
+    virtual 
+    vtkIdType 
+    GetElemObjID(int theVtkI) const;
+
+    TObj2VTKID myObj2VTKID;
   };
   typedef SharedPtr<TMeshOnEntityImpl> PMeshOnEntityImpl;
 
@@ -309,8 +313,12 @@ namespace VISU
 
 
   //---------------------------------------------------------------
-  struct TGroupImpl: virtual TGroup, virtual TAppendFilter, virtual TSizeCounter
+  typedef std::pair<vtkIdType,vtkIdType> TNbASizeCells;
+
+  struct TGroupImpl: virtual TGroup, virtual TAppendFilter
   {
+    TNbASizeCells 
+    GetNbASizeCells() const;
   };
   typedef SharedPtr<TGroupImpl> PGroupImpl;
 
index 95daccbd5395fdf2b203eaf20a44b7b7e6f06389..9b199fa11ef8e101fc66656975f6703502962c55 100644 (file)
@@ -721,18 +721,10 @@ namespace
                  "- aFamilyName = '"<<aFamilyName<<"'"<<
                  "; aVEntity = "<<aVEntity<<
                  "\n");
-         
-         aGroup->myNbCells += aFamily->myNbCells;
-         aGroup->myCellsSize += aFamily->myCellsSize;
        }
       }
-      if(!aFamilySet.empty() && aGroup->myNbCells > 0){
-       BEGMSG(MY_GROUP_DEBUG,
-              "- myNbCells = "<<aGroup->myNbCells<<
-              "; myCellsSize = "<<aGroup->myCellsSize<<
-              "\n");
+      if(!aFamilySet.empty())
        aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
-      }
     }
   }
 
@@ -1224,6 +1216,7 @@ VISU_MedConvertor
        }
       }}
     }
+
     theMeshOnEntity->myIsDone = true;
 
     return 1;
@@ -1262,48 +1255,40 @@ VISU_MedConvertor
     TInt anId = theFamily->myId;
 
     const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+    TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
+
     const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
     MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
     TGeom2Cell2Connect& aGeom2Cell2Connect = theMeshOnEntity->myGeom2Cell2Connect;
-
     for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
       const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
-      int aVGeom = MEDGeomToVTK(aMGeom);
-      INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
+      MED::PElemInfo anElemInfo;
       switch(aMGeom){
       case MED::ePOLYGONE: {
-       MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
-       TInt aNbElem = aPolygoneInfo->GetNbElem();
-       
-       TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[aVGeom];
-       for(int iElem = 0; iElem < aNbElem; iElem++) 
-         if(aPolygoneInfo->GetFamNum(iElem) == anId)
-           aSubMeshID.push_back(iElem);
-
+       anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
        break;
       }
       case MED::ePOLYEDRE: {
-       MED::PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
-       TInt aNbElem = aPolyedreInfo->GetNbElem();
-       
-       TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[aVGeom];
-       for(int iElem = 0; iElem < aNbElem; iElem++) 
-         if(aPolyedreInfo->GetFamNum(iElem) == anId)
-           aSubMeshID.push_back(iElem);
-
+       anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
        break;
       }
       default: {
-       int aVNbNodes = VTKGeom2NbNodes(aVGeom);
-       
-       MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
-       TInt aNbElem = aCellInfo->GetNbElem();
-       
-       TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[aVGeom];
-       for(int iElem = 0; iElem < aNbElem; iElem++) 
-         if(aCellInfo->GetFamNum(iElem) == anId)
-           aSubMeshID.push_back(iElem);
+       anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
+       break;
       }}
+      if(anElemInfo){
+       if(TInt aNbElem = anElemInfo->GetNbElem()){
+         TSubMeshID aSubMeshID;
+         for(TInt iElem = 0; iElem < aNbElem; iElem++) 
+           if(anElemInfo->GetFamNum(iElem) == anId)
+             aSubMeshID.push_back(iElem);
+         if(!aSubMeshID.empty()){
+           TInt aVGeom = MEDGeomToVTK(aMGeom);
+           INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
+           aGeom2SubMeshID.insert(TGeom2SubMeshID::value_type(aVGeom,aSubMeshID));
+         }
+       }
+      }
     }
 
     theFamily->myIsDone = true;
index 56f5c2b3ce3ddf39a842f29c09b2e868e461d889..676609c5e510efd571c33193285794b0a8abbb8b 100644 (file)
@@ -679,9 +679,6 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
            if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup - aFamilyName = '"<<aFamilyName.in()<<"' = "<<bool(aFamily));
            if(aFamily){
              aFamilySet.insert(aFamily);
-             
-             aGroup->myNbCells += aFamily->myNbCells;
-             aGroup->myCellsSize += aFamily->myCellsSize;
            }
          }