Nektar++
Public Member Functions | List of all members
ModuleWrap< MODTYPE > Struct Template Reference

Module wrapper to handle virtual function calls in Module and its subclasses as defined by the template parameter. More...

Inheritance diagram for ModuleWrap< MODTYPE >:
[legend]

Public Member Functions

 ModuleWrap (FieldSharedPtr field)
 Constructor, which is identical to FieldUtils::Module. More...
 
void v_Process (po::variables_map &vm) override
 Concrete implementation of the Module::Process function. More...
 
std::string v_GetModuleName () override
 
ModulePriority v_GetModulePriority () override
 
void AddConfigOption (std::string key, std::string def, std::string desc, bool isBool)
 Defines a configuration option for this module. More...
 

Detailed Description

template<typename MODTYPE>
struct ModuleWrap< MODTYPE >

Module wrapper to handle virtual function calls in Module and its subclasses as defined by the template parameter.

Template Parameters
MODTYPE.

Definition at line 56 of file Python/Module.cpp.

Constructor & Destructor Documentation

◆ ModuleWrap()

template<typename MODTYPE >
ModuleWrap< MODTYPE >::ModuleWrap ( FieldSharedPtr  field)
inline

Constructor, which is identical to FieldUtils::Module.

Parameters
fieldInput field.

Definition at line 63 of file Python/Module.cpp.

63 : MODTYPE(field)
64 {
65 }

Member Function Documentation

◆ AddConfigOption()

template<typename MODTYPE >
void ModuleWrap< MODTYPE >::AddConfigOption ( std::string  key,
std::string  def,
std::string  desc,
bool  isBool 
)
inline

Defines a configuration option for this module.

Parameters
keyThe name of the configuration option.
defThe option's default value.
descA text description of the option.
isBoolIf true, this option is a boolean-type (true/false).

Definition at line 139 of file Python/Module.cpp.

141 {
142 ConfigOption conf(isBool, def, desc);
143 this->m_config[key] = conf;
144 }
Represents a command-line configuration option.
Definition: Module.h:129

◆ v_GetModuleName()

template<typename MODTYPE >
std::string ModuleWrap< MODTYPE >::v_GetModuleName ( )
inlineoverride

Definition at line 104 of file Python/Module.cpp.

105 {
106 py::gil_scoped_acquire gil;
107 py::function override = py::get_override(this, "GetModuleName");
108
109 if (override)
110 {
111 return py::cast<std::string>(override());
112 }
113
114 throw ErrorUtil::NekError("GetModuleName() is a pure virtual function");
115 }
Nektar::ErrorUtil::NekError NekError

◆ v_GetModulePriority()

template<typename MODTYPE >
ModulePriority ModuleWrap< MODTYPE >::v_GetModulePriority ( )
inlineoverride

Definition at line 117 of file Python/Module.cpp.

118 {
119 py::gil_scoped_acquire gil;
120 py::function override = py::get_override(this, "GetModulePriority");
121
122 if (override)
123 {
124 return py::cast<ModulePriority>(override());
125 }
126
128 "GetModulePriority() is a pure virtual function");
129 }

◆ v_Process()

template<typename MODTYPE >
void ModuleWrap< MODTYPE >::v_Process ( po::variables_map &  vm)
inlineoverride

Concrete implementation of the Module::Process function.

Definition at line 70 of file Python/Module.cpp.

71 {
72 py::gil_scoped_acquire gil;
73 py::function override = py::get_override(this, "Process");
74
75 if (this->m_f->m_nParts > 1)
76 {
77 if (this->GetModulePriority() == eOutput)
78 {
79 this->m_f->m_comm = this->m_f->m_partComm;
80 if (this->GetModuleName() != "OutputInfo")
81 {
82 this->RegisterConfig("writemultiplefiles");
83 }
84 }
85 else if (this->GetModulePriority() == eCreateGraph)
86 {
87 this->m_f->m_comm = this->m_f->m_partComm;
88 }
89 else
90 {
91 this->m_f->m_comm = this->m_f->m_defComm;
92 }
93 }
94
95 if (override)
96 {
97 override();
98 return;
99 }
100
101 throw ErrorUtil::NekError("Process() is a pure virtual function");
102 }

References Nektar::FieldUtils::eCreateGraph, and Nektar::FieldUtils::eOutput.