4#define DENSITY_VERSION "5"
11#include "../../src/GenericManagingModule.h"
12#include "../../src/ModuleFactory.h"
44 static bool m_registered;
49 std::string m_ini_filepath{
"density/Density.ini"};
83 bool exec(std::string_view param)
override;
151 return std::make_shared<Density<T>>(
sim);
159 static std::string
getName() {
return "Density"; };
176 std::string ini_folder_path{
183 std::cerr <<
"[Density]: " << e.
what() <<
'\n';
184 throw BadInput(
static_cast<std::string
>(
"[Density]: ")
185 +
static_cast<std::string
>(e.
what()));
194 this->sim->m_field_map.insert(
197 this->sim->m_simulation_config.getIntParameters(
"numerical_layers")
198 * this->sim->m_simulation_config.getIntParameters(
"number_of_facets"))});
199 this->module_field = std::make_shared<std::valarray<T>>(
200 this->sim->m_simulation_config.getIntParameters(
"numerical_layers")
201 * this->sim->m_simulation_config.getIntParameters(
"number_of_facets"));
202 this->setSubmodules(all_submodules);
206 std::cerr <<
"[Density]: Failed to insert field map and/or local field!\n[Density]: "
208 throw BadInput(
static_cast<std::string
>(
209 "[Density]: Failed to insert field map and/or local field!\n[Density]: ")
210 +
static_cast<std::string
>(e.
what()));
218 if (param ==
"InitChain")
222 if (param ==
"PreTimeStepChain")
224 return preTimeStep();
226 if (param ==
"PostTimeStepChain")
228 return postTimeStep();
230 if (param ==
"OutputChain")
240 this->sim->m_field_map[
"Density"] = (*this->module_field);
246 this->sub_module_chain.runChain(
"InitChain");
254 this->sub_module_chain.runChain(
"PreTimeStepChain");
Managing module that calculates bulk density based on submodules.
Definition Density.h:37
bool setup(std::vector< std::shared_ptr< GenericSubmodule< T > > > all_submodules) override
Setup method called after construction.
Definition Density.h:190
static std::string getName()
Get the name of the module.
Definition Density.h:159
bool init() override
Initialization step.
Definition Density.h:244
bool exec(std::string_view param) override
Main execution method of the module.
Definition Density.h:216
bool preTimeStep() override
Pre-time-step processing.
Definition Density.h:252
std::vector< std::string > getChainInsertion() const override
Get chain insertion points.
Definition Density.h:136
bool output() override
Output stage.
Definition Density.h:119
std::string_view getNameLocal() const override
Get the localized name of the module.
Definition Density.h:166
void writeToSim()
Write the current density field to the simulation.
Definition Density.h:238
bool postTimeStep() override
Post-time-step processing.
Definition Density.h:110
static std::shared_ptr< GenericManagingModule< T > > createMethode(SimulationClassBase< T > *sim)
Factory method for creating a Density module.
Definition Density.h:149
Density(SimulationClassBase< T > *sim)
Construct the Density module.
Definition Density.h:172
Abstract base class for the managing modules. Managing modules are the highest tier of modules and ar...
Definition GenericManagingModule.h:29
InputManager ini_file_data
Definition GenericManagingModule.h:38
SimulationClassBase< T > * sim
Definition GenericManagingModule.h:31
std::vector< std::string > m_generic_submodules
Definition GenericManagingModule.h:36
Abstract base class for the submodules. Submodules are below managing modules and will only be run by...
Definition GenericSubmodule.h:25
static constexpr bool registerModule(std::string name, creation_method module) noexcept
Function that adds a module to the module registry map.
Definition ModuleFactory.h:76
Definition SimulationClassBase.h:19
InputManager m_simulation_config
Definition SimulationClassBase.h:29