Nektar++
|
#include <FieldUtils/Module.h>
#include <LibUtilities/Python/NekPyConfig.hpp>
#include <boost/program_options.hpp>
#include <boost/python/raw_function.hpp>
Go to the source code of this file.
Classes | |
struct | ModuleWrap< MODTYPE > |
Module wrapper to handle virtual function calls in Module and its subclasses as defined by the template parameter. More... | |
struct | ModuleTypeProxy< MODTYPE > |
struct | ModuleTypeProxy< InputModule > |
struct | ModuleTypeProxy< ProcessModule > |
struct | ModuleTypeProxy< OutputModule > |
class | ModuleRegisterHelper |
struct | ModuleWrapConverter< MODTYPE > |
struct | PythonModuleClass< MODTYPE > |
Functions | |
void | Module_Process (ModuleSharedPtr m) |
template<typename T > | |
T | Module_GetConfig (std::shared_ptr< Module > mod, const std::string &key) |
void | Module_GetVtkGrid (std::shared_ptr< Module > mod) |
template<typename MODTYPE > | |
ModuleSharedPtr | Module_Create (py::tuple args, py::dict kwargs) |
Lightweight wrapper for Module factory creation function. More... | |
void | Module_RegisterConfig (std::shared_ptr< Module > mod, std::string const &key, std::string const &value) |
Lightweight wrapper for FieldUtils::Module::RegisterConfig. More... | |
template<typename MODTYPE > | |
void | ModuleWrap_AddConfigOption (std::shared_ptr< ModuleWrap< MODTYPE > > mod, std::string const &key, std::string const &defValue, std::string const &desc, bool isBool) |
void | ModuleCapsuleDestructor (PyObject *ptr) |
void | Module_Register (ModuleType const &modType, std::string const &modName, py::object &obj) |
Lightweight wrapper for the Module factory RegisterCreatorFunction, to support the ability for Python subclasses of Module to register themselves with the Nektar++ Module factory. More... | |
void | export_Module () |
void export_Module | ( | ) |
Definition at line 437 of file Python/Module.cpp.
References Module_GetVtkGrid(), Module_Process(), Module_Register(), Module_RegisterConfig(), Nektar::FieldUtils::ModuleTypeMap, NEKPY_WRAP_ENUM_STRING, and VTK_PYTHON_CONVERSION.
Referenced by BOOST_PYTHON_MODULE().
ModuleSharedPtr Module_Create | ( | py::tuple | args, |
py::dict | kwargs | ||
) |
Lightweight wrapper for Module factory creation function.
modType | Module type (input/process/output). |
modName | Module name (typically filename extension). |
field | Field that will be passed between modules. |
MODTYPE | Subclass of Module (e.g #InputModule, #OutputModule) |
Definition at line 193 of file Python/Module.cpp.
References Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::FieldUtils::eInputModule, Nektar::FieldUtils::eOutputModule, Nektar::FieldUtils::eProcessModule, FilterPython_Function::field, Nektar::FieldUtils::GetModuleFactory(), and Nektar::FieldUtils::ModuleTypeMap.
T Module_GetConfig | ( | std::shared_ptr< Module > | mod, |
const std::string & | key | ||
) |
Definition at line 132 of file Python/Module.cpp.
void Module_GetVtkGrid | ( | std::shared_ptr< Module > | mod | ) |
void Module_Process | ( | ModuleSharedPtr | m | ) |
Definition at line 106 of file Python/Module.cpp.
References Nektar::FieldUtils::eCreateGraph, and Nektar::FieldUtils::eOutput.
Referenced by export_Module(), and PythonModuleClass< MODTYPE >::PythonModuleClass().
void Module_Register | ( | ModuleType const & | modType, |
std::string const & | modName, | ||
py::object & | obj | ||
) |
Lightweight wrapper for the Module factory RegisterCreatorFunction, to support the ability for Python subclasses of Module to register themselves with the Nektar++ Module factory.
This function wraps the NekFactory RegisterCreatorFunction. This function expects a function pointer to a C++ object that will construct a Module. In this case we therefore need to construct a function call that will construct our Python object (which is a subclass of Module), and then pass this back to Boost.Python to give the Python object back.
We have to do some indirection here to get this to work, but we can achieve this with the following strategy:
ModuleRegisterHelper
object, which as an argument will store the Python class instance that will be instantiated from the Python side.ModuleRegisterHelper
instance, and register this in the global namespace of the current module. This then ties the capsule to the lifetime of the module. Definition at line 365 of file Python/Module.cpp.
References ModuleRegisterHelper::create(), Nektar::FieldUtils::GetModuleFactory(), ModuleCapsuleDestructor(), Nektar::FieldUtils::ModuleTypeMap, and Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::RegisterCreatorFunction().
Referenced by export_Module().
void Module_RegisterConfig | ( | std::shared_ptr< Module > | mod, |
std::string const & | key, | ||
std::string const & | value | ||
) |
Lightweight wrapper for FieldUtils::Module::RegisterConfig.
mod | Module to call |
key | Configuration key. |
value | Optional value (some configuration options are boolean). |
Definition at line 290 of file Python/Module.cpp.
Referenced by export_Module().
void ModuleCapsuleDestructor | ( | PyObject * | ptr | ) |
Definition at line 335 of file Python/Module.cpp.
Referenced by Module_Register().
void ModuleWrap_AddConfigOption | ( | std::shared_ptr< ModuleWrap< MODTYPE > > | mod, |
std::string const & | key, | ||
std::string const & | defValue, | ||
std::string const & | desc, | ||
bool | isBool | ||
) |
Definition at line 297 of file Python/Module.cpp.