#include "VISU_Convertor.hxx"
#include "VISU_ConvertorUtils.hxx"
-#include <vtkUnstructuredGridWriter.h>
-
using namespace std;
#ifdef _DEBUG_
}
}
-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&)
int tmp = aSubMeshOnCellType.size();
aNbCells += tmp;
int aVtkType = aSubMeshIter->first;
- int aVtkSize = aVtkCellInfoMap[aVtkType].mySize;
+ int aVtkSize = GetNbOfPoints(aVtkType);
aCellsSize += tmp*(aVtkSize+1);
}
}
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)