MIDSX 0.1
A x-ray transport code system for dosimetry
Loading...
Searching...
No Matches
interaction_data.h
Go to the documentation of this file.
1
4#ifndef MC_XRAY_TRANSPORT_PHYSICS_ENGINE_DATA_SERVICE_H
5#define MC_XRAY_TRANSPORT_PHYSICS_ENGINE_DATA_SERVICE_H
6
7#include "data_access_object.h"
8#include "interpolators.h"
9#include "material.h"
10#include "config.h"
11#include <iostream>
12#include <memory>
13#include <map>
14
15namespace {
16 // anonymous namespace. only accessible in this file
20 const std::string MIDSX_DB_DIR_VAR = MIDSX_DB_DIR;
21 const std::string MIDSX_DB_NAME = "midsx.db";
22 const std::string MIDSX_DB_PATH = MIDSX_DB_DIR_VAR + "/" + MIDSX_DB_NAME;
23}
24
31public:
37 explicit InteractionData(const std::vector<std::string>& material_names);
38
45 Material& getMaterialFromId(int id) { return material_map_.at(id); }
46
55 Eigen::Matrix<double, Eigen::Dynamic, 2> getMaxTotalCrossSectionsMatrix() const { return max_total_cs_matrix_; }
56
63 double interpolateMaxTotalCrossSection(double energy) const { return (max_total_cs_interpolator_)(energy); }
64
71 std::string getAnyMaterialNameFromId(int id);
72
79 uint8_t getAnyMaterialIdFromName(std::string name);
80private:
82 std::vector<std::string> material_names_;
83 std::map<int, Material> material_map_;
84 Eigen::Matrix<double, Eigen::Dynamic, 2> max_total_cs_matrix_;
85 Interpolator::LogLogLinear max_total_cs_interpolator_;
86
91
98
103
112 Eigen::Matrix<double, Eigen::Dynamic, 2> getTotalMaxCrossSectionsMatrixFromInteractionData();
113
120 void fillTotalMaxCrossSectionsMatrix(Eigen::MatrixXd& total_max_cross_sections_matrix, const Eigen::MatrixXd& merged_energy_matrix);
121};
122
123#endif //MC_XRAY_TRANSPORT_PHYSICS_ENGINE_DATA_SERVICE_H
Class which provides an interface to a SQLite database.
Class which provides access to various simulation significant data.
void setMaxTotalCrossSectionsAndInterpolator()
Sets the maximum total cross sections and interpolator for the InteractionData object.
double interpolateMaxTotalCrossSection(double energy) const
Returns the maximum total cross section for all materials at the given energy.
uint8_t getAnyMaterialIdFromName(std::string name)
Returns the ID of the material with the given name.
InteractionData(const std::vector< std::string > &material_names)
Constructor for the InteractionData class.
Eigen::Matrix< double, Eigen::Dynamic, 2 > getTotalMaxCrossSectionsMatrixFromInteractionData()
Returns the 2 column matrix containing the maximum total cross sections for all materials.
void initializeData()
Initializes the data for the InteractionData object.
void setMaterialMap()
Sets the material map for the InteractionData object.
void fillTotalMaxCrossSectionsMatrix(Eigen::MatrixXd &total_max_cross_sections_matrix, const Eigen::MatrixXd &merged_energy_matrix)
Fills the total max cross sections matrix with the maximum total cross sections for all materials.
Material & getMaterialFromId(int id)
Returns the Material object with the given ID.
Eigen::Matrix< double, Eigen::Dynamic, 2 > getMaxTotalCrossSectionsMatrix() const
Returns the 2 column matrix containing the maximum total cross sections for all materials.
std::string getAnyMaterialNameFromId(int id)
Returns the name of the material with the given ID.
Class which performs linear interpolation on a log-log scale.
Class which represents a material.
Definition material.h:19