1#ifndef SOLAR_VECTOR_VARIABLE_SPICE_H
2#define SOLAR_VECTOR_VARIABLE_SPICE_H
18#include "../../src/GenericSubmodule.h"
19#include "../../src/ModuleFactory.h"
44 static bool m_registered;
45 std::string m_ini_filepath{
"solar_vector/SolarVectorVariableSpice.ini"};
46 std::valarray<T> m_solar_vector;
62 bool exec(std::string_view
param)
override;
65 bool preTimeStep()
override;
66 bool postTimeStep()
override {
return true; };
67 bool output()
override {
return true; };
69 void calculateSolarVector();
71 void setFieldPtr(std::shared_ptr<std::valarray<T>>
field_ptr)
override
78 return std::make_shared<SolarVectorVariableSpice<T>>(sim);
80 static std::string getName() {
return "SolarVectorVariableSpice"; }
81 std::string_view getNameLocal()
const override {
return "SolarVectorVariableSpice"; };
82 std::vector<std::string> getDependencies()
const override
84 return this->ini_file_data.getStringVectorParameters(
"dependencies");
97 this->sim->m_simulation_config.getStringParameters(
"ini_folder_path")};
99 this->m_generic_submodules = this->ini_file_data.getStringVectorParameters(
"submodules");
103 std::cerr <<
e.what() <<
'\n';
111 m_solar_vector.resize(3);
119 if (
param ==
"InitChain")
123 if (
param ==
"PreTimeStepChain")
125 return preTimeStep();
127 if (
param ==
"PostTimeStepChain")
129 return postTimeStep();
131 if (
param ==
"OutputChain")
142 this->m_et = this->m_start_time_et + this->sim->elapsed_time;
144 spkpos_c(this->m_target, this->m_et, this->m_rotating_frame_id.c_str(),
"NONE",
145 this->m_observer_id.c_str(),
this->m_body_center_to_sun_vector_rotating,
146 &
this->m_light_time);
149 for (
int i{0};
i < 3;
i++)
151 (*this->module_field)[
i] = this->m_body_center_to_sun_vector_rotating[
i] * 1000;
158 calculateSolarVector();
166 if (this->sim->my_rank == 0)
168 std::cout <<
"[SolarVectorVariableSpice] Loading SPICE kernels.\n";
170 furnsh_c(this->ini_file_data.getStringParameters(
"spice_metakernel_path").c_str());
171 if (this->sim->my_rank == 0)
173 std::cout <<
"[SolarVectorVariableSpice] Done.\n";
177 this->m_start_time_utc = this->ini_file_data.getStringParameters(
"start_time_utc");
178 str2et_c(this->m_start_time_utc.c_str(), &
this->m_start_time_et);
180 this->m_observer_id = this->ini_file_data.getStringParameters(
"object_id");
181 this->m_reference_frame_id = this->ini_file_data.getStringParameters(
"reference_frame_id");
182 this->m_rotating_frame_id = this->ini_file_data.getStringParameters(
"rotating_frame_id");
183 if (this->sim->my_rank == 0)
185 std::cout <<
"[SolarVectorVariableSpice] Loaded parameters.\n";
188 calculateSolarVector();
Concrete implementation of a matrix class representing a Compressed Sparse Rows (CSR) matrix....
Definition CsrMatrix.h:35
CsrSparseMatrix()
Constructor for an empty CsrSparseMatrix object. Leaves all storage arrays empty but sets the flag to...
Definition CsrMatrix.h:92
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:75