]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug IPAL11452
authorapo <apo@opencascade.com>
Thu, 2 Feb 2006 12:57:34 +0000 (12:57 +0000)
committerapo <apo@opencascade.com>
Thu, 2 Feb 2006 12:57:34 +0000 (12:57 +0000)
  REGRESS of the presentations on groups after explore MED
(we should call LoadCellsOnEntity before calling the LoadCellsOnFamily)

src/VISU_I/VISU_CorbaMedConvertor.cxx

index 629ba8fa69e26bb6358ca740d2df90a645cc509c..b1dc814ba896de75545557e01071e18aaacccbbc 100644 (file)
@@ -901,16 +901,12 @@ VISU_MEDConvertor
 ::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
                   VISU::PMeshOnEntityImpl theMeshOnEntity)
 {
+  int anIsUpdated = LoadPoints(theMesh);
   const TEntity& aVEntity = theMeshOnEntity->myEntity;
-  int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
-  if(aVEntity == NODE_ENTITY) 
-    isPointsUpdated += LoadPoints(theMesh);
-  else{
-    isPointsUpdated += LoadPoints(theMesh);
-    isCellsOnEntityUpdated += LoadCellsOnEntity(theMesh,theMeshOnEntity);
-  }
+  if(aVEntity != NODE_ENTITY)
+    anIsUpdated |= LoadCellsOnEntity(theMesh,theMeshOnEntity);
 
-  return (isPointsUpdated || isCellsOnEntityUpdated);
+  return anIsUpdated;
 }
  
  
@@ -921,16 +917,16 @@ VISU_MEDConvertor
                     VISU::PMeshOnEntityImpl theMeshOnEntity, 
                     VISU::PFamilyImpl theFamily)
 {
+  int anIsUpdated = LoadPoints(theMesh);
   const TEntity& anEntity = theMeshOnEntity->myEntity;
-  int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
   if(anEntity == NODE_ENTITY){
-    isPointsUpdated += LoadPointsOnFamily(theMesh,theFamily);
+    anIsUpdated |= LoadPointsOnFamily(theMesh,theFamily);
   }else{
-    isPointsUpdated += LoadPoints(theMesh);
-    isCellsOnEntityUpdated += LoadCellsOnFamily(theMesh,theMeshOnEntity,theFamily);
+    anIsUpdated |= LoadCellsOnEntity(theMesh,theMeshOnEntity);
+    anIsUpdated |= LoadCellsOnFamily(theMesh,theMeshOnEntity,theFamily);
   }
 
-  return (isPointsUpdated || isCellsOnEntityUpdated);
+  return anIsUpdated;
 }
 
 
@@ -941,23 +937,21 @@ VISU_MEDConvertor
                  const VISU::TFamilySet& theFamilySet)
 {
   //Main part of code
-  int isPointsUpdated = 0;
-  int isCellsOnEntityUpdated = 0;
+  int anIsUpdated = LoadPoints(theMesh);
   TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
   for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){
     PCFamily aFamily = *aFamilyIter;
     const VISU::TEntity& aVEntity = aFamily->myEntity;
     PCMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
     if(aVEntity == VISU::NODE_ENTITY){
-      isPointsUpdated += LoadPointsOnFamily(theMesh,aFamily);
-      isCellsOnEntityUpdated += LoadCellsOnEntity(theMesh,aMeshOnEntity);
+      anIsUpdated |= LoadPointsOnFamily(theMesh,aFamily);
     }else{
-      isPointsUpdated += LoadPoints(theMesh);
-      isCellsOnEntityUpdated += LoadCellsOnFamily(theMesh,aMeshOnEntity,aFamily);
+      anIsUpdated |= LoadCellsOnEntity(theMesh,aMeshOnEntity);
+      anIsUpdated |= LoadCellsOnFamily(theMesh,aMeshOnEntity,aFamily);
     }
   }
 
-  return (isPointsUpdated || isCellsOnEntityUpdated);
+  return anIsUpdated;
 }
 
 
@@ -970,11 +964,14 @@ VISU_MEDConvertor
                       VISU::PValForTimeImpl theValForTime)
 {
   //Main part of code
-  int isPointsUpdated = LoadPoints(theMesh);
-  int isCellsOnEntityUpdated = LoadCellsOnEntity(theMesh,theMeshOnEntity);
-  int isFieldUpdated = LoadField(theMesh,theMeshOnEntity,theField,theValForTime);
+  int anIsUpdated = LoadPoints(theMesh);
+  const TEntity& aVEntity = theMeshOnEntity->myEntity;
+  if(aVEntity != NODE_ENTITY)
+    anIsUpdated |= LoadCellsOnEntity(theMesh,theMeshOnEntity);
+
+  anIsUpdated |= LoadField(theMesh,theMeshOnEntity,theField,theValForTime);
   
-  return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
+  return anIsUpdated;
 }
 
 
