]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
0020643: Wrong behavior with a structured field V5_1_main_20100126 V5_1_main_20100127
authoreap <eap@opencascade.com>
Mon, 25 Jan 2010 14:35:12 +0000 (14:35 +0000)
committereap <eap@opencascade.com>
Mon, 25 Jan 2010 14:35:12 +0000 (14:35 +0000)
  * Support fields on sub-cells of a structured mesh

src/CONVERTOR/VISU_MedConvertor.cxx

index 46155e840355123c12438722faed137119fed647..457fde69d2a28dbe5a76b76fc6f9f28778b81b08 100644 (file)
@@ -703,7 +703,7 @@ namespace
               "- aMEntity = "<<aMEntity<<
               "; aVEntity = "<<aVEntity<<
               endl);
-      
+
       if(aMEntity == MED::eNOEUD){
         aMeshOnEntity->myNbCells = theGrilleInfo->GetNbNodes();
         aMeshOnEntity->myCellsSize = 2*theGrilleInfo->GetNbNodes();
@@ -711,18 +711,18 @@ namespace
         VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[MED::ePOINT1];
 
         if((theGrilleInfo->myFamNumNode).size() > 0)
-        for(TInt iElem = 0; iElem < theGrilleInfo->GetNbNodes(); iElem++){
-          TInt aFamId = theGrilleInfo->GetFamNumNode(iElem);
-          if(aFamId != 0)
-            aFamilyID2CellsSize[aFamId] += 2;
-          anElemID2FamilyID[iElem] = aFamId;
-        }
-        
+          for(TInt iElem = 0; iElem < theGrilleInfo->GetNbNodes(); iElem++){
+            TInt aFamId = theGrilleInfo->GetFamNumNode(iElem);
+            if(aFamId != 0)
+              aFamilyID2CellsSize[aFamId] += 2;
+            anElemID2FamilyID[iElem] = aFamId;
+          }
+
         INITMSG(MYDEBUG,
                 "- myNbCells = "<<aMeshOnEntity->myNbCells<<
                 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
                 endl);;
-        
+
       } else {
         MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
         aMeshOnEntity->myNbCells = 0;
@@ -736,21 +736,23 @@ namespace
           aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
 
           VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
-          
+
           INITMSG(MYDEBUG,
                   "- aMGeom = "<<aMGeom<<
                   "; aNbElem = "<<aNbElem<<
                   "; myNbCells = "<<aMeshOnEntity->myNbCells<<
                   "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
                   endl);
-          
-          if((theGrilleInfo->myFamNum).size() > 0)
-          for(TInt iElem = 0; iElem < aNbElem; iElem++){
-            TInt aFamId = theGrilleInfo->GetFamNum(iElem);
-            if(aFamId != 0)
-              aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
-            anElemID2FamilyID[iElem] = aFamId;
-          }
+
+          MED::TElemNum& famNums =
+            (aMEntity == MED::eMAILLE) ? theGrilleInfo->myFamNum : theGrilleInfo->myFamSubNum;
+          if (famNums.size() == aNbElem)
+            for(TInt iElem = 0; iElem < aNbElem; iElem++){
+              TInt aFamId = famNums[iElem];
+              if(aFamId != 0)
+                aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
+              anElemID2FamilyID[iElem] = aFamId;
+            }
         }
       }
     }
@@ -1487,6 +1489,7 @@ VISU_MedConvertor
         MED::TEntityInfo anEntityInfo;
         anEntityInfo[MED::eNOEUD][MED::ePOINT1] = aGrilleInfo->GetNbNodes();
         anEntityInfo[aGrilleInfo->GetEntity()][aGrilleInfo->GetGeom()] = aGrilleInfo->GetNbCells();
+        anEntityInfo[aGrilleInfo->GetSubEntity()][aGrilleInfo->GetSubGeom()] = aGrilleInfo->GetNbSubCells();
         
         aMesh->myNbPoints   = aGrilleInfo->GetNbNodes();
         aMesh->myEntityInfo = anEntityInfo;
@@ -2404,7 +2407,7 @@ VISU_MedConvertor
             VISU::TVector<TInt> aConnect(aMNbNodes);
             
             for(TInt iElem = 0; iElem < aNbElem; iElem++) {
-              MED::TIntVector aConn = aGrilleInfo->GetConn(iElem);
+              MED::TIntVector aConn = aGrilleInfo->GetConn(iElem, theMeshOnEntity->myEntity != VISU::CELL_ENTITY);
               VISU::TConnect& anArray = aCell2Connect[iElem];
               anArray.resize(aVNbNodes);