]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To separate MeshOnEntity and Family handling (first step)
authorapo <apo@opencascade.com>
Tue, 30 Aug 2005 11:19:45 +0000 (11:19 +0000)
committerapo <apo@opencascade.com>
Tue, 30 Aug 2005 11:19:45 +0000 (11:19 +0000)
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/CONVERTOR/VISU_MedConvertor.cxx
src/CONVERTOR/VISU_MedConvertor.hxx
src/VISU_I/VISU_CorbaMedConvertor.cxx
src/VISU_I/VISU_CorbaMedConvertor.hxx

index 25e8ac3f02a5f552464509c462c1f68a51aab82c..acac4c18127b4c08de2d0a3df721925519b45944 100644 (file)
@@ -1366,7 +1366,7 @@ VISU_Convertor_impl
     if(!aMeshOnEntity->myIsVTKDone){
       if(MYVTKDEBUG) aSource->DebugOn();
 
-      LoadMeshOnEntity(aMeshOnEntity);
+      LoadMeshOnEntity(aMesh,aMeshOnEntity);
       GetPoints(aSource,aMesh);
       GetCellsOnEntity(aSource,aMeshOnEntity);
 
@@ -1413,8 +1413,8 @@ VISU_Convertor_impl
     FindFamilyOnEntity(theMeshName,theEntity,theFamilyName);
 
   PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);;
-  PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
   PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity);
+  PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
 
   //Main part of code
   const TVTKSource& aSource = aFamily->GetSource();
@@ -1424,7 +1424,7 @@ VISU_Convertor_impl
     if(!aFamily->myIsVTKDone){
       if(MYVTKDEBUG) aSource->DebugOn();
 
-      LoadMeshOnEntity(aMeshOnEntity,theFamilyName);
+      LoadFamilyOnEntity(aMesh,aMeshOnEntity,aFamily);
       GetPoints(aSource,aMesh);
       GetCellsOnEntity(aSource,aMeshOnEntity,theFamilyName);
 
@@ -1539,7 +1539,7 @@ VISU_Convertor_impl
       LoadValForTimeOnMesh(aMesh,aMeshOnEntity,aField,aValForTime);
 
       try{
-       LoadMeshOnEntity(aVTKMeshOnEntity);
+       LoadMeshOnEntity(aMesh,aVTKMeshOnEntity);
       }catch(std::exception& exc){
        aVTKMeshOnEntity = aMeshOnEntity;
        MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
index b9bb7bcf046c73e7f8fe912a1ec65a7569b44a0a..26de9e714a5171185c3d6ade4e483ba8bf1771a0 100644 (file)
@@ -539,8 +539,14 @@ protected:
 protected:
   virtual
   int
-  LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                  const std::string& theFamilyName = "") = 0;
+  LoadMeshOnEntity(VISU::PMeshImpl theMesh,
+                  VISU::PMeshOnEntityImpl theMeshOnEntity) = 0;
+
+  virtual
+  int
+  LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
+                    VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                    VISU::PFamilyImpl theFamily) = 0;
 
   virtual 
   int
index 4913822586e6d8b783183e1e735e58941a67db17..c6f13fe70c7cd8927981081b93750bfabd79228c 100644 (file)
@@ -871,20 +871,40 @@ VISU_MedConvertor
 //---------------------------------------------------------------
 int
 VISU_MedConvertor
-::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                  const string& theFamilyName)
+::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
+                  VISU::PMeshOnEntityImpl theMeshOnEntity)
 {
   MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
-  const std::string& aMeshName = theMeshOnEntity->myMeshName;
   const TEntity& anEntity = theMeshOnEntity->myEntity;
-  PMeshImpl aMesh = myMeshMap[aMeshName];
 
   int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
   if(anEntity == NODE_ENTITY){
-    isPointsUpdated += LoadPoints(aMed,aMesh,theFamilyName);
+    isPointsUpdated += LoadPoints(aMed,theMesh);
   }else{
-    isPointsUpdated += LoadPoints(aMed,aMesh);
-    isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,aMesh,theMeshOnEntity,theFamilyName);
+    isPointsUpdated += LoadPoints(aMed,theMesh);
+    isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
+  }
+
+  return (isPointsUpdated || isCellsOnEntityUpdated);
+}
+
+
+//---------------------------------------------------------------
+int
+VISU_MedConvertor
+::LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
+                    VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                    VISU::PFamilyImpl theFamily)
+{
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+  const TEntity& anEntity = theMeshOnEntity->myEntity;
+
+  int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
+  if(anEntity == NODE_ENTITY){
+    isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,theFamily);
+  }else{
+    isPointsUpdated += LoadPoints(aMed,theMesh);
+    isCellsOnEntityUpdated += LoadCellsOnFamily(aMed,theMesh,theMeshOnEntity,theFamily);
   }
 
   return (isPointsUpdated || isCellsOnEntityUpdated);
@@ -904,11 +924,12 @@ VISU_MedConvertor
     const std::string& aFamilyName = aFamilyAndEntitySetIter->first;
     const TEntity& anEntity = aFamilyAndEntitySetIter->second;
     const PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
+    PMEDFamily aFamily = VISU::GetFamily(aMeshOnEntity,aFamilyName);
     if(anEntity == NODE_ENTITY){
-      isPointsUpdated += LoadPoints(aMed,theMesh,aFamilyName);
+      isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,aFamily);
     }else{
       isPointsUpdated += LoadPoints(aMed,theMesh);
-      isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,aMeshOnEntity,aFamilyName);
+      isCellsOnEntityUpdated += LoadCellsOnFamily(aMed,theMesh,aMeshOnEntity,aFamily);
     }
   }
 
