Nektar++
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Nektar::Utilities::InputModule Class Reference

Abstract base class for input modules. More...

#include <Module.h>

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

Public Member Functions

 InputModule (FieldSharedPtr p_m)
 
void AddFile (string fileType, string fileName)
 
 InputModule (MeshSharedPtr p_m)
 
void OpenStream ()
 Open a file for input. More...
 
- Public Member Functions inherited from Nektar::Utilities::Module
 Module (FieldSharedPtr p_f)
 
virtual void Process (po::variables_map &vm)=0
 
void RegisterConfig (string key, string value)
 Register a configuration option with a module. More...
 
void PrintConfig ()
 Print out all configuration options for a module. More...
 
void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
bool GetRequireEquiSpaced (void)
 
void SetRequireEquiSpaced (bool pVal)
 
void EvaluateTriFieldAtEquiSpacedPts (LocalRegions::ExpansionSharedPtr &exp, const Array< OneD, const NekDouble > &infield, Array< OneD, NekDouble > &outfield)
 
 Module (MeshSharedPtr p_m)
 
virtual void Process ()=0
 
void RegisterConfig (string key, string value)
 
void PrintConfig ()
 
void SetDefaults ()
 
MeshSharedPtr GetMesh ()
 
virtual void ProcessVertices ()
 Extract element vertices. More...
 

Protected Member Functions

void PrintSummary ()
 Print summary of elements. More...
 
void PrintSummary ()
 Print summary of elements. More...
 
- Protected Member Functions inherited from Nektar::Utilities::Module
 Module ()
 
virtual void ProcessEdges (bool ReprocessEdges=true)
 Extract element edges. More...
 
virtual void ProcessFaces (bool ReprocessFaces=true)
 Extract element faces. More...
 
virtual void ProcessElements ()
 Generate element IDs. More...
 
virtual void ProcessComposites ()
 Generate composites. More...
 
void ReorderPrisms (PerMap &perFaces)
 Reorder node IDs so that prisms and tetrahedra are aligned correctly. More...
 
void PrismLines (int prism, PerMap &perFaces, set< int > &prismsDone, vector< ElementSharedPtr > &line)
 

Protected Attributes

set< string > m_allowedFiles
 
std::ifstream m_mshFile
 Input stream. More...
 
- Protected Attributes inherited from Nektar::Utilities::Module
FieldSharedPtr m_f
 Field object. More...
 
map< string, ConfigOptionm_config
 List of configuration values. More...
 
bool m_requireEquiSpaced
 
MeshSharedPtr m_mesh
 Mesh object. More...
 

Detailed Description

Abstract base class for input modules.

Input modules should read the contents of #fldFile 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.

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 180 of file FieldConvert/Module.h.

Constructor & Destructor Documentation

Nektar::Utilities::InputModule::InputModule ( FieldSharedPtr  p_m)

Definition at line 66 of file FieldConvert/Module.cpp.

References Nektar::Utilities::Module::m_config.

66  : Module(m)
67  {
68  m_config["infile"] = ConfigOption(false, "", "Input filename.");
69  }
map< string, ConfigOption > m_config
List of configuration values.
Nektar::Utilities::InputModule::InputModule ( MeshSharedPtr  p_m)

Definition at line 65 of file MeshConvert/Module.cpp.

References Nektar::Utilities::Module::m_config.

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

Member Function Documentation

void Nektar::Utilities::InputModule::AddFile ( string  fileType,
string  fileName 
)

Definition at line 76 of file FieldConvert/Module.cpp.

References m_allowedFiles, and Nektar::Utilities::Module::m_f.

Referenced by main().

77  {
78  // Check to see if this file type is allowed
79  if (m_allowedFiles.count(fileType) == 0)
80  {
81  cerr << "File type " << fileType << " not supported for this "
82  << "module." << endl;
83  }
84 
85  m_f->m_inputfiles[fileType].push_back(fileName);
86  }
FieldSharedPtr m_f
Field object.
void Nektar::Utilities::InputModule::OpenStream ( )

Open a file for input.

Definition at line 78 of file MeshConvert/Module.cpp.

References Nektar::Utilities::Module::m_config, and m_mshFile.

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

79  {
80  string fname = m_config["infile"].as<string>();
81  m_mshFile.open(fname.c_str());
82  if (!m_mshFile.good())
83  {
84  cerr << "Error opening file: " << fname << endl;
85  abort();
86  }
87  }
std::ifstream m_mshFile
Input stream.
map< string, ConfigOption > m_config
List of configuration values.
void Nektar::Utilities::InputModule::PrintSummary ( )
protected

Print summary of elements.

Print a brief summary of information.

Definition at line 165 of file FieldConvert/Module.cpp.

References Nektar::Utilities::Module::m_f.

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

166  {
167  cout << "Field size = " <<
168  m_f->m_data[0].size() * sizeof(NekDouble) << endl;
169  }
FieldSharedPtr m_f
Field object.
double NekDouble
void Nektar::Utilities::InputModule::PrintSummary ( )
protected

Print summary of elements.

Member Data Documentation

set<string> Nektar::Utilities::InputModule::m_allowedFiles
protected
std::ifstream Nektar::Utilities::InputModule::m_mshFile
protected