]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To fix regressions in CORBA MED converter
authorapo <apo@opencascade.com>
Mon, 10 Oct 2005 05:46:29 +0000 (05:46 +0000)
committerapo <apo@opencascade.com>
Mon, 10 Oct 2005 05:46:29 +0000 (05:46 +0000)
src/VISU_I/VISU_CorbaMedConvertor.cxx
src/VISU_I/VISU_CorbaMedConvertor.hxx

index 5457ae9c19cb3ba3536bbddb2693f483dec4281e..78d2d2873a412da178d51ce1bc716eba0c729409 100644 (file)
@@ -39,7 +39,7 @@ using namespace VISU;
 #define USER_INTERLACE MED_FULL_INTERLACE
 
 #ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
 #else
 static int MYDEBUG = 0;
 #endif
@@ -633,6 +633,7 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
            aFamily->myNbCells = aNbCells;
            aFamily->myCellsSize = aCellsSize;
            aFamily->myId = aMEDFamily->getIdentifier();
+           aFamily->myName = aSupportName.in();
            aFamily->myFamily = aMEDFamily;
          }
        }
@@ -816,17 +817,20 @@ VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator)
     aMeshOnEntity->myEntity = aVEntity;
     aMeshOnEntity->myMeshName = aMeshName.in();
     aMeshOnEntity->mySupport = aMEDSupport;
+
+    PCMeshOnEntity aMeshOnEntity2;
     if(aVEntity == NODE_ENTITY){
-      PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[CELL_ENTITY](new TCMeshOnEntity());
-      *aMeshOnEntity2 = *aMeshOnEntity;
-      aMeshOnEntity->myEntity = CELL_ENTITY;
-      GetCellsSize(aMesh,aMEDMesh,CELL_ENTITY);
+      aMeshOnEntity2 = aMeshOnEntityMap[CELL_ENTITY](new TCMeshOnEntity());
+      aMeshOnEntity2->myEntity = CELL_ENTITY;
     }else{
-      PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[NODE_ENTITY](new TCMeshOnEntity());
-      *aMeshOnEntity2 = *aMeshOnEntity;
-      aMeshOnEntity->myEntity = NODE_ENTITY;
-      GetCellsSize(aMesh,aMEDMesh,NODE_ENTITY);
+      aMeshOnEntity2 = aMeshOnEntityMap[NODE_ENTITY](new TCMeshOnEntity());
+      aMeshOnEntity2->myEntity = NODE_ENTITY;
     }
+
+    aMeshOnEntity2->myMeshName = aMeshName.in();
+    aMeshOnEntity2->mySupport = aMEDSupport;
+    GetCellsSize(aMesh,aMEDMesh,aMeshOnEntity2->myEntity);
+
     GetCellsSize(aMesh,aMEDMesh,aVEntity);
     TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
     TFieldMap::iterator aFieldMapIter = aFieldMap.find(aFieldName.in());
@@ -973,7 +977,11 @@ VISU_MEDConvertor
   if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
   
   TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
-  PSubMeshImpl aSubMesh = aGeom2SubMesh[VISU::ePOINT1];
+  PSubMeshImpl aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TCSubMesh());
+
+  aSubMesh->myNbCells = theMesh->myNbPoints;
+  aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
+
   TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
   aCell2Connect.resize(aNbElem);
   for(int iElem = 0; iElem < aNbElem; iElem++)
