35 #ifndef FIELDUTILS_MODULE
36 #define FIELDUTILS_MODULE
56 namespace po = boost::program_options;
93 "CreateGraph",
"CreateFieldData",
"ModifyFieldData",
"CreateExp",
94 "FillExp",
"ModifyExp",
"BndExtraction",
"CreatePts",
95 "ConvertExpToPts",
"ModifyPts",
"Output"
101 template <
typename T>
107 unsigned char u8[
sizeof(T)];
112 for (
size_t k = 0; k <
sizeof(T); k++)
114 dest.u8[k] = source.u8[
sizeof(T) - k - 1];
120 template <
typename T>
123 size_t vecSize = u.size();
124 for (
int i = 0; i < vecSize; ++i)
156 template <
typename T>
161 return boost::lexical_cast<T>(
m_value);
163 catch (
const std::exception &e)
165 std::cerr <<
"We are not able to cast m_value " <<
m_value
166 <<
" to " <<
typeid(T).
name() << std::endl
167 << e.what() << std::endl;
198 virtual void Process(po::variables_map &vm) = 0;
219 std::string value =
"");
#define ASSERTL0(condition, msg)
#define FIELD_UTILS_EXPORT
virtual void Process(po::variables_map &vm)=0
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)
virtual std::string GetModuleName()=0
std::set< std::string > m_allowedFiles
List of allowed file formats.
virtual ~Module()=default
FieldSharedPtr m_f
Field object.
virtual ModulePriority GetModulePriority()=0
FIELD_UTILS_EXPORT void PrintConfig()
Print out all configuration options for a module.
std::map< std::string, ConfigOption > m_config
List of configuration values.
FIELD_UTILS_EXPORT void SetDefaults()
Sets default configuration options for those which have not been set.
const ConfigOption & GetConfigOption(const std::string &key) const
virtual std::string GetModuleDescription()
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
The above copyright notice and this permission notice shall be included.
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.