|
fourdst::libcomposition v2.3.1
Robust atomic species information library
|
Manages a collection of chemical species and their abundances. More...
#include <composition.h>
Classes | |
| struct | CompositionCache |
| Caches computed properties of the composition to avoid redundant calculations. More... | |
Public Types | |
| using | iterator = detail::CompositionIterator<false> |
| using | const_iterator = detail::CompositionIterator<true> |
Public Types inherited from fourdst::composition::CompositionAbstract | |
| using | iterator = detail::CompositionIterator<false> |
| using | const_iterator = detail::CompositionIterator<true> |
Public Member Functions | |
| Composition ()=default | |
| Default constructor. | |
| ~Composition () override=default | |
| Default destructor. | |
| Composition (const std::vector< std::string > &symbols) | |
| Constructs a Composition and registers the given symbols from a vector. | |
| Composition (const std::vector< atomic::Species > &species) | |
| Constructs a Composition and registers the given species from a vector. | |
| Composition (const std::set< std::string > &symbols) | |
| Constructs a Composition and registers the given symbols from a set. | |
| Composition (const std::set< atomic::Species > &species) | |
| Constructs a Composition and registers the given species from a set. | |
| Composition (const std::unordered_set< std::string > &symbols) | |
| Composition (const std::unordered_set< atomic::Species > &species) | |
| Composition (const std::vector< std::string > &symbols, const std::vector< double > &molarAbundances) | |
| Constructs a Composition from symbols and their corresponding molar abundances. | |
| Composition (const std::vector< atomic::Species > &species, const std::vector< double > &molarAbundances) | |
| Constructs a Composition from species and their corresponding molar abundances. | |
| Composition (const std::set< std::string > &symbols, const std::vector< double > &molarAbundances) | |
| Constructs a Composition from symbols in a set and their corresponding molar abundances. | |
| Composition (const std::unordered_map< std::string, double > &symbolMolarAbundances) | |
| Composition (const std::map< std::string, double > &symbolMolarAbundances) | |
| Composition (const std::unordered_map< atomic::Species, double > &speciesMolarAbundances) | |
| Composition (const std::map< atomic::Species, double > &speciesMolarAbundances) | |
| Composition (const Composition &composition) | |
| Constructs a Composition from another Composition. | |
| Composition (const CompositionAbstract &composition) | |
| Composition & | operator= (Composition const &other) |
| Assignment operator. | |
| Composition & | operator= (const CompositionAbstract &other) |
| void | registerSymbol (const std::string &symbol) |
| Registers a new symbol for inclusion in the composition. | |
| void | registerSymbol (const std::vector< std::string > &symbols) |
| Registers multiple new symbols. | |
| void | registerSpecies (const atomic::Species &species) noexcept |
| Registers a new species by extracting its symbol. | |
| void | registerSpecies (const std::vector< atomic::Species > &species) noexcept |
| Registers a vector of new species. | |
| bool | contains (const atomic::Species &species) const noexcept override |
| Checks if a given species is present in the composition. | |
| bool | contains (const std::string &symbol) const override |
| Checks if a given symbol is present in the composition. | |
| size_t | size () const noexcept override |
| Gets the number of registered species in the composition. | |
| void | setMolarAbundance (const std::string &symbol, const double &molar_abundance) |
| Sets the molar abundance for a given symbol. | |
| void | setMolarAbundance (const atomic::Species &species, const double &molar_abundance) |
| Sets the molar abundance for a given isotope. | |
| void | setMolarAbundance (const std::vector< std::string > &symbols, const std::vector< double > &molar_abundances) |
| Sets the molar abundances for a list of symbols. | |
| void | setMolarAbundance (const std::vector< atomic::Species > &species, const std::vector< double > &molar_abundances) |
| Sets the molar abundances for a list of isotopes. | |
| void | setMolarAbundance (const std::set< std::string > &symbols, const std::vector< double > &molar_abundances) |
| Sets the molar abundances for a set of symbols. | |
| void | setMolarAbundance (const std::set< atomic::Species > &species, const std::vector< double > &molar_abundances) |
| Sets the molar abundances for a set of isotopes. | |
| std::set< std::string > | getRegisteredSymbols () const noexcept override |
| Gets the registered symbols. | |
| const std::vector< atomic::Species > & | getRegisteredSpecies () const noexcept override |
| Get a set of all species that are registered in the composition. | |
| std::unordered_map< atomic::Species, double > | getMassFraction () const noexcept override |
| Gets the mass fractions of all species in the composition. | |
| double | getMassFraction (const std::string &symbol) const override |
| Gets the mass fraction for a given symbol. See the overload for species-based lookup for more details on how mass fractions are calculated. | |
| double | getMassFraction (const atomic::Species &species) const override |
| Gets the mass fraction for a given species. | |
| double | getNumberFraction (const std::string &symbol) const override |
| Gets the number fraction for a given symbol. See the overload for species-based lookup for more details on how number fractions are calculated. | |
| double | getNumberFraction (const atomic::Species &species) const override |
| Gets the number fraction for a given species. | |
| std::unordered_map< atomic::Species, double > | getNumberFraction () const noexcept override |
| Gets the number fractions of all species in the composition. | |
| double | getMolarAbundance (const std::string &symbol) const override |
| Gets the molar abundances of all species in the composition. | |
| double | getMolarAbundance (const atomic::Species &species) const override |
| Gets the molar abundance for a given species. | |
| double | getMeanParticleMass () const noexcept override |
| Compute the mean particle mass of the composition. | |
| double | getElectronAbundance () const noexcept override |
| Compute the electron abundance of the composition. | |
| CanonicalComposition | getCanonicalComposition () const |
| Compute the canonical composition (X, Y, Z) of the composition. | |
| std::vector< double > | getMassFractionVector () const noexcept override |
| Get a uniform vector representation of the mass fraction stored in the composition object sorted such that the lightest species is at index 0 and the heaviest is at the last index. | |
| std::vector< double > | getNumberFractionVector () const noexcept override |
| Get a uniform vector representation of the number fractions stored in the composition object sorted such that the lightest species is at index 0 and the heaviest is at the last index. | |
| std::vector< double > | getMolarAbundanceVector () const noexcept override |
| Get a uniform vector representation of the molar abundances stored in the composition object sorted such that the lightest species is at index 0 and the heaviest is at the last index. | |
| size_t | getSpeciesIndex (const std::string &symbol) const override |
| get the index in the sorted vector representation for a given symbol | |
| size_t | getSpeciesIndex (const atomic::Species &species) const override |
| get the index in the sorted vector representation for a given symbol | |
| atomic::Species | getSpeciesAtIndex (size_t index) const override |
| Get the species at a given index in the sorted vector representation. | |
| std::unique_ptr< CompositionAbstract > | clone () const override |
| iterator | begin () override |
| Returns an iterator to the beginning of the molar abundance map. | |
| const_iterator | begin () const override |
| Returns a const iterator to the beginning of the molar abundance map. | |
| detail::CompositionIterator< false > | end () override |
| Returns an iterator to the end of the molar abundance map. | |
| detail::CompositionIterator< true > | end () const override |
| Returns a const iterator to the end of the molar abundance map. | |
| std::size_t | hash () const override |
Public Member Functions inherited from fourdst::composition::CompositionAbstract | |
| virtual | ~CompositionAbstract ()=default |
| Virtual destructor. | |
Private Types | |
| enum class | SpeciesIndexLookupError : uint8_t { NO_REGISTERED_SPECIES , SPECIES_NOT_FOUND } |
Private Member Functions | |
| std::expected< std::ptrdiff_t, SpeciesIndexLookupError > | findSpeciesIndex (const atomic::Species &species) const noexcept |
Static Private Member Functions | |
| static quill::Logger * | getLogger () |
| Gets the logger instance for the Composition class. This is static to ensure that all composition objects share the same logger instance. | |
| static std::vector< atomic::Species > | symbolVectorToSpeciesVector (const std::vector< std::string > &symbols) |
Private Attributes | |
| std::vector< atomic::Species > | m_species |
| std::vector< double > | m_molarAbundances |
| CompositionCache | m_cache |
| Cache for computed properties to avoid redundant calculations. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Composition &composition) |
| Overloaded output stream operator for Composition. | |
Manages a collection of chemical species and their abundances.
This class is a primary interface for defining and manipulating material compositions. In order to use the Composition class a user must first register symbols or species. Symbols are the string representation of a species (i.e. deuterium would be "H-2" whereas Beryllium 7 would be "Be-7") and then set the molar abundances. Species are the data structure fourdst::atomic::Species version. Here Deuterium would be represented by the Species fourdst::atomic::H_2 whereas Beryllium 7 would be fourdst::atomic::Be_7. Once the symbols/species have been registered the user can then set molar abundances.
Once the Composition object has been populated the user can query mass fractions, number fractions, electron abundances, mean particle mass, molar abundance, and Canonical (X, Y, Z) composition.
fourdst::composition::buildCompositionFromMassFractions which wll facilitate just that.| This | class throws various exceptions from fourdst::composition::exceptions for invalid operations, such as using unregistered symbols or providing invalid abundances. |
Definition at line 99 of file composition.h.
Definition at line 102 of file composition.h.
Definition at line 101 of file composition.h.
|
strongprivate |
| Enumerator | |
|---|---|
| NO_REGISTERED_SPECIES | |
| SPECIES_NOT_FOUND | |
Definition at line 146 of file composition.h.
|
default |
Default constructor.
Creates an empty Composition object. No symbols or species are registered initially; however, the user can register symbols or species later using the provided methods.
|
overridedefault |
Default destructor.
|
explicit |
Constructs a Composition and registers the given symbols from a vector.
| symbols | The symbols to register. |
| exceptions::UnknownSymbolError | if any symbol is invalid. Symbols are invalid if they are not registered at compile time in the atomic species database (fourdst/atomic/species.h). |
Definition at line 81 of file composition.cpp.
|
explicit |
Constructs a Composition and registers the given species from a vector.
| species | The species to register. |
Definition at line 85 of file composition.cpp.
|
explicit |
Constructs a Composition and registers the given symbols from a set.
| symbols | The symbols to register. |
| exceptions::UnknownSymbolError | if any symbol is invalid. Symbols are invalid if they are not registered at compile time in the atomic species database (fourdst/atomic/species.h). |
Constructors without molar abundances /// These all delegate to the ctor /// vector<Species> ///
Definition at line 65 of file composition.cpp.
|
explicit |
Constructs a Composition and registers the given species from a set.
| species | The species to register. |
Definition at line 69 of file composition.cpp.
|
explicit |
Definition at line 73 of file composition.cpp.
|
explicit |
Definition at line 77 of file composition.cpp.
| fourdst::composition::Composition::Composition | ( | const std::vector< std::string > & | symbols, |
| const std::vector< double > & | molarAbundances ) |
Constructs a Composition from symbols and their corresponding molar abundances.
| symbols | The symbols to register. |
| molarAbundances | The corresponding molar abundances for each symbol. |
| exceptions::UnknownSymbolError | if any symbol is invalid. Symbols are invalid if they are not registered at compile time in the atomic species database (fourdst/atomic/species.h). |
| exceptions::InvalidCompositionError | if the number of symbols does not match the number of molar abundances. |
Constructors with molar abundances /// These all delegate to the ctor /// vector<Species, vector<double>> ///
Definition at line 105 of file composition.cpp.
| fourdst::composition::Composition::Composition | ( | const std::vector< atomic::Species > & | species, |
| const std::vector< double > & | molarAbundances ) |
Constructs a Composition from species and their corresponding molar abundances.
| species | The species to register. |
| molarAbundances | The corresponding molar abundances for each species. |
| exceptions::InvalidCompositionError | if the number of species does not match the number of molar abundances. |
Definition at line 144 of file composition.cpp.
| fourdst::composition::Composition::Composition | ( | const std::set< std::string > & | symbols, |
| const std::vector< double > & | molarAbundances ) |
Constructs a Composition from symbols in a set and their corresponding molar abundances.
| symbols | The symbols to register. |
| molarAbundances | The corresponding molar abundances for each symbol. |
| exceptions::UnknownSymbolError | if any symbol is invalid. Symbols are invalid if they are not registered at compile time in the atomic species database (fourdst/atomic/species.h). |
| exceptions::InvalidCompositionError | if the number of symbols does not match the number of molar abundances. |
Definition at line 110 of file composition.cpp.
|
explicit |
Definition at line 116 of file composition.cpp.
|
explicit |
Definition at line 123 of file composition.cpp.
|
explicit |
Definition at line 130 of file composition.cpp.
|
explicit |
Definition at line 137 of file composition.cpp.
| fourdst::composition::Composition::Composition | ( | const Composition & | composition | ) |
Constructs a Composition from another Composition.
Copy and conversion constructors ///.
| composition | The Composition to copy. |
Definition at line 192 of file composition.cpp.
|
explicit |
Definition at line 197 of file composition.cpp.
|
inlinenodiscardoverridevirtual |
Returns a const iterator to the beginning of the molar abundance map.
Implements fourdst::composition::CompositionAbstract.
Definition at line 808 of file composition.h.
|
inlinenodiscardoverridevirtual |
Returns an iterator to the beginning of the molar abundance map.
Implements fourdst::composition::CompositionAbstract.
Definition at line 787 of file composition.h.
|
nodiscardoverridevirtual |
Implements fourdst::composition::CompositionAbstract.
Definition at line 226 of file composition.cpp.
|
nodiscardoverridevirtualnoexcept |
Checks if a given species is present in the composition.
| species | The isotope to check for. |
Implements fourdst::composition::CompositionAbstract.
Definition at line 693 of file composition.cpp.
|
nodiscardoverridevirtual |
Checks if a given symbol is present in the composition.
| symbol | The symbol to check for. |
| exceptions::UnknownSymbolError | if the symbol is not in the atomic species database. |
Implements fourdst::composition::CompositionAbstract.
Definition at line 699 of file composition.cpp.
|
inlinenodiscardoverridevirtual |
Returns a const iterator to the end of the molar abundance map.
Implements fourdst::composition::CompositionAbstract.
Definition at line 850 of file composition.h.
|
inlinenodiscardoverridevirtual |
Returns an iterator to the end of the molar abundance map.
Implements fourdst::composition::CompositionAbstract.
Definition at line 829 of file composition.h.
|
nodiscardprivatenoexcept |
Definition at line 713 of file composition.cpp.
|
nodiscard |
Compute the canonical composition (X, Y, Z) of the composition.
The canonical composition is defined as:
The canonical composition is computed by summing the mass fractions of all registered species in the composition according to their element type.
| exceptions::InvalidCompositionError | if, after constructing the canonical composition, the sum X + Y + Z is not approximately equal to 1.0 (within a tolerance of 1e-16) |
Definition at line 552 of file composition.cpp.
|
nodiscardoverridevirtualnoexcept |
Compute the electron abundance of the composition.
The electron abundance is calculated using the formula:
where:
Implements fourdst::composition::CompositionAbstract.
Definition at line 543 of file composition.cpp.
|
inlinestaticprivate |
Gets the logger instance for the Composition class. This is static to ensure that all composition objects share the same logger instance.
Definition at line 156 of file composition.h.
|
nodiscardoverridevirtualnoexcept |
Gets the mass fractions of all species in the composition.
Implements fourdst::composition::CompositionAbstract.
Definition at line 460 of file composition.cpp.
|
nodiscardoverridevirtual |
Gets the mass fraction for a given species.
The mass fraction X_i for a species is calculated using the formula:
where:
This formula ensures that the mass fractions of all species sum to 1.0.
| species | The species to get the mass fraction for. |
| exceptions::UnregisteredSymbolError | if the isotope is not registered in the composition. |
Implements fourdst::composition::CompositionAbstract.
Definition at line 440 of file composition.cpp.
|
nodiscardoverridevirtual |
Gets the mass fraction for a given symbol. See the overload for species-based lookup for more details on how mass fractions are calculated.
| symbol | The symbol to get the mass fraction for. |
| exceptions::UnknownSymbolError | if the symbol is not in the atomic species database. |
| exceptions::UnregisteredSymbolError | if the symbol is not in the composition. |
Implements fourdst::composition::CompositionAbstract.
Definition at line 432 of file composition.cpp.
|
nodiscardoverridevirtualnoexcept |
Get a uniform vector representation of the mass fraction stored in the composition object sorted such that the lightest species is at index 0 and the heaviest is at the last index.
This is primarily useful for external libraries which need to ensure that vector representation uniformity is maintained
Implements fourdst::composition::CompositionAbstract.
Definition at line 596 of file composition.cpp.
|
nodiscardoverridevirtualnoexcept |
Compute the mean particle mass of the composition.
The mean particle mass is calculated using the formula:
where:
Implements fourdst::composition::CompositionAbstract.
Definition at line 530 of file composition.cpp.
|
nodiscardoverridevirtual |
Gets the molar abundance for a given species.
| species | The species to get the molar abundance for. |
| exceptions::UnregisteredSymbolError | if the isotope is not registered in the composition. |
Implements fourdst::composition::CompositionAbstract.
Definition at line 515 of file composition.cpp.
|
nodiscardoverridevirtual |
Gets the molar abundances of all species in the composition.
| exceptions::UnknownSymbolError | if any symbol is not in the atomic species database. |
| exceptions::UnregisteredSymbolError | if any symbol is not in the composition. |
Implements fourdst::composition::CompositionAbstract.
Definition at line 504 of file composition.cpp.
|
nodiscardoverridevirtualnoexcept |
Get a uniform vector representation of the molar abundances stored in the composition object sorted such that the lightest species is at index 0 and the heaviest is at the last index.
This is primarily useful for external libraries which need to ensure that vector representation uniformity is maintained
Implements fourdst::composition::CompositionAbstract.
Definition at line 631 of file composition.cpp.
|
nodiscardoverridevirtualnoexcept |
Gets the number fractions of all species in the composition.
Implements fourdst::composition::CompositionAbstract.
Definition at line 496 of file composition.cpp.
|
nodiscardoverridevirtual |
Gets the number fraction for a given species.
The number fraction Y_i for a species is calculated using the formula:
where:
This formula ensures that the number fractions of all species sum to 1.0.
| species | The species to get the number fraction for. |
| exceptions::UnregisteredSymbolError | if the isotope is not registered in the composition. |
Implements fourdst::composition::CompositionAbstract.
Definition at line 479 of file composition.cpp.
|
nodiscardoverridevirtual |
Gets the number fraction for a given symbol. See the overload for species-based lookup for more details on how number fractions are calculated.
| symbol | The symbol to get the number fraction for. |
| exceptions::UnknownSymbolError | if the symbol is not in the atomic species database. |
| exceptions::UnregisteredSymbolError | if the symbol is not in the composition. |
Implements fourdst::composition::CompositionAbstract.
Definition at line 469 of file composition.cpp.
|
nodiscardoverridevirtualnoexcept |
Get a uniform vector representation of the number fractions stored in the composition object sorted such that the lightest species is at index 0 and the heaviest is at the last index.
This is primarily useful for external libraries which need to ensure that vector representation uniformity is maintained
Implements fourdst::composition::CompositionAbstract.
Definition at line 614 of file composition.cpp.
|
nodiscardoverridevirtualnoexcept |
Get a set of all species that are registered in the composition.
atomic::Species objects registered in the composition.Implements fourdst::composition::CompositionAbstract.
Definition at line 312 of file composition.cpp.
|
nodiscardoverridevirtualnoexcept |
Gets the registered symbols.
getRegisteredSpecies() instead which returns a constant reference to the internal set. Implements fourdst::composition::CompositionAbstract.
Definition at line 304 of file composition.cpp.
|
nodiscardoverridevirtual |
Get the species at a given index in the sorted vector representation.
This is primarily useful for external libraries which need to ensure that vector representation uniformity is maintained
| index | The index in the sorted vector representation for which to return the species. Must be in [0, N-1] where N is the number of registered species. |
| std::out_of_range | if the index is out of range. |
Implements fourdst::composition::CompositionAbstract.
Definition at line 668 of file composition.cpp.
|
nodiscardoverridevirtual |
get the index in the sorted vector representation for a given symbol
This is primarily useful for external libraries which need to ensure that vector representation uniformity is maintained
| species | the species to look up the index for. Note that this is the index species data will be at if you were to call getMolarAbundanceVector(), getMassFractionVector(), or getNumberFractionVector() |
| exceptions::UnregisteredSymbolError | if the symbol is not registered in the composition |
Implements fourdst::composition::CompositionAbstract.
Definition at line 650 of file composition.cpp.
|
nodiscardoverridevirtual |
get the index in the sorted vector representation for a given symbol
This is primarily useful for external libraries which need to ensure that vector representation uniformity is maintained
| symbol | the symbol to look up the index for. Note that this is the index species data will be at if you were to call getMolarAbundanceVector(), getMassFractionVector(), or getNumberFractionVector() |
| exceptions::UnknownSymbolError | if the symbol is not in the atomic species database. |
| exceptions::UnregisteredSymbolError | if the symbol is not registered in the composition |
Implements fourdst::composition::CompositionAbstract.
Definition at line 639 of file composition.cpp.
|
nodiscardoverridevirtual |
Implements fourdst::composition::CompositionAbstract.
Definition at line 684 of file composition.cpp.
| Composition & fourdst::composition::Composition::operator= | ( | Composition const & | other | ) |
Assignment operator.
| other | The Composition to assign from. |
Definition at line 204 of file composition.cpp.
| Composition & fourdst::composition::Composition::operator= | ( | const CompositionAbstract & | other | ) |
Definition at line 215 of file composition.cpp.
|
noexcept |
Registers a new species by extracting its symbol.
| species | The species to register. |
fourdst/atomic/species.h header file. These can be accessed directly through their fully qualified names (e.g., fourdst::atomic::C_12 for Carbon-12). Alternatively, these can also be accessed through a string-indexed map located in fourdst/atomic/species.h called fourdst::atomic::species ( e.g., fourdst::atomic::species.at("C-12") for Carbon-12). Definition at line 251 of file composition.cpp.
|
noexcept |
Registers a vector of new species.
| species | The vector of species to register. |
fourdst/atomic/species.h header file. These can be accessed directly through their fully qualified names (e.g., fourdst::atomic::C_12 for Carbon-12). Alternatively, these can also be accessed through a string-indexed map located in fourdst/atomic/species.h called fourdst::atomic::species ( e.g., fourdst::atomic::species.at("C-12") for Carbon-12). Definition at line 262 of file composition.cpp.
| void fourdst::composition::Composition::registerSymbol | ( | const std::string & | symbol | ) |
Registers a new symbol for inclusion in the composition.
A symbol must be registered before its abundance can be set.
| symbol | The symbol to register (e.g., "Fe-56"). |
| exceptions::UnknownSymbolError | if the symbol is not in the atomic species database. |
Definition at line 234 of file composition.cpp.
| void fourdst::composition::Composition::registerSymbol | ( | const std::vector< std::string > & | symbols | ) |
Registers multiple new symbols.
| symbols | The symbols to register. |
| exceptions::UnknownSymbolError | if any symbol is invalid. |
Definition at line 245 of file composition.cpp.
| void fourdst::composition::Composition::setMolarAbundance | ( | const atomic::Species & | species, |
| const double & | molar_abundance ) |
Sets the molar abundance for a given isotope.
| species | The isotope to set the molar abundance for. |
| molar_abundance | The molar abundance to set. |
| exceptions::UnregisteredSymbolError | if the isotope is not registered in the composition. |
| exceptions::InvalidCompositionError | if the molar abundance is negative. |
Definition at line 333 of file composition.cpp.
| void fourdst::composition::Composition::setMolarAbundance | ( | const std::set< atomic::Species > & | species, |
| const std::vector< double > & | molar_abundances ) |
Sets the molar abundances for a set of isotopes.
| species | The isotopes to set the molar abundances for. |
| molar_abundances | The molar abundances to set. |
| exceptions::UnregisteredSymbolError | if any isotope is not registered in the composition. |
| exceptions::InvalidCompositionError | if any molar abundance is negative. |
Definition at line 373 of file composition.cpp.
| void fourdst::composition::Composition::setMolarAbundance | ( | const std::set< std::string > & | symbols, |
| const std::vector< double > & | molar_abundances ) |
Sets the molar abundances for a set of symbols.
| symbols | The symbols to set the molar abundances for. |
| molar_abundances | The molar abundances to set. |
| exceptions::UnknownSymbolError | if any symbol is not in the atomic species database. |
| exceptions::UnregisteredSymbolError | if any symbol is not in the composition. |
| exceptions::InvalidCompositionError | if any molar abundance is negative. |
Definition at line 366 of file composition.cpp.
| void fourdst::composition::Composition::setMolarAbundance | ( | const std::string & | symbol, |
| const double & | molar_abundance ) |
Sets the molar abundance for a given symbol.
| symbol | The symbol to set the molar abundance for. |
| molar_abundance | The molar abundance to set. |
| exceptions::UnknownSymbolError | if the symbol is not in the atomic species database. |
| exceptions::UnregisteredSymbolError | if the symbol is not in the composition. |
| exceptions::InvalidCompositionError | if the molar abundance is negative. |
Definition at line 321 of file composition.cpp.
| void fourdst::composition::Composition::setMolarAbundance | ( | const std::vector< atomic::Species > & | species, |
| const std::vector< double > & | molar_abundances ) |
Sets the molar abundances for a list of isotopes.
| species | The isotopes to set the molar abundances for. |
| molar_abundances | The molar abundances to set. |
| exceptions::UnregisteredSymbolError | if any isotope is not registered in the composition. |
| exceptions::InvalidCompositionError | if any molar abundance is negative. |
Definition at line 380 of file composition.cpp.
| void fourdst::composition::Composition::setMolarAbundance | ( | const std::vector< std::string > & | symbols, |
| const std::vector< double > & | molar_abundances ) |
Sets the molar abundances for a list of symbols.
| symbols | The symbols to set the molar abundances for. |
| molar_abundances | The molar abundances to set. |
| exceptions::UnknownSymbolError | if any symbol is not in the atomic species database. |
| exceptions::UnregisteredSymbolError | if any symbol is not in the composition. |
| exceptions::InvalidCompositionError | if any molar abundance is negative. |
Methods which set multiple molar abundances
Definition at line 359 of file composition.cpp.
|
nodiscardoverridevirtualnoexcept |
Gets the number of registered species in the composition.
Implements fourdst::composition::CompositionAbstract.
Definition at line 709 of file composition.cpp.
|
staticnodiscardprivate |
Definition at line 725 of file composition.cpp.
|
friend |
Overloaded output stream operator for Composition.
| os | The output stream. |
| composition | The Composition to output. |
Definition at line 746 of file composition.cpp.
|
mutableprivate |
Cache for computed properties to avoid redundant calculations.
Definition at line 167 of file composition.h.
|
private |
Definition at line 165 of file composition.h.
|
private |
Definition at line 164 of file composition.h.