14 #include <vtkSmartPointer.h> 15 #include <vtkPolyData.h> 16 #include <vtkPolyDataWriter.h> 17 #include <vtkXMLPolyDataWriter.h> 18 #include <vtkPLYWriter.h> 19 #include <vtkSTLWriter.h> 20 #include <vtkXMLUnstructuredGridWriter.h> 21 #include <vtkXMLImageDataWriter.h> 22 #include <vtkXMLStructuredGridWriter.h> 23 #include <vtkXMLRectilinearGridWriter.h> 31 template <
typename WriterType>
33 WriteVTK(vtkPolyData* mesh,
const std::string& filename)
35 vtkSmartPointer< WriterType > writer = vtkSmartPointer< WriterType >::New();
36 writer->SetInputData(mesh);
37 writer->SetFileName(filename.c_str());
47 std::string fileNoExt, ext;
49 std::cout <<
"Writing polydata to " << filename << std::endl;
51 WriteVTK<vtkPolyDataWriter>(mesh, filename);
53 WriteVTK<vtkXMLPolyDataWriter>(mesh, filename);
55 WriteVTK<vtkPLYWriter>(mesh, filename);
57 WriteVTK<vtkSTLWriter>(mesh, filename);
59 WriteVTK<vtkXMLUnstructuredGridWriter>(mesh, filename);
61 WriteVTK<vtkXMLImageDataWriter>(mesh, filename);
63 WriteVTK<vtkXMLStructuredGridWriter>(mesh, filename);
65 WriteVTK<vtkXMLRectilinearGridWriter>(mesh, filename);
67 WriteVTK<vtkPolyDataWriter>(mesh, filename);
void WriteVTK(vtkPolyData *mesh, const std::string &filename)
void GetFileExtension(const std::string &fileNameAbsolute, std::string &ext, std::string &fileNoExt)
void WriteVtkPolyData(vtkPolyData *mesh, const std::string &filename)