@@ -961,70 +982,87 @@ VISU_MedConvertor
 int 
 VISU_MedConvertor
 ::LoadPoints(const MED::PWrapper& theMed,
-            VISU::PMEDMesh theMesh, 
-            const string& theFamilyName) 
+            VISU::PMEDMesh theMesh) 
 {
   try{
     //Check on existing family
     PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
-    aMeshOnEntity->myEntity = NODE_ENTITY;
     aMeshOnEntity->myMeshName = theMesh->myName;
-    PMEDFamily aFamily = VISU::GetFamily(aMeshOnEntity,theFamilyName);
+    aMeshOnEntity->myEntity = NODE_ENTITY;
+
+    INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<<theMesh->myIsDone<<"'\n");
 
     //Check on loading already done
     if(theMesh->myIsDone)
-      if(!aFamily) 
-       return 0;
-      else if(aFamily->myIsDone) 
-       return 0;
-
-    INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<<theMesh->myIsDone<<
-           "; theFamilyName = '"<<theFamilyName<<"'\n");
+      return 0;
 
     //Main part of code
     MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
     TInt aNbElem = aNodeInfo->GetNbElem();
+    TInt aDim = theMesh->myDim;
 
-    if(!theMesh->myIsDone){
-      TInt aDim = theMesh->myDim;
+    TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
+    if(EBooleen anIsNodeNum = aNodeInfo->IsElemNum())
+      aCoords.Init(aNbElem,aDim,aNodeInfo->myElemNum);
+    else
+      aCoords.Init(aNbElem,aDim);
+    
+    for(int iDim = 0; iDim < aDim; iDim++)
+      aCoords.GetName(iDim) = aNodeInfo->GetCoordName(iDim);
+    
+    for(int iElem = 0; iElem < aNbElem; iElem++){
+      TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem);
+      MED::TCCoordSlice aMCoordSlice = aNodeInfo->GetCoordSlice(iElem);
+      for(int iDim = 0; iDim < aDim; iDim++)
+       aVCoordSlice[iDim] = aMCoordSlice[iDim];
+    }
+    
+    TCell2Connect& aConnForCellType = aMeshOnEntity->myGeom2Cell2Connect[VTK_VERTEX];
+    aConnForCellType.resize(aNbElem);
+    for (int iElem = 0; iElem < aNbElem; iElem++)
+      aConnForCellType[iElem] = VISU::TConnect(1,iElem);
+    
+    theMesh->myIsDone = true;
+    
+    return 1;
 
-      TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
-      if(EBooleen anIsNodeNum = aNodeInfo->IsElemNum())
-       aCoords.Init(aNbElem,aDim,aNodeInfo->myElemNum);
-      else
-       aCoords.Init(aNbElem,aDim);
+  }catch(std::exception& exc){
+    throw;
+  }catch(...){
+    EXCEPTION(runtime_error,"Unknown exception !!!");
+  }
 
-      for(int iDim = 0; iDim < aDim; iDim++)
-       aCoords.GetName(iDim) = aNodeInfo->GetCoordName(iDim);
-      
-      for(int iElem = 0; iElem < aNbElem; iElem++){
-       TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem);
-       MED::TCCoordSlice aMCoordSlice = aNodeInfo->GetCoordSlice(iElem);
-       for(int iDim = 0; iDim < aDim; iDim++)
-         aVCoordSlice[iDim] = aMCoordSlice[iDim];
-      }
+  return 0;
+}
 
-      TCell2Connect& aConnForCellType = aMeshOnEntity->myGeom2Cell2Connect[VTK_VERTEX];
-      aConnForCellType.resize(aNbElem);
-      for (int iElem = 0; iElem < aNbElem; iElem++)
-       aConnForCellType[iElem] = VISU::TConnect(1,iElem);
-      
-      theMesh->myIsDone = true;
-    }
 
