MoCSI API Reference
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
Density< T > Class Template Reference

Managing module that calculates bulk density based on submodules. More...

#include <Density.h>

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

Public Member Functions

 Density (SimulationClassBase< T > *sim)
 Construct the Density module.
 
bool setup (std::vector< std::shared_ptr< GenericSubmodule< T > > > all_submodules) override
 Setup method called after construction.
 
bool exec (std::string_view param) override
 Main execution method of the module.
 
bool init () override
 Initialization step.
 
bool preTimeStep () override
 Pre-time-step processing.
 
bool postTimeStep () override
 Post-time-step processing.
 
bool output () override
 Output stage.
 
void writeToSim ()
 Write the current density field to the simulation.
 
std::vector< std::string > getChainInsertion () const override
 Get chain insertion points.
 
std::string_view getNameLocal () const override
 Get the localized name of the module.
 
- Public Member Functions inherited from GenericManagingModule< T >
 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 postNonLinIter ()
 
virtual std::vector< std::string > getDependencies () const
 
virtual void setSubmoduleList (std::vector< std::string > submodules)
 
std::vector< std::string > getSubmoduleList () const
 
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.
 

Static Public Member Functions

static std::shared_ptr< GenericManagingModule< T > > createMethode (SimulationClassBase< T > *sim)
 Factory method for creating a Density module.
 
static std::string getName ()
 Get the name of the module.
 

Additional Inherited Members

- Protected Attributes inherited from GenericManagingModule< T >
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 Density< T >

Managing module that calculates bulk density based on submodules.

The Density module:

Template Parameters
TNumeric type used in the simulation (e.g., float, double).

Constructor & Destructor Documentation

◆ Density()

template<typename T >
Density< T >::Density ( SimulationClassBase< T > *  sim)

Construct the Density module.

Loads user configuration from the .ini file and initializes the submodule list.

Parameters
simPointer to the simulation base class.

Member Function Documentation

◆ createMethode()

template<typename T >
static std::shared_ptr< GenericManagingModule< T > > Density< T >::createMethode ( SimulationClassBase< T > *  sim)
inlinestatic

Factory method for creating a Density module.

Used by the ModuleFactory to dynamically create instances.

Parameters
simPointer to the simulation base class.
Returns
Shared pointer to the newly created Density instance.

◆ exec()

template<typename T >
bool Density< T >::exec ( std::string_view  param)
overridevirtual

Main execution method of the module.

Dispatches calls to the corresponding chain stage based on the given parameter:

  • "InitChain"
  • "PreTimeStepChain"
  • "PostTimeStepChain"
  • "OutputChain"
Parameters
paramString indicating which chain stage to run.
Returns
True if the stage executed successfully, false otherwise.

Implements GenericManagingModule< T >.

◆ getChainInsertion()

template<typename T >
std::vector< std::string > Density< T >::getChainInsertion ( ) const
inlineoverridevirtual

Get chain insertion points.

Reads the list of chain stages where this module should be inserted from the .ini file parameter "chain_insertion".

Returns
Vector of chain stage names.

Reimplemented from GenericManagingModule< T >.

◆ getName()

template<typename T >
static std::string Density< T >::getName ( )
inlinestatic

Get the name of the module.

Returns
The string "Density".

◆ getNameLocal()

template<typename T >
std::string_view Density< T >::getNameLocal ( ) const
inlineoverridevirtual

Get the localized name of the module.

Returns
The string "Density".

Implements GenericManagingModule< T >.

◆ init()

template<typename T >
bool Density< T >::init ( )
overridevirtual

Initialization step.

Runs the submodule chain’s initialization stage and writes results to the simulation.

Returns
True on success.

Reimplemented from GenericManagingModule< T >.

◆ output()

template<typename T >
bool Density< T >::output ( )
inlineoverridevirtual

Output stage.

Currently does nothing except return success.

Returns
Always true.

Reimplemented from GenericManagingModule< T >.

◆ postTimeStep()

template<typename T >
bool Density< T >::postTimeStep ( )
inlineoverridevirtual

Post-time-step processing.

Currently does nothing except return success.

Returns
Always true.

Reimplemented from GenericManagingModule< T >.

◆ preTimeStep()

template<typename T >
bool Density< T >::preTimeStep ( )
overridevirtual

Pre-time-step processing.

Runs the submodule chain’s pre-time-step stage and writes results to the simulation.

Returns
True on success.

Reimplemented from GenericManagingModule< T >.

◆ setup()

template<typename T >
bool Density< T >::setup ( std::vector< std::shared_ptr< GenericSubmodule< T > > >  all_submodules)
overridevirtual

Setup method called after construction.

Initializes the density field in the simulation’s field map and sets submodules.

Parameters
all_submodulesList of all available submodules.
Returns
True on success.

Reimplemented from GenericManagingModule< T >.

◆ writeToSim()

template<typename T >
void Density< T >::writeToSim ( )

Write the current density field to the simulation.

Updates the simulation’s "Density" field with the values from module_field.


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