1#ifndef SOLAR_VECTOR_CONSTANT_CUSTOM_H
2#define SOLAR_VECTOR_CONSTANT_CUSTOM_H
4#define SOLAR_VECTOR_CONSTANT_CUSTOM_VERSION "6"
12#include "../../src/GenericSubmodule.h"
13#include "../../src/ModuleFactory.h"
31 static bool m_registered;
32 std::string m_ini_filepath{
"solar_vector/SolarVectorConstantCustom.ini"};
33 std::valarray<T> m_solar_vector;
42 bool exec(std::string_view
param)
override;
48 bool output()
override {
return true; };
59 return std::make_shared<SolarVectorConstantCustom<T>>(
sim);
61 static std::string
getName() {
return "SolarVectorConstantCustom"; }
62 std::string_view
getNameLocal()
const override {
return "SolarVectorConstantCustom"; };
78 this->sim->m_simulation_config.getStringParameters(
"ini_folder_path")};
84 std::cerr <<
"[SolarVectorConstantCustom]: " <<
e.what() <<
'\n';
85 throw BadInput(
static_cast<std::string
>(
"[SolarVectorConstantCustom]: ")
86 +
static_cast<std::string
>(
e.what()));
94 m_solar_vector.resize(3);
98 this->ini_file_data.getDoubleParameters(
"polar_angle") * std::numbers::pi / 180;
99 m_azimuth = this->ini_file_data.getDoubleParameters(
"azimuth") * std::numbers::pi / 180;
103 std::cerr <<
"[SolarVectorConstantCustom]: " <<
e.what() <<
'\n';
104 throw BadInput(
static_cast<std::string
>(
"[SolarVectorConstantCustom]: ")
105 +
static_cast<std::string
>(
e.what()));
107 this->m_solar_vector[0] = std::sin(m_polar_angle) * std::cos(m_azimuth);
108 this->m_solar_vector[1] = std::sin(m_polar_angle) * std::sin(m_azimuth);
109 this->m_solar_vector[2] = std::cos(m_polar_angle);
116 if (
param ==
"InitChain")
120 if (
param ==
"PreTimeStepChain")
122 return preTimeStep();
124 if (
param ==
"PostTimeStepChain")
126 return postTimeStep();
128 if (
param ==
"OutputChain")
138 (*this->module_field) = this->m_solar_vector;
144 calculateSolarVector();
151 calculateSolarVector();
Concrete implementation of a matrix class representing a Compressed Sparse Rows (CSR) matrix....
Definition CsrMatrix.h:37
Abstract base class for the submodules. Submodules are below managing modules and will only be run by...
Definition GenericSubmodule.h:25
InputManager ini_file_data
Definition GenericSubmodule.h:36
std::vector< std::string > m_generic_submodules
Definition GenericSubmodule.h:34
const SimulationClassBase< T > * sim
Definition GenericSubmodule.h:32
std::shared_ptr< std::valarray< T > > module_field
Definition GenericSubmodule.h:29
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 SolarVectorConstantCustom.h:29
std::string_view getNameLocal() const override
Definition SolarVectorConstantCustom.h:62
bool init() override
Definition SolarVectorConstantCustom.h:149
bool setup(std::vector< std::shared_ptr< GenericSubmodule< T > > > all_submodules) override
Definition SolarVectorConstantCustom.h:91
bool preTimeStep() override
Definition SolarVectorConstantCustom.h:142
bool postTimeStep() override
Definition SolarVectorConstantCustom.h:47
void calculateSolarVector()
Definition SolarVectorConstantCustom.h:136
std::vector< std::string > getDependencies() const override
Definition SolarVectorConstantCustom.h:63
SolarVectorConstantCustom(SimulationClassBase< T > *sim)
Definition SolarVectorConstantCustom.h:72
bool exec(std::string_view param) override
Definition SolarVectorConstantCustom.h:114
static std::string getName()
Definition SolarVectorConstantCustom.h:61
static std::shared_ptr< GenericSubmodule< T > > createMethode(SimulationClassBase< T > *sim)
Definition SolarVectorConstantCustom.h:57
void setFieldPtr(std::shared_ptr< std::valarray< T > > field_ptr) override
Definition SolarVectorConstantCustom.h:52
bool output() override
Definition SolarVectorConstantCustom.h:48