-    if(aFamily){
-      if(!aFamily->myIsDone){
-       if(aNbElem > 0){
-         TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[VTK_VERTEX];
-         for (int iElem = 0; iElem < aNbElem; iElem++) 
-           if(aNodeInfo->GetFamNum(iElem) == aFamily->myId)
-             aSubMeshID.push_back(iElem);
-       }
-       aFamily->myIsDone = true;
-      }
+//---------------------------------------------------------------
+int 
+VISU_MedConvertor
+::LoadPointsOnFamily(const MED::PWrapper& theMed,
+                    const VISU::PMEDMesh theMesh, 
+                    const VISU::PMEDFamily theFamily) 
+{
+  try{
+    if(theFamily->myIsDone) 
+      return 0;
+
+    //Main part of code
+    MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
+    TInt aNbElem = aNodeInfo->GetNbElem();
+
+    if(aNbElem > 0){
+      TInt anId = theFamily->myId;
+      TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VTK_VERTEX];
+      for(TInt iElem = 0; iElem < aNbElem; iElem++) 
+       if(aNodeInfo->GetFamNum(iElem) == anId)
+         aSubMeshID.push_back(iElem);
     }
 
+    theFamily->myIsDone = true;
+
     return 1;
+
   }catch(std::exception& exc){
     throw;
   }catch(...){
@@ -1038,32 +1076,21 @@ VISU_MedConvertor
 //---------------------------------------------------------------
 int 
 VISU_MedConvertor
-::LoadCellsOnEntity(const MED::PWrapper& theMed, 
-                   VISU::PMEDMesh theMesh,
-                   VISU::PMEDMeshOnEntity theMeshOnEntity,
-                   const string& theFamilyName)
+::LoadCellsOnEntity(const MED::PWrapper& theMed,
+                   const VISU::PMEDMesh theMesh,
+                   const VISU::PMEDMeshOnEntity theMeshOnEntity)
 {
 #ifndef _DEXCEPT_
   try{
 #endif
-
-    //Check on existing family
-    PFamilyImpl aFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
-
-    //Check on loading already done
-    bool isCellsLoaded = !theMeshOnEntity->myGeom2Cell2Connect.empty();
-    if(isCellsLoaded)
-      if(!aFamily) 
-       return 0;
-      else if(!aFamily->myGeom2SubMeshID.empty()) 
-       return 0;
-
-    INITMSG(MYDEBUG,"LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'\n");
-    BEGMSG(MYDEBUG,"LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<bool(aFamily)<<endl);
-
     const TEntity& aVEntity = theMeshOnEntity->myEntity;
     const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
 
+    INITMSG(MYDEBUG,"LoadCellsOnEntity - aVEntity = "<<aVEntity<<"\n");
+
+    if(theMeshOnEntity->myIsDone)
+      return 0;
+
     const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
     MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
     TInt aNbPoints = aNodeInfo->GetNbElem();
@@ -1093,64 +1120,50 @@ VISU_MedConvertor
        MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
        TInt aNbElem = aPolygoneInfo->GetNbElem();
        
-       if(!isCellsLoaded){
-         TCell2Connect& aCell2Connect = aGeom2Cell2Connect[aVGeom];
-         aCell2Connect.resize(aNbElem);
-
-         for(TInt iElem = 0; iElem < aNbElem; iElem++) {
-           MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
-           TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
-           TConnect& anArray = aCell2Connect[iElem];
-           anArray.resize(aNbConn);
-           for(TInt iConn = 0; iConn < aNbConn; iConn++)
-             anArray[iConn] = aConnSlice[iConn] - 1;
-         }
-       }
-       if(aFamily){
-         TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[aVGeom];
-         for(int iElem = 0; iElem < aNbElem; iElem++) 
-           if(aPolygoneInfo->GetFamNum(iElem) == aFamily->myId)
-             aSubMeshID.push_back(iElem);
+       TCell2Connect& aCell2Connect = aGeom2Cell2Connect[aVGeom];
+       aCell2Connect.resize(aNbElem);
+       
+       for(TInt iElem = 0; iElem < aNbElem; iElem++) {
+         MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
+         TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
+         TConnect& anArray = aCell2Connect[iElem];
+         anArray.resize(aNbConn);
+         for(TInt iConn = 0; iConn < aNbConn; iConn++)
+           anArray[iConn] = aConnSlice[iConn] - 1;
        }
+       
        break;
       }
       case MED::ePOLYEDRE: {
        MED::PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
        TInt aNbElem = aPolyedreInfo->GetNbElem();
        
-       if(!isCellsLoaded){
-         TCell2Connect& aCell2Connect = aGeom2Cell2Connect[aVGeom];
-         aCell2Connect.resize(aNbElem);
+       TCell2Connect& aCell2Connect = aGeom2Cell2Connect[aVGeom];
+       aCell2Connect.resize(aNbElem);
          
-         for(TInt iElem = 0; iElem < aNbElem; iElem++){
-           MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
-           TConnect& anArray = aCell2Connect[iElem];
-           typedef set<TInt> TConnectSet;
-           TConnectSet aConnectSet;
-           TInt aNbFaces = aConnSliceArr.size();
-           for(TInt iFace = 0; iFace < aNbFaces; iFace++){
-             MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
-             TInt aNbConn = aConnSlice.size();
-             for(TInt iConn = 0; iConn < aNbConn; iConn++){
-               aConnectSet.insert(aConnSlice[iConn]);
-             }
+       for(TInt iElem = 0; iElem < aNbElem; iElem++){
+         MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
+         TConnect& anArray = aCell2Connect[iElem];
+         typedef set<TInt> TConnectSet;
+         TConnectSet aConnectSet;
+         TInt aNbFaces = aConnSliceArr.size();
+         for(TInt iFace = 0; iFace < aNbFaces; iFace++){
+           MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
+           TInt aNbConn = aConnSlice.size();
+           for(TInt iConn = 0; iConn < aNbConn; iConn++){
+             aConnectSet.insert(aConnSlice[iConn]);
            }
+         }
          
-           int aNbConn = aConnectSet.size();
-           anArray.resize(aNbConn);
-           TConnectSet::iterator anIter = aConnectSet.begin();
-           for(int i = 0; anIter != aConnectSet.end(); anIter++, i++){
-             TInt anId = *anIter;
-             anArray[i] = anId - 1;
-           }
+         int aNbConn = aConnectSet.size();
+         anArray.resize(aNbConn);
+         TConnectSet::iterator anIter = aConnectSet.begin();
+         for(int i = 0; anIter != aConnectSet.end(); anIter++, i++){
+           TInt anId = *anIter;
+           anArray[i] = anId - 1;
          }
        }
-       if(aFamily){
-         TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[aVGeom];
-         for(int iElem = 0; iElem < aNbElem; iElem++) 
-           if(aPolyedreInfo->GetFamNum(iElem) == aFamily->myId)
-             aSubMeshID.push_back(iElem);
-       }
+
        break;
       }
       default: {
@@ -1159,75 +1172,147 @@ VISU_MedConvertor
        MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
        TInt aNbElem = aCellInfo->GetNbElem();
        
-       if(!isCellsLoaded){
-         TCell2Connect& aConnForCellType = aGeom2Cell2Connect[aVGeom];
-         aConnForCellType.resize(aNbElem);
-         
-         int aMNbNodes = MEDGeom2NbNodes(aMGeom);
-         vector<TInt> aConnect(aMNbNodes);
+       TCell2Connect& aConnForCellType = aGeom2Cell2Connect[aVGeom];
+       aConnForCellType.resize(aNbElem);
+       
+       int aMNbNodes = MEDGeom2NbNodes(aMGeom);
+       vector<TInt> aConnect(aMNbNodes);
+       
+       for (int iElem = 0; iElem < aNbElem; iElem++) {
+         MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
+         TConnect& anArray = aConnForCellType[iElem];
+         anArray.resize(aVNbNodes);
          
-         for (int iElem = 0; iElem < aNbElem; iElem++) {
-           MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
-           TConnect& anArray = aConnForCellType[iElem];
-           anArray.resize(aVNbNodes);
-           
-           if(anIsNodeNum){
-             for(int iConn = 0; iConn < aMNbNodes; iConn++){
-               aConnect[iConn] = aNodeIdMap[aConnSlice[iConn] - 1];
-             }
-           }else{
-             for(int iConn = 0; iConn < aMNbNodes; iConn++){
-               aConnect[iConn] = aConnSlice[iConn] - 1;
-             }
+         if(anIsNodeNum){
+           for(int iConn = 0; iConn < aMNbNodes; iConn++){
+             aConnect[iConn] = aNodeIdMap[aConnSlice[iConn] - 1];
            }
-           
-           switch(aMGeom){
-           case MED::eTETRA4:
-           case MED::eTETRA10:
-             anArray[0] = aConnect[0];
-             anArray[1] = aConnect[1];
-             anArray[2] = aConnect[3];  
-             anArray[3] = aConnect[2];  
-             break;
-           case MED::ePYRA5:
-           case MED::ePYRA13:
-             anArray[0] = aConnect[0];
-             anArray[1] = aConnect[3];  
-             anArray[2] = aConnect[2];
-             anArray[3] = aConnect[1];  
-             anArray[4] = aConnect[4];
-             break;
-           default:
-             for(int iNode = 0; iNode < aVNbNodes; iNode++) 
-               anArray[iNode] = aConnect[iNode];
+         }else{
+           for(int iConn = 0; iConn < aMNbNodes; iConn++){
+             aConnect[iConn] = aConnSlice[iConn] - 1;
            }
+         }
+         
+         switch(aMGeom){
+         case MED::eTETRA4:
+         case MED::eTETRA10:
+           anArray[0] = aConnect[0];
+           anArray[1] = aConnect[1];
+           anArray[2] = aConnect[3];  
+           anArray[3] = aConnect[2];  
+           break;
+         case MED::ePYRA5:
+         case MED::ePYRA13:
+           anArray[0] = aConnect[0];
+           anArray[1] = aConnect[3];  
+           anArray[2] = aConnect[2];
+           anArray[3] = aConnect[1];  
+           anArray[4] = aConnect[4];
+           break;
+         default:
            for(int iNode = 0; iNode < aVNbNodes; iNode++) 
-             if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
-               EXCEPTION(runtime_error,"LoadCellsOnEntity - "<<
-                         " aNbPoints("<<aNbPoints<<") "<<
-                         "<= anArray["<<iElem<<"]"<<
-                         "["<<iNode<<"]"<<
-                         "("<<anArray[iNode]<<") < 0");
+             anArray[iNode] = aConnect[iNode];
          }
+         for(int iNode = 0; iNode < aVNbNodes; iNode++) 
+           if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
+             EXCEPTION(runtime_error,"LoadCellsOnEntity - "<<
+                       " aNbPoints("<<aNbPoints<<") "<<
+                       "<= anArray["<<iElem<<"]"<<
+                       "["<<iNode<<"]"<<
+                       "("<<anArray[iNode]<<") < 0");
        }
-       //Filling aFamily Geom2SubMeshID
-       if(aFamily){
-         TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[aVGeom];
-         for(int iElem = 0; iElem < aNbElem; iElem++) 
-           if(aCellInfo->GetFamNum(iElem) == aFamily->myId)
-             aSubMeshID.push_back(iElem);
-       }
+      }}
+    }
+    theMeshOnEntity->myIsDone = true;
+
+    return 1;
+
+#ifndef _DEXCEPT_
+  }catch(std::exception& exc){
+    throw;
+  }catch(...){
+    EXCEPTION(runtime_error,"Unknown exception !!!");
+  }
+#endif
+
+  return 0;
+}
+
+
+//---------------------------------------------------------------
+int 
+VISU_MedConvertor
+::LoadCellsOnFamily(const MED::PWrapper& theMed,
+                   const VISU::PMEDMesh theMesh,
+                   const VISU::PMEDMeshOnEntity theMeshOnEntity,
+                   const VISU::PMEDFamily theFamily)
+{
+#ifndef _DEXCEPT_
+  try{
+#endif
+    const TEntity& aVEntity = theMeshOnEntity->myEntity;
+    const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
+
+    INITMSG(MYDEBUG,"LoadCellsOnFamily - aVEntity = "<<aVEntity<<"\n");
+
+    if(theFamily->myIsDone)
+      return 0;
+
+    TInt anId = theFamily->myId;
+
+    const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+    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");
+      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);
+
+       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);
+
+       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);
+      }}
     }
+
+    theFamily->myIsDone = true;
+
     return 1;
 
 #ifndef _DEXCEPT_
   }catch(std::exception& exc){
-    theMeshOnEntity->myGeom2Cell2Connect.clear();
-    throw;
+    throw;x
   }catch(...){
-    theMeshOnEntity->myGeom2Cell2Connect.clear();
     EXCEPTION(runtime_error,"Unknown exception !!!");
   }
 #endif
index 3394876ef4b14c045b68296fcdeb1bff6bca76e3..35d903fea2a34d5bd6f7c161898c4133edd700ca 100644 (file)
@@ -125,9 +125,15 @@ protected:
 
   virtual
   int
-  LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                  const std::string& theFamilyName = "");
+  LoadMeshOnEntity(VISU::PMeshImpl theMesh,
+                  VISU::PMeshOnEntityImpl theMeshOnEntity);
   
+  virtual
+  int
+  LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
+                    VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                    VISU::PFamilyImpl theFamily);
+
   virtual
   int
   LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
@@ -149,14 +155,23 @@ protected:
 
   int
   LoadPoints(const MED::PWrapper& theMed,
-            VISU::PMEDMesh theMesh, 
-            const std::string& theFamilyName = "");
+            const VISU::PMEDMesh theMesh);
+  
+  int
+  LoadPointsOnFamily(const MED::PWrapper& theMed,
+                    const VISU::PMEDMesh theMesh, 
+                    const VISU::PMEDFamily theFamily);
   
   int
   LoadCellsOnEntity(const MED::PWrapper& theMed,
-                   VISU::PMEDMesh theMesh,
-                   VISU::PMEDMeshOnEntity theMeshOnEntity,
-                   const std::string& theFamilyName = "");
+                   const VISU::PMEDMesh theMesh,
+                   const VISU::PMEDMeshOnEntity theMeshOnEntity);
+  
+  int
+  LoadCellsOnFamily(const MED::PWrapper& theMed,
+                   const VISU::PMEDMesh theMesh,
+                   const VISU::PMEDMeshOnEntity theMeshOnEntity,
+                   const VISU::PMEDFamily theFamily);
   
   int
   LoadValForTimeOnMesh(const MED::PWrapper& theMed,
index 4d2df3a2ed0c6dc8b8f67692a255fe4f4798b097..0b04fbe529cbcad475308bf16094db1931ed3e75 100644 (file)
@@ -866,28 +866,48 @@ VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator)
 
 //---------------------------------------------------------------
 int
