Loading...
Searching...
No Matches
composition_decorator_abstract.h
Go to the documentation of this file.
#pragma once
#include "fourdst/atomic/atomicSpecies.h"
#include "fourdst/composition/iterators/composition_abstract_iterator.h"
#include "fourdst/composition/composition_abstract.h"
#include <utility>
#include <set>
#include <unordered_map>
#include <map>
#include <vector>
namespace fourdst::composition {
class CompositionDecorator: public CompositionAbstract {
public:
explicit CompositionDecorator(std::unique_ptr<CompositionAbstract> decorator) : m_base_composition(std::move(decorator)) {};
[[nodiscard]] bool contains(const atomic::Species &species) const noexcept override { return m_base_composition->contains(species); };
[[nodiscard]] bool contains(const std::string& symbol) const override { return m_base_composition->contains(symbol); };
[[nodiscard]] size_t size() const noexcept override { return m_base_composition->size(); };
[[nodiscard]] std::set<std::string> getRegisteredSymbols() const noexcept override { return m_base_composition->getRegisteredSymbols(); };
[[nodiscard]] const std::vector<atomic::Species> &getRegisteredSpecies() const noexcept override { return m_base_composition->getRegisteredSpecies(); };
[[nodiscard]] std::unordered_map<atomic::Species, double> getMassFraction() const noexcept override { return m_base_composition->getMassFraction(); };
[[nodiscard]] std::unordered_map<atomic::Species, double> getNumberFraction() const noexcept override { return m_base_composition->getNumberFraction(); };
[[nodiscard]] double getMassFraction(const std::string& symbol) const override { return m_base_composition->getMassFraction(symbol); };
[[nodiscard]] double getMassFraction(const atomic::Species& species) const override { return m_base_composition->getMassFraction(species); };
[[nodiscard]] double getNumberFraction(const std::string& symbol) const override { return m_base_composition->getNumberFraction(symbol); };
[[nodiscard]] double getNumberFraction(const atomic::Species& species) const override { return m_base_composition->getNumberFraction(species); };
[[nodiscard]] double getMolarAbundance(const std::string& symbol) const override { return m_base_composition->getMolarAbundance(symbol); };
[[nodiscard]] double getMolarAbundance(const atomic::Species& species) const override { return m_base_composition->getMolarAbundance(species); };
[[nodiscard]] double getMeanParticleMass() const noexcept override { return m_base_composition->getMeanParticleMass(); };
[[nodiscard]] double getElectronAbundance() const noexcept override { return m_base_composition->getElectronAbundance(); };
[[nodiscard]] std::vector<double> getMassFractionVector() const noexcept override { return m_base_composition->getMassFractionVector(); };
[[nodiscard]] std::vector<double> getNumberFractionVector() const noexcept override { return m_base_composition->getNumberFractionVector(); };
[[nodiscard]] std::vector<double> getMolarAbundanceVector() const noexcept override { return m_base_composition->getMolarAbundanceVector(); };
[[nodiscard]] size_t getSpeciesIndex(const std::string& symbol) const override { return m_base_composition->getSpeciesIndex(symbol); };
[[nodiscard]] size_t getSpeciesIndex(const atomic::Species& species) const override { return m_base_composition->getSpeciesIndex(species); };
[[nodiscard]] atomic::Species getSpeciesAtIndex(const size_t index) const override { return m_base_composition->getSpeciesAtIndex(index); }
[[nodiscard]] detail::CompositionIterator<false> begin() override { return m_base_composition->begin(); };
[[nodiscard]] detail::CompositionIterator<false> end() override { return m_base_composition->end(); };
[[nodiscard]] detail::CompositionIterator<true> begin() const override { return std::as_const(*m_base_composition).begin(); };
[[nodiscard]] detail::CompositionIterator<true> end() const override { return std::as_const(*m_base_composition).end(); };
protected:
std::unique_ptr<CompositionAbstract> m_base_composition;
};
}
atomicSpecies.h
fourdst::composition::CompositionAbstract
Abstract base class for chemical composition representations.
Definition composition_abstract.h:36
fourdst::composition::CompositionDecorator::getMolarAbundance
double getMolarAbundance(const std::string &symbol) const override
Get the molar abundance for a given symbol.
Definition composition_decorator_abstract.h:30
fourdst::composition::CompositionDecorator::getRegisteredSpecies
const std::vector< atomic::Species > & getRegisteredSpecies() const noexcept override
Get all registered atomic species in the composition.
Definition composition_decorator_abstract.h:23
fourdst::composition::CompositionDecorator::getNumberFraction
double getNumberFraction(const std::string &symbol) const override
Get the number fraction for a given symbol.
Definition composition_decorator_abstract.h:28
fourdst::composition::CompositionDecorator::CompositionDecorator
CompositionDecorator(std::unique_ptr< CompositionAbstract > decorator)
Definition composition_decorator_abstract.h:18
fourdst::composition::CompositionDecorator::begin
detail::CompositionIterator< true > begin() const override
Definition composition_decorator_abstract.h:44
fourdst::composition::CompositionDecorator::getMassFraction
double getMassFraction(const atomic::Species &species) const override
Get the mass fraction for a given species.
Definition composition_decorator_abstract.h:27
fourdst::composition::CompositionDecorator::begin
detail::CompositionIterator< false > begin() override
Definition composition_decorator_abstract.h:41
fourdst::composition::CompositionDecorator::getElectronAbundance
double getElectronAbundance() const noexcept override
Get the electron abundance of the composition.
Definition composition_decorator_abstract.h:33
fourdst::composition::CompositionDecorator::getMeanParticleMass
double getMeanParticleMass() const noexcept override
Get the mean particle mass of the composition.
Definition composition_decorator_abstract.h:32
fourdst::composition::CompositionDecorator::getMassFractionVector
std::vector< double > getMassFractionVector() const noexcept override
Get the mass fraction as a vector.
Definition composition_decorator_abstract.h:34
fourdst::composition::CompositionDecorator::getMassFraction
double getMassFraction(const std::string &symbol) const override
Get the mass fraction for a given symbol.
Definition composition_decorator_abstract.h:26
fourdst::composition::CompositionDecorator::end
detail::CompositionIterator< true > end() const override
Definition composition_decorator_abstract.h:45
fourdst::composition::CompositionDecorator::getMolarAbundance
double getMolarAbundance(const atomic::Species &species) const override
Get the molar abundance for a given species.
Definition composition_decorator_abstract.h:31
fourdst::composition::CompositionDecorator::getNumberFraction
std::unordered_map< atomic::Species, double > getNumberFraction() const noexcept override
Get the number fraction for all registered symbols.
Definition composition_decorator_abstract.h:25
fourdst::composition::CompositionDecorator::getNumberFractionVector
std::vector< double > getNumberFractionVector() const noexcept override
Get the number fraction as a vector.
Definition composition_decorator_abstract.h:35
fourdst::composition::CompositionDecorator::m_base_composition
std::unique_ptr< CompositionAbstract > m_base_composition
Definition composition_decorator_abstract.h:47
fourdst::composition::CompositionDecorator::getMolarAbundanceVector
std::vector< double > getMolarAbundanceVector() const noexcept override
Get the molar abundance as a vector.
Definition composition_decorator_abstract.h:36
fourdst::composition::CompositionDecorator::contains
bool contains(const atomic::Species &species) const noexcept override
Check if the composition contains the given species.
Definition composition_decorator_abstract.h:19
fourdst::composition::CompositionDecorator::getRegisteredSymbols
std::set< std::string > getRegisteredSymbols() const noexcept override
Get all registered chemical symbols in the composition.
Definition composition_decorator_abstract.h:22
fourdst::composition::CompositionDecorator::getMassFraction
std::unordered_map< atomic::Species, double > getMassFraction() const noexcept override
Get the mass fraction for all registered symbols.
Definition composition_decorator_abstract.h:24
fourdst::composition::CompositionDecorator::getNumberFraction
double getNumberFraction(const atomic::Species &species) const override
Get the number fraction for a given species.
Definition composition_decorator_abstract.h:29
fourdst::composition::CompositionDecorator::getSpeciesAtIndex
atomic::Species getSpeciesAtIndex(const size_t index) const override
Get the species at a given index.
Definition composition_decorator_abstract.h:39
fourdst::composition::CompositionDecorator::getSpeciesIndex
size_t getSpeciesIndex(const std::string &symbol) const override
Get the index of a species by symbol.
Definition composition_decorator_abstract.h:37
fourdst::composition::CompositionDecorator::end
detail::CompositionIterator< false > end() override
Definition composition_decorator_abstract.h:42
fourdst::composition::CompositionDecorator::getSpeciesIndex
size_t getSpeciesIndex(const atomic::Species &species) const override
Get the index of a species.
Definition composition_decorator_abstract.h:38
fourdst::composition::CompositionDecorator::contains
bool contains(const std::string &symbol) const override
Check if the composition contains the given species.
Definition composition_decorator_abstract.h:20
fourdst::composition::CompositionDecorator::size
size_t size() const noexcept override
Definition composition_decorator_abstract.h:21
fourdst::composition::detail::CompositionIterator
Definition composition_abstract_iterator.h:13
composition_abstract.h
composition_abstract_iterator.h
fourdst::composition
Utilities and types for representing and manipulating chemical compositions.
fourdst::atomic::Species
Represents an atomic species (isotope) with its fundamental physical properties.
Definition atomicSpecies.h:52