@@ -1047,16 +1044,16 @@ VISU_MEDConvertor
   if(!anIsOnAllElements){
     SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
     SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom[0]);
-    int aMaxElemId = aNbElem;
+    int aSize = aNbElem;
     aNbElem = aCellNumForType->length();
     for(int iElem = 0; iElem < aNbElem; iElem++){
-      int aTmp = aCellNumForType[iElem]-1;
-      if(0 > aTmp || aTmp >= aMaxElemId){
+      int anID = aCellNumForType[iElem] - 1;
+      if(0 > anID || anID >= aSize){
        static QString aString;
-       aString.sprintf("LoadPointsOnFamily - aMaxElemId(%d) <= aCellNumForType[%d]=%d < 0",aMaxElemId,iElem,aTmp);
+       aString.sprintf("LoadPointsOnFamily - aSize(%d) <= aCellNumForType[%d] = %d < 0",aSize,iElem,anID);
        throw std::runtime_error(aString.latin1());
       }
-      aSubMeshID.push_back(aTmp);
+      aSubMeshID.push_back(anID);
     }
   }else{
     for(int iElem = 0; iElem < aNbElem; iElem++){
@@ -1180,13 +1177,14 @@ VISU_MEDConvertor
        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,iElem,k,anArray[k]);
+           aString.sprintf("LoadCellsOnEntity >> aNbPoints(%d) <= anArray[%d][%d]=%d < 0 !!!",aNbPoints,iElem,k,anArray[k]);
            throw std::runtime_error(aString.latin1());
          }
        aCell2Connect.push_back(anArray);
       }
       //Workaround for MED Component data structure
       int aSize = aCell2Connect.size();
+      if(MYDEBUG) MESSAGE("LoadCellsOnEntity - aCounter = "<<aCounter<<"; aSize = "<<aSize);
       theMeshOnEntity->myCellsFirstIndex[aMGeom] = TCMeshOnEntity::TIndexAndSize(aCounter,aSize);
       aCounter += aSize;
     }
@@ -1214,39 +1212,32 @@ VISU_MEDConvertor
   if(!anIsOnAllElements){
     SALOME_MED::medGeometryElement_array_var aGeoms = aMedFamily->getTypes();
     int iGeomEnd = aGeoms->length();
-    if(MYDEBUG) MESSAGE("LoadCellsOnEntity - iGeomEnd = "<<iGeomEnd);
+    if(MYDEBUG) MESSAGE("LoadCellsOnFamily - iGeomEnd = "<<iGeomEnd);
     for(int iGeom = 0; iGeom < iGeomEnd; iGeom++){
       SALOME_MED::medGeometryElement aMGeom = aGeoms[iGeom];
       SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aMGeom);
       VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
 
-      int iNumElemEndTmp = 0;
-      TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.find(aEGeom);
-      if(anIter != aGeom2SubMesh.end()){
-       const VISU::TSubMeshImpl& aSubMesh = anIter->second;
-       const VISU::TCell2Connect& anArray = aSubMesh.myCell2Connect;
-       iNumElemEndTmp = anArray.size();
-      }
-
-      TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[aEGeom]; 
-
-      int iNumElemEnd = aCellNumForType->length();
+      int aNbElem = aCellNumForType->length();
       int aCounter = theMeshOnEntity->myCellsFirstIndex[aMGeom].first;
+      int aSize = theMeshOnEntity->myCellsFirstIndex[aMGeom].second;
+      TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[aEGeom]; 
       
       if(MYDEBUG) 
        MESSAGE("LoadCellsOnFamily "<<
                "- aMGeom = "<<aMGeom<<
-               "; iNumElemEnd = "<<iNumElemEnd<<
+               "; aNbElem = "<<aNbElem<<
+               "; aSize = "<<aSize<<
                "; aCounter = "<<aCounter);
       
-      for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++){
-       int tmp = aCellNumForType[iNumElem]-aCounter-1;
-       if(0 > tmp || tmp >= iNumElemEndTmp){
+      for(int iElem = 0; iElem < aNbElem; iElem++){
+       int anID = aCellNumForType[iElem] - aCounter - 1;
+       if(0 > anID || anID >= aSize){
          static QString aString;
-         aString.sprintf("LoadCellsOnEntity >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEndTmp,iNumElem,tmp);
+         aString.sprintf("LoadCellsOnFamily - aNbElem(%d) <= aCellNumForType[%d] = %d < 0 !!!",aNbElem,iElem,anID);
          throw std::runtime_error(aString.latin1());
        }
-       aSubMeshID.push_back(tmp);
+       aSubMeshID.push_back(anID);
       }
     }
   }else{