-VISU_MEDConvertor::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                                   const string& theFamilyName)
+VISU_MEDConvertor
+::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
+                  VISU::PMeshOnEntityImpl theMeshOnEntity)
 {
-  //Main part of code
-  const string& aMeshName = theMeshOnEntity->myMeshName;
   const TEntity& aVEntity = theMeshOnEntity->myEntity;
-  PCMesh aMesh = myMeshMap[aMeshName];
-  int isPointsUpdated;
+  int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
   if(aVEntity == NODE_ENTITY) 
-    isPointsUpdated = LoadPoints(aMesh,theFamilyName);
-  else 
-    isPointsUpdated = LoadPoints(aMesh);
-  int isCellsOnEntityUpdated = LoadCellsOnEntity(aMesh,theMeshOnEntity,theFamilyName);
+    isPointsUpdated += LoadPoints(theMesh);
+  else{
+    isPointsUpdated += LoadPoints(theMesh);
+    isCellsOnEntityUpdated += LoadCellsOnEntity(theMesh,theMeshOnEntity);
+  }
 
   return (isPointsUpdated || isCellsOnEntityUpdated);
 }
  
  
+//---------------------------------------------------------------
+int
+VISU_MEDConvertor
+::LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
+                    VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                    VISU::PFamilyImpl theFamily)
+{
+  const TEntity& anEntity = theMeshOnEntity->myEntity;
+  int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
+  if(anEntity == NODE_ENTITY){
+    isPointsUpdated += LoadPointsOnFamily(theMesh,theFamily);
+  }else{
+    isPointsUpdated += LoadPoints(theMesh);
+    isCellsOnEntityUpdated += LoadCellsOnFamily(theMesh,theMeshOnEntity,theFamily);
+  }
+
+  return (isPointsUpdated || isCellsOnEntityUpdated);
+}
+
+
 //---------------------------------------------------------------
 int 
