16#include <unordered_map>
17#include "yaml-cpp/yaml.h"
19#include "PrismConstants.h"
96 Reaction(
const YAML::Node & rxn_input,
98 const std::string & data_path =
"",
99 const std::string & bib_file =
"",
100 const bool check_refs =
true,
101 const bool read_xsec_files =
true,
102 const std::string & delimiter =
" ");
107 const std::string &
expression()
const {
return _expression; }
119 ReactionId
id()
const {
return _id; }
123 const std::vector<std::string> &
references()
const {
return _references; }
127 const std::vector<std::string> &
notes()
const {
return _notes; }
143 const std::vector<SpeciesData> &
reactantData()
const {
return _reactant_data; }
147 const std::vector<SpeciesData> &
productData()
const {
return _product_data; }
156 const std::vector<std::shared_ptr<const Species>>
species()
const;
172 const std::vector<TabulatedReactionData> &
tabulatedData()
const;
206 double sampleData(
const double T_e,
const double T_g = 0)
const {
return _sampler(T_e, T_g); }
208 std::string to_string()
const;
210 friend std::string to_string(
const std::shared_ptr<prism::Reaction> & s);
211 friend std::string to_string(
const std::shared_ptr<const prism::Reaction> & s);
212 friend std::ostream & operator<<(std::ostream & os,
const std::shared_ptr<prism::Reaction> & s);
213 friend std::ostream & operator<<(std::ostream & os,
214 const std::shared_ptr<const prism::Reaction> & s);
219 friend class NetworkParser;
224 std::string checkExpression(
const YAML::Node & rxn_input);
230 unsigned int getCoeff(std::string & s);
238 void validateReaction();
240 void setLatexRepresentation();
242 void substituteLumped();
244 void checkReferences();
246 void collectUniqueSpecies();
248 void setSpeciesData();
254 double interpolator(
const double T_e,
const double T_g)
const;
256 double constantRate(
const double T_e,
const double T_g)
const;
257 double partialArrhenius1(
const double T_e,
const double T_g)
const;
258 double partialArrhenius2(
const double T_e,
const double T_g)
const;
259 double partialArrhenius3(
const double T_e,
const double T_g)
const;
260 double fullArrhenius(
const double T_e,
const double T_g)
const;
262 std::function<double(
double,
double)> _sampler;
264 const ReactionId _id;
266 const std::string _data_path;
268 const std::string _expression;
270 const double _delta_eps_e;
272 const double _delta_eps_g;
274 const bool _is_elastic;
276 const std::string _bib_file;
278 const std::vector<std::string> _references;
280 bool _has_tabulated_data;
282 std::vector<std::string> _notes;
284 std::vector<double> _params;
286 std::vector<TabulatedReactionData> _tabulated_data;
288 std::vector<std::weak_ptr<Species>> _species;
290 std::unordered_map<std::string, int> _stoic_coeffs;
292 std::unordered_map<SpeciesId, int> _id_stoic_map;
294 std::string _latex_expression;
299 std::vector<std::weak_ptr<Species>> _reactants;
300 std::vector<std::weak_ptr<Species>> _products;
301 std::unordered_map<std::string, unsigned int> _reactant_count;
302 std::unordered_map<std::string, unsigned int> _product_count;
309 std::vector<SpeciesData> _reactant_data;
310 std::vector<SpeciesData> _product_data;
316struct std::hash<prism::Reaction>
Stores all of the data needed to perform calculations with a specific reaction.
Definition Reaction.h:73
double deltaEnergyElectron() const
Self descriptive getter method.
Definition Reaction.h:135
const std::vector< std::shared_ptr< const Species > > species() const
Getter method for the list of species in this reaction this is a relatively expensive method and call...
Definition Reaction.C:195
const std::string getReferencesAsString() const
Getter method for getting cite keys formatted for LaTeX.
Definition Reaction.C:681
bool hasTabulatedData() const
Self descriptive getter method.
Definition Reaction.h:131
const std::string & latexRepresentation() const
Self descriptive getter method.
Definition Reaction.h:111
Reaction(const YAML::Node &rxn_input, const int rxn_id=0, const std::string &data_path="", const std::string &bib_file="", const bool check_refs=true, const bool read_xsec_files=true, const std::string &delimiter=" ")
Definition Reaction.C:29
bool operator!=(const Reaction &other) const
returns not == operator overload
Definition Reaction.C:675
const std::string & expression() const
Self descriptive getter method.
Definition Reaction.h:107
const std::vector< std::string > & references() const
Self descriptive getter method.
Definition Reaction.h:123
bool operator==(const Reaction &other) const
equality operator override and compares the reaction name the latex name of the reaction and the reac...
Definition Reaction.C:660
const std::vector< TabulatedReactionData > & tabulatedData() const
Retrurns a reference to the struct containing data read from a file.
Definition Reaction.C:650
const std::vector< SpeciesData > & reactantData() const
Self descriptive getter method.
Definition Reaction.h:143
int getStoicCoeffById(const SpeciesId id) const
Get the stoiciometric coefficient for a species in this reaction by its id.
Definition Reaction.C:705
double deltaEnergyGas() const
Self descriptive getter method.
Definition Reaction.h:139
bool isElastic() const
Wether or not the user set a reaction as elastic or not.
Definition Reaction.h:151
const std::vector< SpeciesData > & productData() const
Self descriptive getter method.
Definition Reaction.h:147
int getStoicCoeffByName(const std::string &s_expression) const
Get the stoiciometric coefficient for a species in this reaction by the name that represents it Ex: "...
Definition Reaction.C:694
friend class SpeciesFactory
SpeciesFactor is a friend so that it can access the species in this reaction.
Definition Reaction.h:218
double sampleData(const double T_e, const double T_g=0) const
Samples data at the point T_e and T_g based on the provided parameters If the reaction object has tab...
Definition Reaction.h:206
const std::vector< double > & functionParams() const
Returns a reference to the function parameters if there is functional data.
Definition Reaction.C:640
const std::vector< std::string > & notes() const
Self descriptive getter method.
Definition Reaction.h:127
ReactionId id() const
Self descriptive getter method note that Reactions ids are based on the block reactions are in all re...
Definition Reaction.h:119
Struct for quickly accessing data about which speies are in a reaction.
Definition Reaction.h:61
SpeciesId id
the unique id for the species (guaranteed to be in the range 0-(n-1) where n in the number unique spe...
Definition Reaction.h:63
unsigned int occurances
the number of times the species occurs on a side of the reaction
Definition Reaction.h:65
Struct for holding tabulated data read from user provided files.
Definition Reaction.h:28
bool operator<(const double other) const
< operator only compares the energy values this is used for sorting and to be able to use other stand...
Definition Reaction.h:45
double value
where the data from the secdon column of the file is stored
Definition Reaction.h:32
bool operator<(const TabulatedReactionData &other) const
< operator only compares the energy values this is used for sorting and to be able to use other stand...
Definition Reaction.h:39
double energy
where the data from the first column of the file is stored
Definition Reaction.h:30
bool operator==(const TabulatedReactionData &other) const
equality operator checks to make sure both values are in the struct are the same
Definition Reaction.h:50
size_t operator()(const prism::Reaction &obj) const
Override for the hash method hash is based on std::string representation of the reaction the reaction...