Nektar++
Public Member Functions | Static Public Member Functions | List of all members
Nektar::FieldUtils::InputModule Class Reference

Abstract base class for input modules. More...

#include <Module.h>

Inheritance diagram for Nektar::FieldUtils::InputModule:
[legend]

Public Member Functions

 InputModule (FieldSharedPtr p_m)
 
void PrintSummary ()
 Print a brief summary of information. More...
 
- Public Member Functions inherited from Nektar::FieldUtils::Module
FIELD_UTILS_EXPORT Module (FieldSharedPtr p_f)
 
virtual ~Module ()=default
 
void Process (po::variables_map &vm)
 
std::string GetModuleName ()
 
std::string GetModuleDescription ()
 
const ConfigOptionGetConfigOption (const std::string &key) const
 
ModulePriority GetModulePriority ()
 
std::vector< ModuleKeyGetModulePrerequisites ()
 
FIELD_UTILS_EXPORT void RegisterConfig (std::string key, std::string value="")
 Register a configuration option with a module. More...
 
FIELD_UTILS_EXPORT void PrintConfig ()
 Print out all configuration options for a module. More...
 
FIELD_UTILS_EXPORT void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
FIELD_UTILS_EXPORT void AddFile (std::string fileType, std::string fileName)
 
FIELD_UTILS_EXPORT void EvaluateTriFieldAtEquiSpacedPts (LocalRegions::ExpansionSharedPtr &exp, const Array< OneD, const NekDouble > &infield, Array< OneD, NekDouble > &outfield)
 

Static Public Member Functions

static FIELD_UTILS_EXPORT std::string GuessFormat (std::string fileName)
 Tries to guess the format of the input file. More...
 

Additional Inherited Members

- Public Attributes inherited from Nektar::FieldUtils::Module
FieldSharedPtr m_f
 Field object. More...
 
- Protected Member Functions inherited from Nektar::FieldUtils::Module
 Module ()
 
virtual void v_Process (po::variables_map &vm)
 
virtual std::string v_GetModuleName ()
 
virtual std::string v_GetModuleDescription ()
 
virtual ModulePriority v_GetModulePriority ()
 
virtual std::vector< ModuleKeyv_GetModulePrerequisites ()
 
- Protected Attributes inherited from Nektar::FieldUtils::Module
std::map< std::string, ConfigOptionm_config
 List of configuration values. More...
 
std::set< std::string > m_allowedFiles
 List of allowed file formats. 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.

Definition at line 286 of file Module.h.

Constructor & Destructor Documentation

◆ InputModule()

Nektar::FieldUtils::InputModule::InputModule ( FieldSharedPtr  p_m)

Definition at line 61 of file Module.cpp.

61 : Module(m)
62{
63 m_config["infile"] = ConfigOption(false, "", "Input filename.");
64}
std::map< std::string, ConfigOption > m_config
List of configuration values.
Definition: Module.h:272

References Nektar::FieldUtils::Module::m_config.

Member Function Documentation

◆ GuessFormat()

string Nektar::FieldUtils::InputModule::GuessFormat ( std::string  fileName)
static

Tries to guess the format of the input file.

Definition at line 162 of file Module.cpp.

163{
164 // Read first 64 bytes of data, assuming input is this long.
165 ifstream inFile(filename.c_str(), ios::binary);
166 vector<char> data(64, 0);
167 inFile.read(&data[0], 64);
168
169 string check(&data[0], 64);
170
171 // Nek5000 format: first four characters are: #std
172 if (check.compare(0, 4, "#std") == 0)
173 {
174 inFile.close();
175 return "fld5000";
176 }
177
178 // Semtex format: first line should contain the string "Session" at
179 // character 27.
180 if (check.compare(26, 7, "Session") == 0)
181 {
182 inFile.close();
183 return "fldsem";
184 }
185
186 // Otherwise don't really know -- try to guess from file extension.
187 inFile.close();
188 return "";
189}

◆ PrintSummary()

void Nektar::FieldUtils::InputModule::PrintSummary ( )

Print a brief summary of information.

Definition at line 194 of file Module.cpp.

195{
196 cout << "Field size = " << m_f->m_data[0].size() * sizeof(NekDouble)
197 << endl;
198}
FieldSharedPtr m_f
Field object.
Definition: Module.h:239
double NekDouble

References Nektar::FieldUtils::Module::m_f.