-VISU_MEDConvertor::LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
-                                  const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
+VISU_MEDConvertor
+::LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
+                 const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
 {
   //Main part of code
   int isPointsUpdated = 0;
@@ -897,12 +917,13 @@ VISU_MEDConvertor::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
     const string& aFamilyName = aFamilyAndEntitySetIter->first;
     const VISU::TEntity& aVEntity = aFamilyAndEntitySetIter->second;
     PCMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
+    PCFamily aFamily = VISU::GetFamily(aMeshOnEntity,aFamilyName);
     if(aVEntity == VISU::NODE_ENTITY){
-      isPointsUpdated += LoadPoints(theMesh,aFamilyName);
+      isPointsUpdated += LoadPointsOnFamily(theMesh,aFamily);
       isCellsOnEntityUpdated += LoadCellsOnEntity(theMesh,aMeshOnEntity);
     }else{
       isPointsUpdated += LoadPoints(theMesh);
-      isCellsOnEntityUpdated += LoadCellsOnEntity(theMesh,aMeshOnEntity,aFamilyName);
+      isCellsOnEntityUpdated += LoadCellsOnFamily(theMesh,aMeshOnEntity,aFamily);
     }
   }
 
@@ -912,10 +933,11 @@ VISU_MEDConvertor::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
 
 //---------------------------------------------------------------
 int 
