X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FCONVERTOR%2FVISU_Convertor.cxx;h=c9dbdb411965af4cae63cf3fa3e6e7890203226b;hb=0bf4a72d85628034bc33c2a252d876e83354dfc4;hp=82f2463dbc06b5f78cd7bcdc0bf0e8515d112f86;hpb=1470190682148c950f0c1a941034e9e2b6c10318;p=modules%2Fvisu.git diff --git a/src/CONVERTOR/VISU_Convertor.cxx b/src/CONVERTOR/VISU_Convertor.cxx index 82f2463d..c9dbdb41 100644 --- a/src/CONVERTOR/VISU_Convertor.cxx +++ b/src/CONVERTOR/VISU_Convertor.cxx @@ -27,8 +27,6 @@ #include "VISU_Convertor.hxx" #include "VISU_ConvertorUtils.hxx" -#include - 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 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)