]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To support quadratic mesh elements
authorapo <apo@opencascade.com>
Tue, 4 Oct 2005 11:35:44 +0000 (11:35 +0000)
committerapo <apo@opencascade.com>
Tue, 4 Oct 2005 11:35:44 +0000 (11:35 +0000)
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/CONVERTOR/VISU_MedConvertor.cxx
src/VISU_I/VISU_CorbaMedConvertor.cxx

index dd489e35ac43eb37cc25d90e4bb48f70fbcab86e..8609f12fe041c5ac5ffb70d865a6134059d797f7 100644 (file)
@@ -65,8 +65,6 @@ static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
 #endif
 
-//#define ENABLE_QUADRATIC
-
 namespace VISU
 {
   //---------------------------------------------------------------
@@ -837,6 +835,22 @@ namespace VISU
   VISUGeom2NbNodes(EGeometry theGeom)
   { 
     switch(theGeom){
+#ifndef VISU_ENABLE_QUADRATIC
+    case VISU::eSEG3: 
+      return 2;
+    case VISU::eTRIA6: 
+      return 3;
+    case VISU::eQUAD8: 
+      return 4;
+    case VISU::eTETRA10: 
+      return 4;
+    case VISU::eHEXA20: 
+      return 8;
+    case VISU::ePENTA15: 
+      return 6;
+    case VISU::ePYRA13: 
+      return 5;
+#endif
     case VISU::ePOLYGONE: 
     case VISU::ePOLYEDRE: 
       return -1;
@@ -871,7 +885,7 @@ namespace VISU
     case VISU::ePOLYEDRE: 
       return VTK_CONVEX_POINT_SET;
 
-#ifndef ENABLE_QUADRATIC
+#ifndef VISU_ENABLE_QUADRATIC
     case VISU::eSEG3: 
       return VTK_LINE;
     case VISU::eTRIA6: 
@@ -890,55 +904,55 @@ namespace VISU
 #else
 
     case VISU::eSEG3: 
-#ifdef VTK_QUADRATIC_EDGE
+#if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)
       return VTK_QUADRATIC_EDGE;
 #else
       return VTK_POLY_LINE;
 #endif
 
     case VISU::eTRIA6: 
-#ifdef VTK_QUADRATIC_TRIANGLE
+#if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)
       return VTK_QUADRATIC_TRIANGLE;
 #else
       return VTK_POLYGON;
 #endif
 
     case VISU::eQUAD8: 
-#ifdef VTK_QUADRATIC_QUAD
+#if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)
       return VTK_QUADRATIC_QUAD;
 #else
       return VTK_POLYGON;
 #endif
 
     case VISU::eTETRA10: 
-#ifdef VTK_QUADRATIC_TETRA
+#if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)
       return VTK_QUADRATIC_QUAD;
 #else
       return VTK_CONVEX_POINT_SET;
 #endif
 
     case VISU::eHEXA20: 
-#ifdef VTK_QUADRATIC_HEXAHEDRON
+#if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC)
       return VTK_QUADRATIC_HEXAHEDRON;
 #else
       return VTK_CONVEX_POINT_SET;
 #endif
 
     case VISU::ePENTA15: 
-#ifdef VTK_QUADRATIC_WEDGE
+#if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC)
       return VTK_QUADRATIC_WEDGE;
 #else
       return VTK_CONVEX_POINT_SET;
 #endif
 
     case VISU::ePYRA13: 
-#ifdef VTK_QUADRATIC_PYRAMID
+#if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)
       return VTK_QUADRATIC_PYRAMID;
 #else
       return VTK_CONVEX_POINT_SET;
 #endif
 
-#endif //ENABLE_QUADRATIC
+#endif //VISU_ENABLE_QUADRATIC
 
     default:
       return -1;
@@ -1201,6 +1215,7 @@ namespace
     for(vtkIdType i = 0, j = 0; anIter != aGeom2SubMesh.end(); anIter++){
       VISU::EGeometry aEGeom = anIter->first;
       vtkIdType aVGeom = VISUGeom2VTK(aEGeom);
+
       const VISU::TSubMeshImpl& aSubMesh = anIter->second;
       const VISU::TCell2Connect& anArray = aSubMesh.myCell2Connect;
 
@@ -1214,7 +1229,9 @@ namespace
 
       const VISU::TSubMeshID& aSubMeshID = aGeom2SubMeshIDIter->second;
 
-      INITMSG(MYDEBUG,"aEGeom = "<<aEGeom<<
+      INITMSG(MYDEBUG,
+             " - aEGeom = "<<aEGeom<<
+             "; aVGeom = "<<aVGeom<<
              "; aSubMeshID.size() = "<<aSubMeshID.size()<<
              endl);
 
@@ -1278,6 +1295,7 @@ namespace
 
     int aNbComp = theField->myNbComp;
     vtkFloatArray *aFloatArray = vtkFloatArray::New();
+
     switch(aNbComp) {
     case 1:
       aFloatArray->SetNumberOfComponents(1);
@@ -1293,12 +1311,12 @@ namespace
     vtkFloatArray *aDataArray = vtkFloatArray::New();
     aDataArray->SetNumberOfComponents(aNbComp);
     aDataArray->SetNumberOfTuples(aNbTuples);
-    aDataSetAttributes->AddArray(aDataArray);
     aDataArray->SetName("VISU_FIELD");
+    aDataSetAttributes->AddArray(aDataArray);
 
     TGeom2Value& aGeom2Value = theValForTime->myGeom2Value;
     TGeom2Value::const_iterator anIter = aGeom2Value.begin();
-    TVector<float> aDataValues(aNbComp);
+    TVector<float> aDataValues(aNbComp,0.0);
     for(int aTupleId = 0; anIter != aGeom2Value.end(); anIter++){
       EGeometry aEGeom = anIter->first;
       const TMeshValue& aMeshValue = anIter->second;
@@ -1313,7 +1331,7 @@ namespace
              endl);
 
       int aNbComp2 = aNbComp;
-      if(aNbComp == 2 || aNbComp == 4)
+      if(aNbComp == 4)
        aNbComp2 = 2;
       else if(aNbComp > 4)
        aNbComp2 = 3;
@@ -1350,6 +1368,8 @@ namespace
     vtkIdType aNbNodes = VISUGeom2NbNodes(aEGeom);
     vtkIdType aVGeom = VISUGeom2VTK(aEGeom);
 
+    INITMSG(MYDEBUG,"GetCells - aVGeom = "<<aVGeom<<endl);
+
     const TSubMeshID& aSubMeshID = theSubProfile->mySubMeshID;
 
     const VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
@@ -1514,18 +1534,17 @@ namespace
     vtkFloatArray *aDataArray = vtkFloatArray::New();
     aDataArray->SetNumberOfComponents(aNbComp);
     aDataArray->SetNumberOfTuples(aNbTuples);
-    aDataSetAttributes->AddArray(aDataArray);
     aDataArray->SetName("VISU_FIELD");
+    aDataSetAttributes->AddArray(aDataArray);
 
     const TGeom2Value& aGeom2Value = theValForTime->myGeom2Value;
 
     PGaussMeshImpl aGaussMesh = theValForTime->myGaussMesh;
     const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
     TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
-    TVector<float> aDataValues(aNbComp);
+    TVector<float> aDataValues(aNbComp,0.0);
     for(int aTupleId = 0; anIter != aGeom2GaussSubMesh.end(); anIter++){
       EGeometry aEGeom = anIter->first;
-      vtkIdType aVGeom = VISUGeom2VTK(aEGeom);
 
       PGaussSubMeshImpl aGaussSubMesh = anIter->second;
       if(!aGaussSubMesh->myIsDone)
@@ -1551,7 +1570,7 @@ namespace
              endl);
 
       int aNbComp2 = aNbComp;
-      if(aNbComp == 2 || aNbComp == 4)
+      if(aNbComp == 4)
        aNbComp2 = 2;
       else if(aNbComp > 4)
        aNbComp2 = 3;
index ad742b6a0435602f582cba6f46c2220b1321e656..4418d0b4602af092a64d94147ae2f739a30a3918 100644 (file)
@@ -22,6 +22,11 @@ class VTKViewer_AppendFilter;
 #include "VISU_Convertor.hxx"
 #include "MED_SliceArray.hxx"
 
+#ifndef VISU_ENABLE_QUADRATIC
+#define VISU_ENABLE_QUADRATIC
+#define VISU_USE_VTK_QUADRATIC
+#endif
+
 namespace VISU
 {
   enum EGeometry {ePOINT1=1, eSEG2=102, eSEG3=103, eTRIA3=203,
index 34b94fb0d8aee2286d6b8ca9ea9d20b24b0879be..9cb56ad7903c5e1cd536fb26a17fd322a888ac09 100644 (file)
@@ -67,8 +67,6 @@ static int MY_GROUP_DEBUG = 0;
 #define _EDF_NODE_IDS_
 #define _NAME_MAPPING_ 0
 
-//#define ENABLE_QUADRATIC
-
 namespace
 {
   //---------------------------------------------------------------
@@ -1625,7 +1623,7 @@ VISU_MedConvertor
            }
            
            switch(aMGeom){
-#ifndef VTK_QUADRATIC_EDGE && ENABLE_QUADRATIC
+#if !(defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
            case MED::eSEG3:
              anArray[0] = aConnect[0];
              anArray[2] = aConnect[1];  
@@ -1633,7 +1631,7 @@ VISU_MedConvertor
              anArray[1] = aConnect[2];
              break;
 #endif
-#ifndef VTK_QUADRATIC_TRIANGLE && ENABLE_QUADRATIC
+#if !(defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
            case MED::eTRIA6:
              anArray[0] = aConnect[0];
              anArray[2] = aConnect[1];  
@@ -1644,7 +1642,7 @@ VISU_MedConvertor
              anArray[5] = aConnect[5];  
              break;
 #endif
-#ifndef VTK_QUADRATIC_QUAD && ENABLE_QUADRATIC
+#if !(defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
            case MED::eQUAD8:
              anArray[0] = aConnect[0];
              anArray[2] = aConnect[1];  
@@ -1657,7 +1655,7 @@ VISU_MedConvertor
              anArray[7] = aConnect[7];  
              break;
 #endif
-#ifdef VTK_QUADRATIC_TETRA && ENABLE_QUADRATIC
+#if (defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
            case MED::eTETRA10:
 #endif
            case MED::eTETRA4:
@@ -1666,7 +1664,7 @@ VISU_MedConvertor
              anArray[2] = aConnect[3];  
              anArray[3] = aConnect[2];  
              break;
-#ifdef VTK_QUADRATIC_TETRA && ENABLE_QUADRATIC
+#if (defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
            case MED::ePYRA13:
 #endif
            case MED::ePYRA5:
index 7da437c1ff838261ef238803cdded1dc48bf3e9e..5457ae9c19cb3ba3536bbddb2693f483dec4281e 100644 (file)
@@ -1075,12 +1075,15 @@ VISU_MEDConvertor
          aConnect[k] = conn[kj+k] - 1;
 
        switch(aMGeom){
+#if !(defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
        case SALOME_MED::MED_SEG3:
          anArray[0] = aConnect[0];
          anArray[2] = aConnect[1];  
          
          anArray[1] = aConnect[2];
          break;
+#endif
+#if !(defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
        case SALOME_MED::MED_TRIA6:
          anArray[0] = aConnect[0];
          anArray[2] = aConnect[1];  
@@ -1090,6 +1093,8 @@ VISU_MEDConvertor
          anArray[3] = aConnect[4];  
          anArray[5] = aConnect[5];  
          break;
+#endif
+#if !(defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
        case SALOME_MED::MED_QUAD8:
          anArray[0] = aConnect[0];
          anArray[2] = aConnect[1];  
@@ -1101,13 +1106,20 @@ VISU_MEDConvertor
          anArray[5] = aConnect[6];  
          anArray[7] = aConnect[7];  
          break;
+#endif
+#if (defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+       case SALOME_MED::MED_TETRA10 :
+#endif
        case SALOME_MED::MED_TETRA4 :
          anArray[0] = aConnect[0];
          anArray[1] = aConnect[1];
          anArray[2] = aConnect[3];  
          anArray[3] = aConnect[2];  
          break;
-       case SALOME_MED::MED_PYRA13 :
+#if (defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+       case SALOME_MED::MED_PYRA13:
+#endif
+       case SALOME_MED::MED_PYRA5 :
          anArray[0] = aConnect[0];
          anArray[1] = aConnect[3];  
          anArray[2] = aConnect[2];