-VISU_MEDConvertor::LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
-                                       VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                                       VISU::PFieldImpl theField, 
-                                       VISU::PValForTimeImpl theValForTime)
+VISU_MEDConvertor
+::LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
+                      VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                      VISU::PFieldImpl theField, 
+                      VISU::PValForTimeImpl theValForTime)
 {
   //Main part of code
   int isPointsUpdated = LoadPoints(theMesh);
@@ -928,23 +950,16 @@ VISU_MEDConvertor::LoadValForTimeOnMesh(VISU::PMeshImpl theMesh,
 
 //---------------------------------------------------------------
 int 
-VISU_MEDConvertor::LoadPoints(VISU::PCMesh theMesh, 
-                             const string& theFamilyName)
+VISU_MEDConvertor
+::LoadPoints(VISU::PCMesh theMesh)
 {
   //Check on existing family
   PCMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
-  PCFamily aFamily = GetFamily(aMeshOnEntity,theFamilyName);
-
+  
   //Check on loading already done
   if(theMesh->myIsDone) 
-    if(!aFamily) 
-      return 0;
-    else if(!aFamily->myIsDone) 
-      return 0;
-
-  if(MYDEBUG) 
-    MESSAGE("LoadPoints - theFamilyName = '"<<theFamilyName<<"'");
-
+    return 0;
+  
   SALOME_MED::MESH_var& aMedMesh = theMesh->myMesh;
   int aDim = theMesh->myDim;
   TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
@@ -956,54 +971,64 @@ VISU_MEDConvertor::LoadPoints(VISU::PCMesh theMesh,
     throw std::runtime_error("LoadPoints >> There is no points in the mesh !!!");
 
   SALOME_MED::double_array_var aCCoord = aMedMesh->getCoordinates(SALOME_MED::MED_FULL_INTERLACE);
-  if(!theMesh->myIsDone){
-    for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++){
-      VISU::TCoordSlice aCoordSlice = aCoords.GetCoordSlice(iElem);
-      for(int iDim = 0; iDim < aDim; iDim++)
-       aCoordSlice[iDim] = aCCoord[anId++];
-    }
+  for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++){
+    VISU::TCoordSlice aCoordSlice = aCoords.GetCoordSlice(iElem);
+    for(int iDim = 0; iDim < aDim; iDim++)
+      aCoordSlice[iDim] = aCCoord[anId++];
+  }
+  
+  if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
+  
+  TCell2Connect& aCell2Connect = aMeshOnEntity->myGeom2Cell2Connect[VTK_VERTEX];
+  aCell2Connect.resize(aNbElem);
+  for(int iElem = 0; iElem < aNbElem; iElem++)
+    aCell2Connect[iElem] = TConnect(1,iElem);
+  
+  theMesh->myIsDone = true;
 
-    if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
+  return 1;
+}
 
-    TCell2Connect& aCell2Connect = aMeshOnEntity->myGeom2Cell2Connect[VTK_VERTEX];
-    aCell2Connect.resize(aNbElem);
-    for(int iElem = 0; iElem < aNbElem; iElem++)
-      aCell2Connect[iElem] = TConnect(1,iElem);
-    
-    theMesh->myIsDone = true;
-  }
 
-  if(aFamily){
-    if(!aFamily->myIsDone){
-      if(MYDEBUG) MESSAGE("LoadPoints - Filling aFamily Geom2SubMeshID");
-
-      SALOME_MED::FAMILY_var aMedFamily = aFamily->myFamily;
-      CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements();
-      TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[VTK_VERTEX];
-
-      if(!anIsOnAllElements){
-       SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
-       SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom[0]);
-       int aMaxElemId = aNbElem;
-       aNbElem = aCellNumForType->length();
-       for(int iElem = 0; iElem < aNbElem; iElem++){
-         int aTmp = aCellNumForType[iElem]-1;
-         if(0 > aTmp || aTmp >= aMaxElemId){
-           static QString aString;
-           aString.sprintf("LoadPoints - aMaxElemId(%d) <= aCellNumForType[%d]=%d < 0",aMaxElemId,iElem,aTmp);
-           throw std::runtime_error(aString.latin1());
-         }
-         aSubMeshID.push_back(aTmp);
-       }
-      }else{
-       for(int iElem = 0; iElem < aNbElem; iElem++){
-         aSubMeshID.push_back(iElem);
-       }
-      }
+//---------------------------------------------------------------
+int 
+VISU_MEDConvertor
+::LoadPointsOnFamily(VISU::PCMesh theMesh, 
+                    VISU::PCFamily theFamily)
+{
+  PCMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
 
-      aFamily->myIsDone = true;
+  if(theFamily->myIsDone) 
+    return 0;
+
+  TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
+  int aNbElem = aCoords.GetNbPoints();
+
+  SALOME_MED::FAMILY_var aMedFamily = theFamily->myFamily;
+  CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements();
+  TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VTK_VERTEX];
+  
+  if(!anIsOnAllElements){
+    SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
+    SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom[0]);
+    int aMaxElemId = aNbElem;
+    aNbElem = aCellNumForType->length();
+    for(int iElem = 0; iElem < aNbElem; iElem++){
+      int aTmp = aCellNumForType[iElem]-1;
+      if(0 > aTmp || aTmp >= aMaxElemId){
+       static QString aString;
+       aString.sprintf("LoadPointsOnFamily - aMaxElemId(%d) <= aCellNumForType[%d]=%d < 0",aMaxElemId,iElem,aTmp);
+       throw std::runtime_error(aString.latin1());
+      }
+      aSubMeshID.push_back(aTmp);
+    }
+  }else{
+    for(int iElem = 0; iElem < aNbElem; iElem++){
+      aSubMeshID.push_back(iElem);
     }
   }
+  
+  theFamily->myIsDone = true;
 
   return 1;
 }