@@ -1053,25 +1061,31 @@ VISU_MEDConvertor
   for(int iGeom = 0, aCounter = 0; iGeom < iGeomEnd; iGeom++){
     SALOME_MED::medGeometryElement aMGeom = aGeomElems[iGeom];
     int aMNbNodes = MEDGeom2NbNodes(aMGeom);
-    VISU::EGeometry aEGeom = MEDGeom2VISU(aEGeom);
+    VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
     int aVNbNodes = VISUGeom2NbNodes(aEGeom);
-    int iNumElemEnd = aMedMesh->getNumberOfElements(aMEntity,aMGeom);
-    if (iNumElemEnd > 0) {
+    int aNbElem = aMedMesh->getNumberOfElements(aMEntity,aMGeom);
+    if (aNbElem > 0) {
       using namespace SALOME_MED;
       SALOME_MED::long_array_var conn = 
        aMedMesh->getConnectivity(MED_FULL_INTERLACE,MED_NODAL,aMEntity,aMGeom);
-      PSubMeshImpl aSubMesh = aGeom2SubMesh[aEGeom];
+      PSubMeshImpl aSubMesh = aGeom2SubMesh[aEGeom](new TCSubMesh());
+
+      aSubMesh->myNbCells = aNbElem;      
+      aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
+
       TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
       std::vector<int> aConnect(aMNbNodes);
-      int aNbConnForElem = conn->length()/iNumElemEnd;
+      int aNbConnForElem = conn->length()/aNbElem;
 
       if(MYDEBUG) MESSAGE("LoadCellsOnEntity - aMGeom = "<<aMGeom<<
-                         "; iNumElemEnd = "<<iNumElemEnd<<
+                         "; aNbElem = "<<aNbElem<<
+                         "; aMNbNodes = "<<aMNbNodes<<
+                         "; aVNbNodes = "<<aVNbNodes<<
                          "; aNbConnForElem = "<<aNbConnForElem);
 
-      for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++){
+      for(int iElem = 0; iElem < aNbElem; iElem++){
        VISU::TConnect anArray(aVNbNodes);
-       for(int k = 0, kj = iNumElem*aNbConnForElem; k < aMNbNodes; k++)
+       for(int k = 0, kj = iElem*aNbConnForElem; k < aMNbNodes; k++)
          aConnect[k] = conn[kj+k] - 1;
 
        switch(aMGeom){
@@ -1133,7 +1147,7 @@ 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,iNumElem,k,anArray[k]);
+           aString.sprintf("ImportCells >> aNbPoints(%d) <= anArray[%d][%d]=%d < 0 !!!",aNbPoints,iElem,k,anArray[k]);
            throw std::runtime_error(aString.latin1());
          }
        aCell2Connect.push_back(anArray);
@@ -1287,17 +1301,21 @@ ImportField(TArray& theArray,
 }
 
 int
-VISU_MEDConvertor::LoadField(VISU::PCMesh theMesh,
-                            VISU::PCMeshOnEntity theMeshOnEntity,
-                            VISU::PField theField, 
-                            VISU::PCValForTime theValForTime)
+VISU_MEDConvertor
+::LoadField(VISU::PCMesh theMesh,
+           VISU::PCMeshOnEntity theMeshOnEntity,
+           VISU::PField theField, 
+           VISU::PCValForTime theValForTime)
 {
   //Check on loading already done
-  PProfileImpl aProfile = theValForTime->myProfile;
-  TSource& aMeshSource = aProfile->mySource;
-  if(aMeshSource.myIsDone) 
+  PIDMapperFilter anIDMapperFilter = theValForTime->myIDMapperFilter;
+  if(anIDMapperFilter->myIsVTKDone) 
     return 0;
   
+  PCProfile aProfile(new TCProfile());
+  aProfile->myIsAll = true;
+  theValForTime->myProfile = aProfile;
+
   SALOME_MED::FIELD_var aMEDField = theValForTime->myField;
   SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField);
   if(!aFieldDouble->_is_nil()){
@@ -1312,7 +1330,7 @@ VISU_MEDConvertor::LoadField(VISU::PCMesh theMesh,
     ::ImportField(anArray,theMesh,theField,theValForTime,theMeshOnEntity);
   }
 
-  aMeshSource.myIsDone = true;
+  anIDMapperFilter->myIsVTKDone = true;
 
   return 1;
 }
index b0282c7514cd83c3100fb5ef31620f318ec4ef41..f4a975aae5375fef6d5f5732e19851e73ad7a6e3 100644 (file)
@@ -45,6 +45,18 @@ namespace VISU
   typedef SharedPtr<TCMesh> PCMesh;
 
 
+  //---------------------------------------------------------------
+  struct TCProfile: virtual TProfileImpl
+  {};
+  typedef SharedPtr<TCProfile> PCProfile;
+
+
+  //---------------------------------------------------------------
+  struct TCSubMesh: virtual TSubMeshImpl
+  {};
+  typedef SharedPtr<TCSubMesh> PCSubMesh;
+
+
   //---------------------------------------------------------------
   struct TCMeshOnEntity: virtual TMeshOnEntityImpl
   {
@@ -139,7 +151,9 @@ class VISU_MEDConvertor: public VISU_Convertor_impl{
                           VISU::PMeshOnEntityImpl theMeshOnEntity, 
                           VISU::PFieldImpl theField, 
                           VISU::PValForTimeImpl theValForTime)
-  {}
+  {
+    return 0;
+  }
 
   int 
   LoadPoints(VISU::PCMesh theMesh) ;