38 #include <vtkPolyDataWriter.h>
39 #include <vtkPolyData.h>
40 #include <vtkPoints.h>
41 #include <vtkCellArray.h>
68 cout <<
"OutputVtk: Writing file..." << endl;
71 vtkPolyData *vtkMesh = vtkPolyData::New();
72 vtkPoints *vtkPoints = vtkPoints::New();
73 vtkCellArray *vtkPolys = vtkCellArray::New();
77 std::set<NodeSharedPtr> tmp(
m_mesh->m_vertexSet.begin(),
78 m_mesh->m_vertexSet.end());
80 for (it = tmp.begin(); it != tmp.end(); ++it)
83 vtkPoints->InsertPoint(n->m_id, n->m_x, n->m_y, n->m_z);
87 vector<ElementSharedPtr> &elmt =
m_mesh->m_element[
m_mesh->m_expDim];
88 for (
int i = 0; i < elmt.size(); ++i)
90 int vertexCount = elmt[i]->GetVertexCount();
91 for (
int j = 0; j < vertexCount; ++j)
93 p[j] = elmt[i]->GetVertex(j)->m_id;
95 vtkPolys->InsertNextCell(vertexCount, &p[0]);
98 vtkMesh->SetPoints(vtkPoints);
99 vtkMesh->SetPolys(vtkPolys);
102 vtkPolyDataWriter *vtkMeshWriter = vtkPolyDataWriter::New();
103 vtkMeshWriter->SetFileName(
m_config[
"outfile"].as<string>().c_str());
104 #if VTK_MAJOR_VERSION <= 5
105 vtkMeshWriter->SetInput(vtkMesh);
107 vtkMeshWriter->SetInputData(vtkMesh);
109 vtkMeshWriter->Update();
Abstract base class for output modules.
pair< ModuleType, string > ModuleKey
MeshSharedPtr m_mesh
Mesh object.
virtual void Process()
Write mesh to output file.
boost::shared_ptr< Node > NodeSharedPtr
std::map< std::string, ConfigOption > m_config
List of configuration values.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.