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

Abstract base class for input modules. More...

#include <Module.h>

Inheritance diagram for Nektar::NekMeshUtils::InputModule:
Inheritance graph
[legend]
Collaboration diagram for Nektar::NekMeshUtils::InputModule:
Collaboration graph
[legend]

Public Member Functions

NEKMESHUTILS_EXPORT InputModule (MeshSharedPtr p_m)
 
NEKMESHUTILS_EXPORT void OpenStream ()
 Open a file for input. More...
 
- Public Member Functions inherited from Nektar::NekMeshUtils::Module
NEKMESHUTILS_EXPORT Module (MeshSharedPtr p_m)
 
virtual NEKMESHUTILS_EXPORT void Process ()=0
 
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 ()
 

Protected Member Functions

NEKMESHUTILS_EXPORT void PrintSummary ()
 Print summary of elements. More...
 
- 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

io::filtering_istream m_mshFile
 Input stream. More...
 
std::ifstream 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

Abstract base class for input modules.

Input modules should read the contents of m_mshFile in the Process() function and populate the members of #m. Typically any given module should populate Mesh::expDim, Mesh::spaceDim, Mesh::node and Mesh::element, then call the protected ProcessX functions to generate edges, faces, etc.

Definition at line 206 of file NekMeshUtils/Module/Module.h.

Constructor & Destructor Documentation

Nektar::NekMeshUtils::InputModule::InputModule ( MeshSharedPtr  p_m)

Definition at line 68 of file NekMeshUtils/Module/Module.cpp.

References Nektar::NekMeshUtils::Module::m_config.

68  : Module(m)
69 {
70  m_config["infile"] = ConfigOption(false, "", "Input filename.");
71 }
std::map< std::string, ConfigOption > m_config
List of configuration values.
NEKMESHUTILS_EXPORT Module(MeshSharedPtr p_m)

Member Function Documentation

void Nektar::NekMeshUtils::InputModule::OpenStream ( )

Open a file for input.

Definition at line 81 of file NekMeshUtils/Module/Module.cpp.

References Nektar::NekMeshUtils::Module::m_config, m_mshFile, and m_mshFileStream.

Referenced by Nektar::Utilities::InputGmsh::Process(), Nektar::Utilities::InputSem::Process(), Nektar::Utilities::InputNek5000::Process(), Nektar::Utilities::InputTec::Process(), Nektar::Utilities::InputSwan::Process(), Nektar::Utilities::InputPly::Process(), and Nektar::Utilities::InputNek::Process().

82 {
83  string fname = m_config["infile"].as<string>();
84 
85  if (fname.size() > 3 && fname.substr(fname.size() - 3, 3) == ".gz")
86  {
87  m_mshFileStream.open(fname.c_str(), ios_base::in | ios_base::binary);
88  m_mshFile.push(io::gzip_decompressor());
90  }
91  else
92  {
93  m_mshFileStream.open(fname.c_str());
95  }
96 
97  if (!m_mshFile.good())
98  {
99  cerr << "Error opening file: " << fname << endl;
100  abort();
101  }
102 }
io::filtering_istream m_mshFile
Input stream.
std::ifstream m_mshFileStream
Input stream.
std::map< std::string, ConfigOption > m_config
List of configuration values.
void Nektar::NekMeshUtils::InputModule::PrintSummary ( )
protected

Print summary of elements.

Print a brief summary of information.

Definition at line 905 of file NekMeshUtils/Module/Module.cpp.

References Nektar::NekMeshUtils::Module::m_mesh.

Referenced by Nektar::Utilities::InputSem::Process(), Nektar::Utilities::InputTec::Process(), and Nektar::Utilities::InputStar::Process().

906 {
907  // Compute the number of full-dimensional elements and boundary
908  // elements.
909  cerr << "Expansion dimension is " << m_mesh->m_expDim << endl;
910  cerr << "Space dimension is " << m_mesh->m_spaceDim << endl;
911  cerr << "Read " << m_mesh->m_node.size() << " nodes" << endl;
912  cerr << "Read " << m_mesh->GetNumElements() << " "
913  << m_mesh->m_expDim << "-D elements" << endl;
914  cerr << "Read " << m_mesh->GetNumBndryElements()
915  << " boundary elements" << endl;
916 }

Member Data Documentation

io::filtering_istream Nektar::NekMeshUtils::InputModule::m_mshFile
protected
std::ifstream Nektar::NekMeshUtils::InputModule::m_mshFileStream
protected

Input stream.

Definition at line 218 of file NekMeshUtils/Module/Module.h.

Referenced by OpenStream().