PRISM
 v0.0.0
Loading...
Searching...
No Matches
Species.h
1#pragma once
2
3#include "SpeciesBase.h"
4#include "Constants.h"
5
6#include <vector>
7#include <memory>
8
9namespace prism
10{
11
21{
23 ReactionId id;
27};
28
29class Reaction;
30class SubSpecies;
31
36class Species : public SpeciesBase
37{
38public:
43 Species(const std::string & name);
48 SpeciesId id() const { return _id; }
50 bool operator==(const Species & other) const;
52 bool operator!=(const Species & other) const;
60 const std::vector<std::shared_ptr<const Reaction>> rateBasedReactions() const
61 {
62 return convertToSharedPtr(_rate_based);
63 }
71 const std::vector<std::shared_ptr<const Reaction>> xsecBasedReactions() const
72 {
73 return convertToSharedPtr(_xsec_based);
74 }
82 const std::vector<std::shared_ptr<const Reaction>> tabulatedRateBasedReactions() const
83 {
84 return convertToSharedPtr(_tabulated_rate_based);
85 }
93 const std::vector<std::shared_ptr<const Reaction>> functionRateBasedReactions() const
94 {
95 return convertToSharedPtr(_function_rate_based);
96 }
104 const std::vector<std::shared_ptr<const Reaction>> tabulatedXSecBasedReactions() const
105 {
106 return convertToSharedPtr(_tabulated_xsec_based);
107 }
115 const std::vector<std::shared_ptr<const Reaction>> functionXSecBasedReactions() const
116 {
117 return convertToSharedPtr(_function_xsec_based);
118 }
123 const std::vector<ReactionData> & rateBasedReactionData() const { return _rate_based_data; }
128 const std::vector<ReactionData> & tabulatedRateBasedReactionData() const
129 {
130 return _tabulated_rate_based_data;
131 }
136 const std::vector<ReactionData> & functionRateBasedReactionData() const
137 {
138 return _function_rate_based_data;
139 }
144 const std::vector<ReactionData> & xsecBasedReactionData() const { return _xsec_based_data; }
149 const std::vector<ReactionData> & tabulatedXSecBasedReactionData() const
150 {
151 return _tabulated_xsec_based_data;
152 }
157 const std::vector<ReactionData> & functionXSecBasedReactionData() const
158 {
159 return _function_xsec_based_data;
160 }
167 const std::vector<ReactionData> & unbalancedRateBasedReactionData() const
168 {
169 return _unbalanced_rate_based_data;
170 }
177 const std::vector<ReactionData> & unbalancedTabulatedRateBasedReactionData() const
178 {
179 return _unbalanced_tabulated_rate_based_data;
180 }
187 const std::vector<ReactionData> & unbalancedFunctionRateBasedReactionData() const
188 {
189 return _unbalanced_function_rate_based_data;
190 }
197 const std::vector<ReactionData> & unbalancedXSecBasedReactionData() const
198 {
199 return _unbalanced_xsec_based_data;
200 }
207 const std::vector<ReactionData> & unbalancedTabulatedXSecBasedReactionData() const
208 {
209 return _unbalanced_tabulated_xsec_based_data;
210 }
217 const std::vector<ReactionData> & unbalancedFunctionXSecBasedReactionData() const
218 {
219 return _unbalanced_function_xsec_based_data;
220 }
222 const std::vector<SubSpecies> & subSpecies() const { return _sub_species; }
227 const std::string & neutralGroundState() const { return _neutral_ground_state; }
228
229private:
231 friend class SpeciesFactory;
232 SpeciesId _id;
234 const std::vector<SubSpecies> _sub_species;
236 const std::string _neutral_ground_state;
239 std::vector<ReactionData> _rate_based_data;
240 std::vector<ReactionData> _tabulated_rate_based_data;
241 std::vector<ReactionData> _function_rate_based_data;
242 std::vector<ReactionData> _unbalanced_rate_based_data;
243 std::vector<ReactionData> _unbalanced_tabulated_rate_based_data;
244 std::vector<ReactionData> _unbalanced_function_rate_based_data;
245 std::vector<std::weak_ptr<const Reaction>> _rate_based;
246 std::vector<std::weak_ptr<const Reaction>> _tabulated_rate_based;
247 std::vector<std::weak_ptr<const Reaction>> _function_rate_based;
249
251 std::vector<ReactionData> _xsec_based_data;
252 std::vector<ReactionData> _tabulated_xsec_based_data;
253 std::vector<ReactionData> _function_xsec_based_data;
254 std::vector<ReactionData> _unbalanced_xsec_based_data;
255 std::vector<ReactionData> _unbalanced_tabulated_xsec_based_data;
256 std::vector<ReactionData> _unbalanced_function_xsec_based_data;
257 std::vector<std::weak_ptr<const Reaction>> _xsec_based;
258 std::vector<std::weak_ptr<const Reaction>> _tabulated_xsec_based;
259 std::vector<std::weak_ptr<const Reaction>> _function_xsec_based;
261
263 void setLatexName() override;
268 const std::vector<SubSpecies> decomposeSpecies();
270 void setMass() override;
272 void setCharge() override;
274 std::string setNeutralGroundState() const;
276 const std::vector<std::shared_ptr<const Reaction>>
277 convertToSharedPtr(const std::vector<std::weak_ptr<const Reaction>> & vec) const;
278
279 void setId(SpeciesId id) { _id = id; }
280};
281}
282
283template <>
284struct std::hash<prism::Species>
285{
294 size_t operator()(const prism::Species & obj) const;
295};
Stores all of the data needed to perform calculations with a specific reaction.
Definition Reaction.h:63
Base class for species and subspecies.
Definition SpeciesBase.h:11
const std::string & name() const
Getter method for the name of species.
Definition SpeciesBase.h:23
This factory creates and stores, and passes around all of the species that exist in a reaction mechan...
Definition SpeciesFactory.h:21
The species object which represents the products and reactants in the reaction.
Definition Species.h:37
const std::vector< ReactionData > & tabulatedRateBasedReactionData() const
Getter methods for the reaction data of specific types this species.
Definition Species.h:128
const std::vector< ReactionData > & xsecBasedReactionData() const
Getter methods for the reaction data of specific types this species.
Definition Species.h:144
const std::vector< std::shared_ptr< const Reaction > > functionXSecBasedReactions() const
Getter methods for the reactions of specific types this species is either a product or reactant of Wa...
Definition Species.h:115
const std::vector< ReactionData > & unbalancedTabulatedRateBasedReactionData() const
Getter methods for the reaction data of specific types this species.
Definition Species.h:177
const std::vector< std::shared_ptr< const Reaction > > tabulatedXSecBasedReactions() const
Getter methods for the reactions of specific types this species is either a product or reactant of Wa...
Definition Species.h:104
const std::vector< SubSpecies > & subSpecies() const
Getter method for the subspecies list.
Definition Species.h:222
SpeciesId id() const
getter for the unique id for the species
Definition Species.h:48
const std::vector< std::shared_ptr< const Reaction > > rateBasedReactions() const
Getter methods for the reactions of specific types this species is either a product or reactant of Wa...
Definition Species.h:60
const std::vector< ReactionData > & unbalancedFunctionXSecBasedReactionData() const
Getter methods for the reaction data of specific types this species getting the unbalanced data only ...
Definition Species.h:217
Species(const std::string &name)
Constructor for the species based on its symbolic representation.
Definition Species.C:12
const std::vector< ReactionData > & rateBasedReactionData() const
Getter methods for the reaction data of specific types this species.
Definition Species.h:123
const std::vector< ReactionData > & unbalancedFunctionRateBasedReactionData() const
Getter methods for the reaction data of specific types this species.
Definition Species.h:187
const std::vector< std::shared_ptr< const Reaction > > xsecBasedReactions() const
Getter methods for the reactions of specific types this species is either a product or reactant of Wa...
Definition Species.h:71
const std::vector< ReactionData > & tabulatedXSecBasedReactionData() const
Getter methods for the reaction data of specific types this species.
Definition Species.h:149
const std::vector< std::shared_ptr< const Reaction > > functionRateBasedReactions() const
Getter methods for the reactions of specific types this species is either a product or reactant of Wa...
Definition Species.h:93
bool operator!=(const Species &other) const
Comparison for checking whether or not the two are not equal
Definition Species.C:115
const std::vector< std::shared_ptr< const Reaction > > tabulatedRateBasedReactions() const
Getter methods for the reactions of specific types this species is either a product or reactant of Wa...
Definition Species.h:82
const std::vector< ReactionData > & unbalancedTabulatedXSecBasedReactionData() const
Getter methods for the reaction data of specific types this species getting the unbalanced data only ...
Definition Species.h:207
const std::vector< ReactionData > & functionXSecBasedReactionData() const
Getter methods for the reaction data of specific types this species.
Definition Species.h:157
const std::vector< ReactionData > & unbalancedXSecBasedReactionData() const
Getter methods for the reaction data of specific types this species getting the unbalanced data only ...
Definition Species.h:197
bool operator==(const Species &other) const
Comparison operator checks if the sub species have the same member variables.
Definition Species.C:93
const std::vector< ReactionData > & unbalancedRateBasedReactionData() const
Getter methods for the reaction data of specific types this species getting the unbalanced data only ...
Definition Species.h:167
const std::string & neutralGroundState() const
Getter method for the ground neutral state Ex: 2Ar* -> Ar.
Definition Species.h:227
const std::vector< ReactionData > & functionRateBasedReactionData() const
Getter methods for the reaction data of specific types this species.
Definition Species.h:136
The parts with a Species can be brokenup into Eg Speices: NH3, SubSpecies: [N, H3].
Definition SubSpecies.h:16
Struct for a quick way to access which reactions the species is in Since we keep track of rate_based ...
Definition Species.h:21
ReactionId id
the id of a given reaction that this species is a part of
Definition Species.h:23
int stoic_coeff
the species stoichiometry for the species in the reaction with the prescribed if
Definition Species.h:26
size_t operator()(const prism::Species &obj) const
Hash method for species hashing is based on the hash of each subspecies the total mass the charge num...