Salome HOME
Roll-back previous integration
[modules/visu.git] / src / CONVERTOR / VISU_Convertor.cxx
index 82f2463dbc06b5f78cd7bcdc0bf0e8515d112f86..c9dbdb411965af4cae63cf3fa3e6e7890203226b 100644 (file)
@@ -27,8 +27,6 @@
 #include "VISU_Convertor.hxx"
 #include "VISU_ConvertorUtils.hxx"
 
-#include <vtkUnstructuredGridWriter.h>
-
 using namespace std;
 
 #ifdef _DEBUG_
@@ -46,29 +44,20 @@ extern "C" {
   }
 }
 
-void VISU::WriteToFile(vtkUnstructuredGrid* theDataSet, const string& theFileName){
-//  vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
-//  //aWriter->DebugOn();
-//  //aWriter->SetFileType(VTK_BINARY);
-//  aWriter->SetFileName(theFileName.c_str());
-//  aWriter->SetInput(theDataSet);
-//  //aWriter->Print(cout);
-//  aWriter->Write();
-//  aWriter->Delete();
-}
-
 namespace VISU{
-  TVtkCellInfoMap aVtkCellInfoMap;
-  static int INIT = (
-                    aVtkCellInfoMap[VTK_VERTEX] = TVtkCellInfo("VTK_VERTEX",1),
-                    aVtkCellInfoMap[VTK_LINE] = TVtkCellInfo("VTK_LINE",2),
-                    aVtkCellInfoMap[VTK_TRIANGLE] = TVtkCellInfo("VTK_TRIANGLE",3),
-                    aVtkCellInfoMap[VTK_QUAD] = TVtkCellInfo("VTK_QUAD",4),
-                    aVtkCellInfoMap[VTK_TETRA] = TVtkCellInfo("VTK_TETRA",4),
-                    aVtkCellInfoMap[VTK_HEXAHEDRON] = TVtkCellInfo("VTK_HEXAHEDRON",8),
-                    aVtkCellInfoMap[VTK_WEDGE] = TVtkCellInfo("VTK_WEDGE",6),
-                    aVtkCellInfoMap[VTK_PYRAMID] = TVtkCellInfo("VTK_PYRAMID",5),
-                    1);
+  inline int GetNbOfPoints(int theVTKCellType){
+    switch(theVTKCellType){
+    case VTK_VERTEX : return 1;
+    case VTK_LINE : return 2;
+    case VTK_TRIANGLE : return 3;
+    case VTK_QUAD : return 4;
+    case VTK_TETRA : return 4;
+    case VTK_HEXAHEDRON : return 8;
+    case VTK_WEDGE : return 6;
+    case VTK_PYRAMID : return 5;
+    default: return -1;
+    }
+  }
 
   pair<int,int> TMeshOnEntity::GetCellsDims(const string& theFamilyName) const
     throw(std::runtime_error&)
@@ -97,7 +86,7 @@ namespace VISU{
          int tmp = aSubMeshOnCellType.size();
          aNbCells += tmp;
          int aVtkType = aSubMeshIter->first;
-         int aVtkSize = aVtkCellInfoMap[aVtkType].mySize;
+         int aVtkSize = GetNbOfPoints(aVtkType);
          aCellsSize += tmp*(aVtkSize+1);
        }
       }
@@ -125,7 +114,7 @@ namespace VISU{
     if(aFamilyMapIter == aFamilyMap.end())
       throw std::runtime_error("GetFamily >> There is no family on the mesh with entity !!!");
     const VISU::TFamily& aFamily = aFamilyMapIter->second;
-       return &aFamily;
+    return &aFamily;
   }
   
   TFamily* GetFamily(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName)