MoCSI API Reference
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
GenericManagingModule< T > Class Template Referenceabstract

Abstract base class for the managing modules. Managing modules are the highest tier of modules and are always run directly from the main loop. They can create a field and directly alter values within the simulation class . They can have an arbitrary number of submodules that they can execute themself when called. Each managing module can do different things during different times in the code managed via the chain insertion points and the corresponding functions in this class (Note: The internal "module_field" variable and the field they create in the sim class is NOT synced. You have to manually update the fields.) More...

#include <GenericManagingModule.h>

Inheritance diagram for GenericManagingModule< T >:
Inheritance graph
Collaboration diagram for GenericManagingModule< T >:
Collaboration graph

Public Member Functions

 GenericManagingModule ()
 Constructor without arguments. Will be employed when using the static modules registry.
 
virtual ~GenericManagingModule ()=default
 
 GenericManagingModule (SimulationClassBase< T > *l_sim)
 Constructor to be preferably used when a module is created during runtime.
 
virtual bool setup (std::vector< std::shared_ptr< GenericSubmodule< T > > > all_submodules)
 
virtual bool exec (std::string_view param)=0
 
virtual bool init ()
 
virtual bool preTimeStep ()
 
virtual bool postTimeStep ()
 
virtual bool postNonLinIter ()
 
virtual bool output ()
 
virtual std::vector< std::string > getChainInsertion () const
 
virtual std::vector< std::string > getDependencies () const
 
virtual void setSubmoduleList (std::vector< std::string > submodules)
 
std::vector< std::string > getSubmoduleList () const
 
virtual std::string_view getNameLocal () const =0
 
void setSimPointer (SimulationClassBase< T > *sim)
 Setter function for the sim pointer. As the module is usually registered during static initialization when the sim class is not yet existing, this function is needed to set the pointer.
 
void setSubmodules (std::vector< std::shared_ptr< GenericSubmodule< T > > > all_submodules)
 Sets all the submodules of this module into their corresponding chains. Also sets their field-pointers to this->module_field as a way to communicate between submodules.
 
void writeToGlobalIniContent (std::ofstream &global_stream)
 Function that writes the local ini file contents to the global ini file stream. "Tags" the keys with the name of the module in the format "module_name$key".
 
void overwriteLocalIniContent (const std::unordered_map< std::string, std::any > &global_ini_content)
 Writes the (already trimmed to the local content) data from the global ini file to the local ini file. This only overwrites the internal data and not the file contents itself.
 

Protected Attributes

SimulationClassBase< T > * sim {}
 
std::shared_ptr< std::valarray< T > > module_field
 
ChainManager< GenericSubmodule< T > > sub_module_chain
 
std::vector< std::string > m_generic_submodules
 
InputManager ini_file_data
 
bool in_snapshot {false}
 
bool in_output {false}
 
char field_id
 

Detailed Description

template<typename T>
class GenericManagingModule< T >

Abstract base class for the managing modules. Managing modules are the highest tier of modules and are always run directly from the main loop. They can create a field and directly alter values within the simulation class . They can have an arbitrary number of submodules that they can execute themself when called. Each managing module can do different things during different times in the code managed via the chain insertion points and the corresponding functions in this class (Note: The internal "module_field" variable and the field they create in the sim class is NOT synced. You have to manually update the fields.)

Constructor & Destructor Documentation

◆ GenericManagingModule() [1/2]

Constructor without arguments. Will be employed when using the static modules registry.

◆ ~GenericManagingModule()

template<typename T >
virtual GenericManagingModule< T >::~GenericManagingModule ( )
virtualdefault

◆ GenericManagingModule() [2/2]

Constructor to be preferably used when a module is created during runtime.

Parameters
l_simThe pointer to the sim class.

Member Function Documentation

◆ exec()

template<typename T >
virtual bool GenericManagingModule< T >::exec ( std::string_view  param)
pure virtual

◆ getChainInsertion()

template<typename T >
virtual std::vector< std::string > GenericManagingModule< T >::getChainInsertion ( ) const
inlinevirtual

◆ getDependencies()

template<typename T >
virtual std::vector< std::string > GenericManagingModule< T >::getDependencies ( ) const
inlinevirtual

Reimplemented in SolarFlux< T >.

◆ getNameLocal()

template<typename T >
virtual std::string_view GenericManagingModule< T >::getNameLocal ( ) const
pure virtual

◆ getSubmoduleList()

template<typename T >
std::vector< std::string > GenericManagingModule< T >::getSubmoduleList ( ) const
inline

◆ init()

template<typename T >
virtual bool GenericManagingModule< T >::init ( )
inlinevirtual

◆ output()

template<typename T >
virtual bool GenericManagingModule< T >::output ( )
inlinevirtual

◆ overwriteLocalIniContent()

template<typename T >
void GenericManagingModule< T >::overwriteLocalIniContent ( const std::unordered_map< std::string, std::any > &  global_ini_content)
inline

Writes the (already trimmed to the local content) data from the global ini file to the local ini file. This only overwrites the internal data and not the file contents itself.

Parameters
global_ini_contentThe map containing the local partition of this module within the global ini file.

◆ postNonLinIter()

template<typename T >
virtual bool GenericManagingModule< T >::postNonLinIter ( )
inlinevirtual

◆ postTimeStep()

template<typename T >
virtual bool GenericManagingModule< T >::postTimeStep ( )
inlinevirtual

◆ preTimeStep()

template<typename T >
virtual bool GenericManagingModule< T >::preTimeStep ( )
inlinevirtual

◆ setSimPointer()

template<typename T >
void GenericManagingModule< T >::setSimPointer ( SimulationClassBase< T > *  sim)
inline

Setter function for the sim pointer. As the module is usually registered during static initialization when the sim class is not yet existing, this function is needed to set the pointer.

◆ setSubmoduleList()

template<typename T >
virtual void GenericManagingModule< T >::setSubmoduleList ( std::vector< std::string >  submodules)
inlinevirtual

◆ setSubmodules()

template<typename T >
void GenericManagingModule< T >::setSubmodules ( std::vector< std::shared_ptr< GenericSubmodule< T > > >  all_submodules)
inline

Sets all the submodules of this module into their corresponding chains. Also sets their field-pointers to this->module_field as a way to communicate between submodules.

◆ setup()

template<typename T >
virtual bool GenericManagingModule< T >::setup ( std::vector< std::shared_ptr< GenericSubmodule< T > > >  all_submodules)
inlinevirtual

◆ writeToGlobalIniContent()

template<typename T >
void GenericManagingModule< T >::writeToGlobalIniContent ( std::ofstream &  global_stream)
inline

Function that writes the local ini file contents to the global ini file stream. "Tags" the keys with the name of the module in the format "module_name$key".

Parameters
global_streamThe outstream containing all ini file data.

Member Data Documentation

◆ field_id

template<typename T >
char GenericManagingModule< T >::field_id
protected
Initial value:
{
'?'}

◆ in_output

template<typename T >
bool GenericManagingModule< T >::in_output {false}
protected

◆ in_snapshot

template<typename T >
bool GenericManagingModule< T >::in_snapshot {false}
protected

◆ ini_file_data

template<typename T >
InputManager GenericManagingModule< T >::ini_file_data
protected

◆ m_generic_submodules

template<typename T >
std::vector<std::string> GenericManagingModule< T >::m_generic_submodules
protected

◆ module_field

template<typename T >
std::shared_ptr<std::valarray<T> > GenericManagingModule< T >::module_field
protected

◆ sim

template<typename T >
SimulationClassBase<T>* GenericManagingModule< T >::sim {}
protected

◆ sub_module_chain

template<typename T >
ChainManager<GenericSubmodule<T> > GenericManagingModule< T >::sub_module_chain
protected
Initial value:
{
"global"}

The documentation for this class was generated from the following file: