35#ifndef FIELDUTILS_MODULE
36#define FIELDUTILS_MODULE
56namespace po = boost::program_options;
91 "CreateGraph",
"CreateFieldData",
"ModifyFieldData",
"CreateExp",
92 "FillExp",
"ModifyExp",
"BndExtraction",
"CreatePts",
93 "ConvertExpToPts",
"ModifyPts",
"Output"};
103 unsigned char u8[
sizeof(T)];
108 for (
size_t k = 0; k <
sizeof(T); k++)
110 dest.u8[k] = source.u8[
sizeof(T) - k - 1];
118 size_t vecSize = u.size();
119 for (
size_t i = 0; i < vecSize; ++i)
151 template <
typename T> T
as()
const
155 return boost::lexical_cast<T>(
m_value);
157 catch (
const std::exception &e)
159 std::cerr <<
"We are not able to cast m_value " <<
m_value <<
" to "
160 <<
typeid(T).
name() << std::endl
161 << e.what() << std::endl;
228 std::string value =
"");
244 virtual void v_Process([[maybe_unused]] po::variables_map &vm)
268 return std::vector<ModuleKey>();
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define FIELD_UTILS_EXPORT
FIELD_UTILS_EXPORT void AddFile(std::string fileType, std::string fileName)
FIELD_UTILS_EXPORT void RegisterConfig(std::string key, std::string value="")
Register a configuration option with a module.
FIELD_UTILS_EXPORT Module(FieldSharedPtr p_f)
std::vector< ModuleKey > GetModulePrerequisites()
std::string GetModuleName()
virtual void v_Process(po::variables_map &vm)
std::string GetModuleDescription()
std::set< std::string > m_allowedFiles
List of allowed file formats.
void Process(po::variables_map &vm)
virtual std::string v_GetModuleDescription()
virtual std::string v_GetModuleName()
ModulePriority GetModulePriority()
virtual ~Module()=default
FieldSharedPtr m_f
Field object.
const ConfigOption & GetConfigOption(const std::string &key) const
FIELD_UTILS_EXPORT void PrintConfig()
Print out all configuration options for a module.
std::map< std::string, ConfigOption > m_config
List of configuration values.
virtual ModulePriority v_GetModulePriority()
virtual std::vector< ModuleKey > v_GetModulePrerequisites()
FIELD_UTILS_EXPORT void SetDefaults()
Sets default configuration options for those which have not been set.
FIELD_UTILS_EXPORT void EvaluateTriFieldAtEquiSpacedPts(LocalRegions::ExpansionSharedPtr &exp, const Array< OneD, const NekDouble > &infield, Array< OneD, NekDouble > &outfield)
Abstract base class for output modules.
OutputModule(FieldSharedPtr p_f)
std::ofstream m_fldFile
Output stream.
FIELD_UTILS_EXPORT void OpenStream()
Open a file for output.
Abstract base class for processing modules.
ProcessModule(FieldSharedPtr p_f)
Provides a generic Factory class.
LibUtilities::NekFactory< ModuleKey, Module, FieldSharedPtr > ModuleFactory
std::shared_ptr< Field > FieldSharedPtr
std::ostream & operator<<(std::ostream &os, const ModuleKey &rhs)
std::pair< ModuleType, std::string > ModuleKey
std::shared_ptr< InputModule > InputModuleSharedPtr
const std::string ModuleTypeMap[]
const char *const ModulePriorityMap[]
void swap_endian(T &u)
Swap endian ordering of the input variable.
std::shared_ptr< Module > ModuleSharedPtr
ModuleFactory & GetModuleFactory()
std::shared_ptr< Expansion > ExpansionSharedPtr
Represents a command-line configuration option.
std::string m_value
The value of the configuration option.
ConfigOption(bool isBool, std::string defValue, std::string desc)
Construct a new configuration option.
bool m_beenSet
True if the configuration option has been set at command line. If false, the default value will be pu...
std::string m_defValue
Default value of the configuration option.
std::string m_desc
Description of the configuration option.
bool m_isBool
True if the configuration option is a boolean (thus does not need additional arguments).
T as() const
Re-interpret the value stored in #value as some type using boost::lexical_cast.