Nektar++
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:
[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=std::string())
 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, ConfigOptionm_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

◆ InputModule()

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

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

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

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

Member Function Documentation

◆ OpenStream()

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

Open a file for input.

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

References Nektar::NekMeshUtils::Module::m_config, Nektar::NekMeshUtils::OutputModule::m_mshFile, and Nektar::NekMeshUtils::OutputModule::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().

78 {
79  string fname = m_config["infile"].as<string>();
80 
81  if (fname.size() > 3 && fname.substr(fname.size() - 3, 3) == ".gz")
82  {
83  m_mshFileStream.open(fname.c_str(), ios_base::in | ios_base::binary);
84  m_mshFile.push(io::gzip_decompressor());
86  }
87  else
88  {
89  m_mshFileStream.open(fname.c_str());
91  }
92 
93  if (!m_mshFile.good())
94  {
95  cerr << "Error opening file: " << fname << endl;
96  abort();
97  }
98 }
io::filtering_istream m_mshFile
Input stream.
std::ifstream m_mshFileStream
Input stream.
std::map< std::string, ConfigOption > m_config
List of configuration values.

◆ PrintSummary()

void Nektar::NekMeshUtils::InputModule::PrintSummary ( )
protected

Print summary of elements.

Print a brief summary of information.

Definition at line 908 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().

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

Member Data Documentation

◆ m_mshFile

io::filtering_istream Nektar::NekMeshUtils::InputModule::m_mshFile
protected

◆ m_mshFileStream

std::ifstream Nektar::NekMeshUtils::InputModule::m_mshFileStream
protected

Input stream.

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