@@ -1011,26 +1036,15 @@ VISU_MEDConvertor::LoadPoints(VISU::PCMesh theMesh,
 
 //---------------------------------------------------------------
 int 
-VISU_MEDConvertor::LoadCellsOnEntity(VISU::PCMesh theMesh,
-                                    VISU::PCMeshOnEntity theMeshOnEntity, 
-                                    const string& theFamilyName)
+VISU_MEDConvertor
+::LoadCellsOnEntity(VISU::PCMesh theMesh,
+                   VISU::PCMeshOnEntity theMeshOnEntity)
 {
-  //Check on existing family
-  PCFamily aFamily = GetFamily(theMeshOnEntity,theFamilyName);
-  //Check on loading already done
-  bool isCellsLoaded = !theMeshOnEntity->myGeom2Cell2Connect.empty();
-  if(isCellsLoaded) 
-    if(!aFamily) 
-      return 0;
-    else if(!aFamily->myGeom2SubMeshID.empty()) 
-      return 0;
+  if(theMeshOnEntity->myIsDone) 
+    return 0;
 
   SALOME_MED::SUPPORT_var& aMedSupport = theMeshOnEntity->mySupport;
   SALOME_MED::MESH_var aMedMesh = aMedSupport->getMesh();
-  if(MYDEBUG) {
-    MESSAGE("LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'");
-    MESSAGE("LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<bool(aFamily));
-  }
 
   //Main part of code
   SALOME_MED::medGeometryElement* aGeomElems;
@@ -1039,109 +1053,130 @@ VISU_MEDConvertor::LoadCellsOnEntity(VISU::PCMesh theMesh,
   const SALOME_MED::medEntityMesh& aMEntity = VTKEntityToMED(aVEntity);
   const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
   int aNbPoints = aCoords.GetNbPoints();
-  if(!isCellsLoaded){
-    for(int iGeom = 0, aCounter = 0; iGeom < iGeomEnd; iGeom++){
-      SALOME_MED::medGeometryElement aGeom = aGeomElems[iGeom];
-      int aMNbNodes = MEDGeom2NbNodes(aGeom);
-      int aVGeom = MEDGeomToVTK(aGeom);
-      int aVNbNodes = VTKGeom2NbNodes(aVGeom);
-      int iNumElemEnd = aMedMesh->getNumberOfElements(aMEntity,aGeom);
-      if (iNumElemEnd > 0) {
-       SALOME_MED::long_array_var conn = 
-         aMedMesh->getConnectivity(SALOME_MED::MED_FULL_INTERLACE,SALOME_MED::MED_NODAL,aMEntity,aGeom);
-       TCell2Connect& aCell2Connect = theMeshOnEntity->myGeom2Cell2Connect[aVGeom];
-       //APO - aCell2Connect.resize(iNumElemEnd);
-       vector<int> aConnect(aMNbNodes);
-       int aNbConnForElem = conn->length()/iNumElemEnd;
-       if(MYDEBUG) MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
-                           "; iNumElemEnd = "<<iNumElemEnd<<
-                           "; aNbConnForElem = "<<aNbConnForElem);
-       for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
-         VISU::TConnect anArray(aVNbNodes);
-         for (int k = 0, kj = iNumElem*aNbConnForElem; k < aMNbNodes; k++) {
-           aConnect[k] = conn[kj+k] - 1;
-         }
-         switch(aGeom){
-         case SALOME_MED::MED_TETRA4 :
-         case SALOME_MED::MED_TETRA10 :
-           anArray[0] = aConnect[0];
-           anArray[1] = aConnect[1];
-           anArray[2] = aConnect[3];  
-           anArray[3] = aConnect[2];  
-           break;
-         case SALOME_MED::MED_PYRA5 :
-         case SALOME_MED::MED_PYRA13 :
-           anArray[0] = aConnect[0];
-           anArray[1] = aConnect[3];  
-           anArray[2] = aConnect[2];
-           anArray[3] = aConnect[1];  
-           anArray[4] = aConnect[4];
-           break;
-         default:
-           for (int k = 0; k < aVNbNodes; k++) 
-             anArray[k] = aConnect[k];
-         }
+
+  for(int iGeom = 0, aCounter = 0; iGeom < iGeomEnd; iGeom++){
+    SALOME_MED::medGeometryElement aGeom = aGeomElems[iGeom];
+    int aMNbNodes = MEDGeom2NbNodes(aGeom);
+    int aVGeom = MEDGeomToVTK(aGeom);
+    int aVNbNodes = VTKGeom2NbNodes(aVGeom);
+    int iNumElemEnd = aMedMesh->getNumberOfElements(aMEntity,aGeom);
+    if (iNumElemEnd > 0) {
+      SALOME_MED::long_array_var conn = 
+       aMedMesh->getConnectivity(SALOME_MED::MED_FULL_INTERLACE,SALOME_MED::MED_NODAL,aMEntity,aGeom);
+      TCell2Connect& aCell2Connect = theMeshOnEntity->myGeom2Cell2Connect[aVGeom];
+      std::vector<int> aConnect(aMNbNodes);
+      int aNbConnForElem = conn->length()/iNumElemEnd;
+
+      if(MYDEBUG) MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
+                         "; iNumElemEnd = "<<iNumElemEnd<<
+                         "; aNbConnForElem = "<<aNbConnForElem);
+
+      for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++){
+       VISU::TConnect anArray(aVNbNodes);
+       for(int k = 0, kj = iNumElem*aNbConnForElem; k < aMNbNodes; k++)
+         aConnect[k] = conn[kj+k] - 1;
+
+       switch(aGeom){
+       case SALOME_MED::MED_TETRA4 :
+       case SALOME_MED::MED_TETRA10 :
+         anArray[0] = aConnect[0];
+         anArray[1] = aConnect[1];
+         anArray[2] = aConnect[3];  
+         anArray[3] = aConnect[2];  
+         break;
+       case SALOME_MED::MED_PYRA5 :
+       case SALOME_MED::MED_PYRA13 :
+         anArray[0] = aConnect[0];
+         anArray[1] = aConnect[3];  
+         anArray[2] = aConnect[2];
+         anArray[3] = aConnect[1];  
+         anArray[4] = aConnect[4];
+         break;
+       default:
          for (int k = 0; k < aVNbNodes; k++) 
-           if(anArray[k] < 0 || aNbPoints <= anArray[k]){
-             static QString aString;
-             aString.sprintf("ImportCells >> aNbPoints(%d) <= anArray[%d][%d]=%d < 0 !!!",aNbPoints,iNumElem,k,anArray[k]);
-             throw std::runtime_error(aString.latin1());
-           }
-         aCell2Connect.push_back(anArray);
+           anArray[k] = aConnect[k];
        }
-       //Workaround for MED Component data structure
-       int aSize = aCell2Connect.size();
-       theMeshOnEntity->myCellsFirstIndex[aGeom] = TCMeshOnEntity::TIndexAndSize(aCounter,aSize);
-       aCounter += aSize;
-      }
-    }
-  }
-  //Filling aFamily Geom2SubMeshID
-  if(aFamily){
-    SALOME_MED::FAMILY_var aMedFamily = aFamily->myFamily;
-    CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements();
-    if(!anIsOnAllElements){
-      SALOME_MED::medGeometryElement_array_var aGeoms = aMedFamily->getTypes();
-      iGeomEnd = aGeoms->length();
-      if(MYDEBUG) MESSAGE("LoadCellsOnEntity - iGeomEnd = "<<iGeomEnd);
-      for (int iGeom = 0; iGeom < iGeomEnd; iGeom++) {
-       SALOME_MED::medGeometryElement aGeom = aGeoms[iGeom];
-       SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom);
-       int aVGeom = MEDGeomToVTK(aGeom);
-       TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[aVGeom]; 
-       int iNumElemEndTmp = theMeshOnEntity->myGeom2Cell2Connect[aVGeom].size();
-       int iNumElemEnd = aCellNumForType->length();
-       int aCounter = theMeshOnEntity->myCellsFirstIndex[aGeom].first;
-       if(MYDEBUG) 
-         MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
-                 "; iNumElemEnd = "<<iNumElemEnd<<
-                 "; aCounter = "<<aCounter);
-       for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
-         int tmp = aCellNumForType[iNumElem]-aCounter-1;
-         if(0 > tmp || tmp >= iNumElemEndTmp) {
+       for (int k = 0; k < aVNbNodes; k++) 
+         if(anArray[k] < 0 || aNbPoints <= anArray[k]){
            static QString aString;
-           aString.sprintf("LoadCellsOnEntity >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEndTmp,iNumElem,tmp);
+           aString.sprintf("ImportCells >> aNbPoints(%d) <= anArray[%d][%d]=%d < 0 !!!",aNbPoints,iNumElem,k,anArray[k]);
            throw std::runtime_error(aString.latin1());
          }
-         aSubMeshID.push_back(tmp);
-       }
+       aCell2Connect.push_back(anArray);
       }
-    }else{
-      const TGeom2Cell2Connect& aCellsConn = theMeshOnEntity->myGeom2Cell2Connect;
-      TGeom2Cell2Connect::const_iterator aCellsConnIter = aCellsConn.begin();
-      for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
-       int aVGeom = aCellsConnIter->first;
-       const TCell2Connect& aCell2Connect = aCellsConnIter->second;
-       TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[aVGeom];
-       int iNumElemEnd = aCell2Connect.size();
-       for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
-         aSubMeshID.push_back(iNumElem);
+      //Workaround for MED Component data structure
+      int aSize = aCell2Connect.size();
+      theMeshOnEntity->myCellsFirstIndex[aGeom] = TCMeshOnEntity::TIndexAndSize(aCounter,aSize);
+      aCounter += aSize;
+    }
+  }
+
+  theMeshOnEntity->myIsDone = true;
+
+  return 1;
+}
+
+
+//---------------------------------------------------------------
+int 
+VISU_MEDConvertor
+::LoadCellsOnFamily(VISU::PCMesh theMesh,
+                   VISU::PCMeshOnEntity theMeshOnEntity, 
+                   VISU::PCFamily theFamily)
+{
+  if(theFamily->myIsDone) 
+    return 0;
+
+  SALOME_MED::FAMILY_var aMedFamily = theFamily->myFamily;
+  CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements();
+  if(!anIsOnAllElements){
+    SALOME_MED::medGeometryElement_array_var aGeoms = aMedFamily->getTypes();
+    int iGeomEnd = aGeoms->length();
+    if(MYDEBUG) MESSAGE("LoadCellsOnEntity - iGeomEnd = "<<iGeomEnd);
+    for(int iGeom = 0; iGeom < iGeomEnd; iGeom++){
+      SALOME_MED::medGeometryElement aGeom = aGeoms[iGeom];
+      SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom);
+      int aVGeom = MEDGeomToVTK(aGeom);
+      TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[aVGeom]; 
+      int iNumElemEndTmp = theMeshOnEntity->myGeom2Cell2Connect[aVGeom].size();
+      int iNumElemEnd = aCellNumForType->length();
+      int aCounter = theMeshOnEntity->myCellsFirstIndex[aGeom].first;
+      
+      if(MYDEBUG) 
+       MESSAGE("LoadCellsOnFamily "<<
+               "- aGeom = "<<aGeom<<
+               "; iNumElemEnd = "<<iNumElemEnd<<
+               "; aCounter = "<<aCounter);
+      
+      for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++){
+       int tmp = aCellNumForType[iNumElem]-aCounter-1;
+       if(0 > tmp || tmp >= iNumElemEndTmp){
+         static QString aString;
+         aString.sprintf("LoadCellsOnEntity >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEndTmp,iNumElem,tmp);
+         throw std::runtime_error(aString.latin1());
+       }
+       aSubMeshID.push_back(tmp);
       }
     }
+  }else{
+    const TGeom2Cell2Connect& aCellsConn = theMeshOnEntity->myGeom2Cell2Connect;
+    TGeom2Cell2Connect::const_iterator aCellsConnIter = aCellsConn.begin();
+    for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
+      int aVGeom = aCellsConnIter->first;
+      const TCell2Connect& aCell2Connect = aCellsConnIter->second;
+      TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[aVGeom];
+      int iNumElemEnd = aCell2Connect.size();
+      for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
+       aSubMeshID.push_back(iNumElem);
+    }
   }
+  
+  theFamily->myIsDone = true;
+
   return 1;
 }
 
