36 #define _BACKWARD_BACKWARD_WARNING_H 1 37 #include <vtkDoubleArray.h> 38 #include <vtkCellData.h> 39 #include <vtkCellArray.h> 40 #include <vtkPointData.h> 42 #include <vtkXMLPolyDataWriter.h> 43 #include <vtkSTLWriter.h> 44 #include <vtkVersion.h> 45 #include <vtkGeometryFilter.h> 46 #include <vtkTriangleFilter.h> 47 #include <vtkCleanPolyData.h> 48 #include "SmartPointers.hpp" 49 #include "Exception.hpp" 50 #include "PetscTools.hpp" 51 #include "GeometryWriter.hpp" 91 EXCEPTION(
"An input geometry is not set.");
96 EXCEPTION(
"No file name set for the GeometryWriter.");
99 if(
mFormat == GeometryFormat::STL)
101 if(PetscTools::AmMaster())
103 vtkSmartPointer<vtkTriangleFilter> p_tri_filter = vtkSmartPointer<vtkTriangleFilter>::New();
104 #if VTK_MAJOR_VERSION <= 5 110 vtkSmartPointer<vtkCleanPolyData> p_clean_filter = vtkSmartPointer<vtkCleanPolyData>::New();
111 p_clean_filter->SetInputConnection(p_tri_filter->GetOutputPort());
112 p_clean_filter->Update();
114 vtkSmartPointer<vtkSTLWriter> writer = vtkSmartPointer<vtkSTLWriter>::New();
116 #if VTK_MAJOR_VERSION <= 5 117 writer->SetInput(p_clean_filter->GetOutput());
119 writer->SetInputData(p_clean_filter->GetOutput());
121 writer->SetFileTypeToASCII();
127 if(PetscTools::AmMaster())
129 vtkSmartPointer<vtkXMLPolyDataWriter> writer = vtkSmartPointer<vtkXMLPolyDataWriter>::New();
131 #if VTK_MAJOR_VERSION <= 5 GeometryFormat::Value mFormat
static boost::shared_ptr< GeometryWriter > Create()
void SetOutputFormat(GeometryFormat::Value format)
vtkSmartPointer< vtkPolyData > mpInputGeometry
void SetInput(vtkSmartPointer< vtkPolyData > pSurface)
void SetFileName(const std::string &rFileName)