Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Nektar::Utilities::OutputVtk Class Reference

Converter for Gmsh files. More...

#include <OutputVtk.h>

Inheritance diagram for Nektar::Utilities::OutputVtk:
Inheritance graph
[legend]
Collaboration diagram for Nektar::Utilities::OutputVtk:
Collaboration graph
[legend]

Public Member Functions

 OutputVtk (NekMeshUtils::MeshSharedPtr m)
 
virtual ~OutputVtk ()
 
virtual void Process ()
 Write mesh to output file. More...
 
- Public Member Functions inherited from Nektar::NekMeshUtils::OutputModule
NEKMESHUTILS_EXPORT OutputModule (MeshSharedPtr p_m)
 
NEKMESHUTILS_EXPORT void OpenStream ()
 Open a file for output. More...
 
- Public Member Functions inherited from Nektar::NekMeshUtils::Module
NEKMESHUTILS_EXPORT Module (MeshSharedPtr p_m)
 
NEKMESHUTILS_EXPORT void RegisterConfig (std::string key, std::string value)
 Register a configuration option with a module. More...
 
NEKMESHUTILS_EXPORT void PrintConfig ()
 Print out all configuration options for a module. More...
 
NEKMESHUTILS_EXPORT void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
NEKMESHUTILS_EXPORT MeshSharedPtr GetMesh ()
 
virtual NEKMESHUTILS_EXPORT void ProcessVertices ()
 Extract element vertices. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessEdges (bool ReprocessEdges=true)
 Extract element edges. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessFaces (bool ReprocessFaces=true)
 Extract element faces. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessElements ()
 Generate element IDs. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessComposites ()
 Generate composites. More...
 
virtual NEKMESHUTILS_EXPORT void ClearElementLinks ()
 

Static Public Member Functions

static boost::shared_ptr< Modulecreate (NekMeshUtils::MeshSharedPtr m)
 Creates an instance of this class. More...
 

Static Public Attributes

static NekMeshUtils::ModuleKey className
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::NekMeshUtils::Module
NEKMESHUTILS_EXPORT void ReorderPrisms (PerMap &perFaces)
 Reorder node IDs so that prisms and tetrahedra are aligned correctly. More...
 
NEKMESHUTILS_EXPORT void PrismLines (int prism, PerMap &perFaces, std::set< int > &prismsDone, std::vector< ElementSharedPtr > &line)
 
- Protected Attributes inherited from Nektar::NekMeshUtils::OutputModule
io::filtering_ostream m_mshFile
 Output stream. More...
 
std::ofstream m_mshFileStream
 Input stream. More...
 
- Protected Attributes inherited from Nektar::NekMeshUtils::Module
MeshSharedPtr m_mesh
 Mesh object. More...
 
std::map< std::string,
ConfigOption
m_config
 List of configuration values. More...
 

Detailed Description

Converter for Gmsh files.

Definition at line 47 of file utilities/NekMesh/OutputModules/OutputVtk.h.

Constructor & Destructor Documentation

Nektar::Utilities::OutputVtk::OutputVtk ( NekMeshUtils::MeshSharedPtr  m)

Definition at line 56 of file utilities/NekMesh/OutputModules/OutputVtk.cpp.

56  : OutputModule(m)
57 {
58 }
NEKMESHUTILS_EXPORT OutputModule(MeshSharedPtr p_m)
Nektar::Utilities::OutputVtk::~OutputVtk ( )
virtual

Definition at line 60 of file utilities/NekMesh/OutputModules/OutputVtk.cpp.

61 {
62 }

Member Function Documentation

static boost::shared_ptr<Module> Nektar::Utilities::OutputVtk::create ( NekMeshUtils::MeshSharedPtr  m)
inlinestatic

Creates an instance of this class.

Definition at line 51 of file utilities/NekMesh/OutputModules/OutputVtk.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

52  {
54  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::Utilities::OutputVtk::Process ( )
virtual

Write mesh to output file.

Implements Nektar::NekMeshUtils::Module.

Definition at line 64 of file utilities/NekMesh/OutputModules/OutputVtk.cpp.

References Nektar::iterator, Nektar::NekMeshUtils::Module::m_config, Nektar::NekMeshUtils::Module::m_mesh, and CellMLToNektar.cellml_metadata::p.

65 {
66  if (m_mesh->m_verbose)
67  {
68  cout << "OutputVtk: Writing file..." << endl;
69  }
70 
71  vtkPolyData *vtkMesh = vtkPolyData::New();
72  vtkPoints *vtkPoints = vtkPoints::New();
73  vtkCellArray *vtkPolys = vtkCellArray::New();
74 
76 
77  std::set<NodeSharedPtr> tmp(m_mesh->m_vertexSet.begin(),
78  m_mesh->m_vertexSet.end());
79 
80  for (it = tmp.begin(); it != tmp.end(); ++it)
81  {
82  NodeSharedPtr n = *it;
83  vtkPoints->InsertPoint(n->m_id, n->m_x, n->m_y, n->m_z);
84  }
85 
86  vtkIdType p[8];
87  vector<ElementSharedPtr> &elmt = m_mesh->m_element[m_mesh->m_expDim];
88  for (int i = 0; i < elmt.size(); ++i)
89  {
90  int vertexCount = elmt[i]->GetVertexCount();
91  for (int j = 0; j < vertexCount; ++j)
92  {
93  p[j] = elmt[i]->GetVertex(j)->m_id;
94  }
95  vtkPolys->InsertNextCell(vertexCount, &p[0]);
96  }
97 
98  vtkMesh->SetPoints(vtkPoints);
99  vtkMesh->SetPolys(vtkPolys);
100 
101  // Write out the new mesh
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);
106 #else
107  vtkMeshWriter->SetInputData(vtkMesh);
108 #endif
109  vtkMeshWriter->Update();
110 }
boost::shared_ptr< Node > NodeSharedPtr
Definition: Node.h:50
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

Member Data Documentation

ModuleKey Nektar::Utilities::OutputVtk::className
static
Initial value:

Definition at line 55 of file utilities/NekMesh/OutputModules/OutputVtk.h.