+
 template<class TArray> 
 int 
 ImportField(TArray& theArray, 
index 6366a060d25c18245702ea2e63b699b966c24e6f..f6f3b7d790ec12a318a57a5c52851ca439d8b6a0 100644 (file)
@@ -112,8 +112,14 @@ class VISU_MEDConvertor: public VISU_Convertor_impl{
 
   virtual
   int
-  LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                  const std::string& theFamilyName = "");
+  LoadMeshOnEntity(VISU::PMeshImpl theMesh,
+                  VISU::PMeshOnEntityImpl theMeshOnEntity);
+  
+  virtual
+  int
+  LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
+                    VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                    VISU::PFamilyImpl theFamily);
   
   virtual
   int
@@ -136,13 +142,20 @@ class VISU_MEDConvertor: public VISU_Convertor_impl{
   {}
 
   int 
-  LoadPoints(VISU::PCMesh theMesh,
-            const std::string& theFamilyName = "") ;
+  LoadPoints(VISU::PCMesh theMesh) ;
+
+  int 
+  LoadPointsOnFamily(VISU::PCMesh theMesh, 
+                    VISU::PCFamily theFamily) ;
 
   int 
   LoadCellsOnEntity(VISU::PCMesh theMesh,
+                   VISU::PCMeshOnEntity theMeshOnEntity);
+  
+  int 
+  LoadCellsOnFamily(VISU::PCMesh theMesh,
                    VISU::PCMeshOnEntity theMeshOnEntity, 
-                   const std::string& theFamilyName = "");
+                   VISU::PCFamily theFamily);
   
   int 
   LoadField(VISU::PCMesh theMesh,
@@ -152,14 +165,20 @@ class VISU_MEDConvertor: public VISU_Convertor_impl{
 
 };
 
-class VISU_MEDFieldConvertor: public VISU_MEDConvertor{
+class VISU_MEDFieldConvertor: public VISU_MEDConvertor
+{
  protected:
   SALOME_MED::FIELD_var myField;
+
  public:
+
   VISU_MEDFieldConvertor(SALOME_MED::FIELD_ptr theField) : 
     myField(SALOME_MED::FIELD::_duplicate(theField)) 
   {}
-  virtual VISU_Convertor* Build() ;
+
+  virtual 
+  VISU_Convertor* 
+  Build();
 };
 
 extern "C" {