Loading...
Searching...
No Matches
CompositionAbstract Class Referenceabstract

Abstract base class for chemical composition representations. More...

`#include <composition_abstract.h>`

Inheritance diagram for CompositionAbstract:
[legend]

## Public Member Functions

virtual | ~CompositionAbstract ()=default
| Virtual destructor.
virtual bool | contains (const fourdst::atomic::Species &species) const noexcept=0
| Check if the composition contains the given species.
virtual bool | contains (const std::string &symbol) const =0
| Check if the composition contains the given species.
virtual size_t | size () const noexcept=0
virtual std::set< std::string > | getRegisteredSymbols () const noexcept=0
| Get all registered chemical symbols in the composition.
virtual const std::set< fourdst::atomic::Species > & | getRegisteredSpecies () const noexcept=0
| Get all registered atomic species in the composition.
virtual std::unordered_map< fourdst::atomic::Species, double > | getMassFraction () const noexcept=0
| Get the mass fraction for all registered symbols.
virtual std::unordered_map< fourdst::atomic::Species, double > | getNumberFraction () const noexcept=0
| Get the number fraction for all registered symbols.
virtual double | getMassFraction (const std::string &symbol) const =0
| Get the mass fraction for a given symbol.
virtual double | getMassFraction (const fourdst::atomic::Species &species) const =0
| Get the mass fraction for a given species.
virtual double | getNumberFraction (const std::string &symbol) const =0
| Get the number fraction for a given symbol.
virtual double | getNumberFraction (const fourdst::atomic::Species &species) const =0
| Get the number fraction for a given species.
virtual double | getMolarAbundance (const std::string &symbol) const =0
| Get the molar abundance for a given symbol.
virtual double | getMolarAbundance (const fourdst::atomic::Species &species) const =0
| Get the molar abundance for a given species.
virtual double | getMeanParticleMass () const noexcept=0
| Get the mean particle mass of the composition.
virtual double | getElectronAbundance () const noexcept=0
| Get the electron abundance of the composition.
virtual std::vector< double > | getMassFractionVector () const noexcept=0
| Get the mass fraction as a vector.
virtual std::vector< double > | getNumberFractionVector () const noexcept=0
| Get the number fraction as a vector.
virtual std::vector< double > | getMolarAbundanceVector () const noexcept=0
| Get the molar abundance as a vector.
virtual size_t | getSpeciesIndex (const std::string &symbol) const =0
| Get the index of a species by symbol.
virtual size_t | getSpeciesIndex (const fourdst::atomic::Species &species) const =0
| Get the index of a species.
virtual fourdst::atomic::Species | getSpeciesAtIndex (size_t index) const =0
| Get the species at a given index.

## Detailed Description

Abstract base class for chemical composition representations.

The purpose of this class is to define a standard interface for all composition types. Children of this class are responsible for implementing the setter methods, but any object that is a child of CompositionAbstract will always have these getter methods.

This ensures that all derived composition classes provide a consistent API for querying composition properties, regardless of how the data is set or stored.

Example
  class MyComposition : public CompositionAbstract {
  // ...implement all pure virtual methods...
  };
  MyComposition comp;
  if (comp.hasSymbol("H")) {
  double mf = comp.getMassFraction("H");
  }
  std::set<std::string> symbols = comp.getRegisteredSymbols();
  CompositionAbstract
  Abstract base class for chemical composition representations.
  Definition composition_abstract.h:33

Definition at line 33 of file composition_abstract.h.

## Constructor & Destructor Documentation

## ~CompositionAbstract()

virtual CompositionAbstract::~CompositionAbstract | ( |  | ) |

virtualdefault

Virtual destructor.

## Member Function Documentation

## contains() [1/2]

virtual bool CompositionAbstract::contains | ( | const fourdst::atomic::Species & | species | ) | const

nodiscardpure virtualnoexcept

Check if the composition contains the given species.

Parameters

  species | The atomic species to check.

Returns
  True if the species is contained, false otherwise.

Implemented in fourdst::composition::Composition.

## contains() [2/2]

virtual bool CompositionAbstract::contains | ( | const std::string & | symbol | ) | const

nodiscardpure virtual

Check if the composition contains the given species.

Parameters

  symbol | The symbol of the atomic species to check.

Returns
  True if the species is contained, false otherwise.

Implemented in fourdst::composition::Composition.

## getElectronAbundance()

virtual double CompositionAbstract::getElectronAbundance | ( |  | ) | const

nodiscardpure virtualnoexcept

Get the electron abundance of the composition.

Returns
  The electron abundance.

Implemented in fourdst::composition::Composition.

## getMassFraction() [1/3]

virtual std::unordered_map< fourdst::atomic::Species, double > CompositionAbstract::getMassFraction | ( |  | ) | const

nodiscardpure virtualnoexcept

Get the mass fraction for all registered symbols.

Returns
  An unordered map from symbol to mass fraction.

Implemented in fourdst::composition::Composition.

## getMassFraction() [2/3]

virtual double CompositionAbstract::getMassFraction | ( | const fourdst::atomic::Species & | species | ) | const

nodiscardpure virtual

Get the mass fraction for a given species.

Parameters

  species | The atomic species.

Returns
  The mass fraction for the species.

Implemented in fourdst::composition::Composition.

## getMassFraction() [3/3]

virtual double CompositionAbstract::getMassFraction | ( | const std::string & | symbol | ) | const

nodiscardpure virtual

Get the mass fraction for a given symbol.

Parameters

  symbol | The chemical symbol.

Returns
  The mass fraction for the symbol.

Implemented in fourdst::composition::Composition.

## getMassFractionVector()

virtual std::vector< double > CompositionAbstract::getMassFractionVector | ( |  | ) | const

nodiscardpure virtualnoexcept

Get the mass fraction as a vector.

Returns
  A vector of mass fractions for all species.

Implemented in fourdst::composition::Composition.

## getMeanParticleMass()

virtual double CompositionAbstract::getMeanParticleMass | ( |  | ) | const

nodiscardpure virtualnoexcept

Get the mean particle mass of the composition.

Returns
  The mean particle mass.

Implemented in fourdst::composition::Composition.

## getMolarAbundance() [1/2]

virtual double CompositionAbstract::getMolarAbundance | ( | const fourdst::atomic::Species & | species | ) | const

nodiscardpure virtual

Get the molar abundance for a given species.

Parameters

  species | The atomic species.

Returns
  The molar abundance for the species.

Implemented in fourdst::composition::Composition.

## getMolarAbundance() [2/2]

virtual double CompositionAbstract::getMolarAbundance | ( | const std::string & | symbol | ) | const

nodiscardpure virtual

Get the molar abundance for a given symbol.

Parameters

  symbol | The chemical symbol.

Returns
  The molar abundance for the symbol.

Implemented in fourdst::composition::Composition.

## getMolarAbundanceVector()

virtual std::vector< double > CompositionAbstract::getMolarAbundanceVector | ( |  | ) | const

nodiscardpure virtualnoexcept

Get the molar abundance as a vector.

Returns
  A vector of molar abundances for all species.

Implemented in fourdst::composition::Composition.

## getNumberFraction() [1/3]

virtual std::unordered_map< fourdst::atomic::Species, double > CompositionAbstract::getNumberFraction | ( |  | ) | const

nodiscardpure virtualnoexcept

Get the number fraction for all registered symbols.

Returns
  An unordered map from symbol to number fraction.

Implemented in fourdst::composition::Composition.

## getNumberFraction() [2/3]

virtual double CompositionAbstract::getNumberFraction | ( | const fourdst::atomic::Species & | species | ) | const

nodiscardpure virtual

Get the number fraction for a given species.

Parameters

  species | The atomic species.

Returns
  The number fraction for the species.

Implemented in fourdst::composition::Composition.

## getNumberFraction() [3/3]

virtual double CompositionAbstract::getNumberFraction | ( | const std::string & | symbol | ) | const

nodiscardpure virtual

Get the number fraction for a given symbol.

Parameters

  symbol | The chemical symbol.

Returns
  The number fraction for the symbol.

Implemented in fourdst::composition::Composition.

## getNumberFractionVector()

virtual std::vector< double > CompositionAbstract::getNumberFractionVector | ( |  | ) | const

nodiscardpure virtualnoexcept

Get the number fraction as a vector.

Returns
  A vector of number fractions for all species.

Implemented in fourdst::composition::Composition.

## getRegisteredSpecies()

virtual const std::set< fourdst::atomic::Species > & CompositionAbstract::getRegisteredSpecies | ( |  | ) | const

nodiscardpure virtualnoexcept

Get all registered atomic species in the composition.

Returns
  A set of registered atomic species.

Implemented in fourdst::composition::Composition.

## getRegisteredSymbols()

virtual std::set< std::string > CompositionAbstract::getRegisteredSymbols | ( |  | ) | const

nodiscardpure virtualnoexcept

Get all registered chemical symbols in the composition.

Returns
  A set of registered chemical symbols.

Implemented in fourdst::composition::Composition.

## getSpeciesAtIndex()

virtual fourdst::atomic::Species CompositionAbstract::getSpeciesAtIndex | ( | size_t | index | ) | const

nodiscardpure virtual

Get the species at a given index.

Parameters

  index | The index of the species.

Returns
  The atomic species at the specified index.

Implemented in fourdst::composition::Composition.

## getSpeciesIndex() [1/2]

virtual size_t CompositionAbstract::getSpeciesIndex | ( | const fourdst::atomic::Species & | species | ) | const

nodiscardpure virtual

Get the index of a species.

Parameters

  species | The atomic species.

Returns
  The index of the species.

Implemented in fourdst::composition::Composition.

## getSpeciesIndex() [2/2]

virtual size_t CompositionAbstract::getSpeciesIndex | ( | const std::string & | symbol | ) | const

nodiscardpure virtual

Get the index of a species by symbol.

Parameters

  symbol | The chemical symbol.

Returns
  The index of the species.

Implemented in fourdst::composition::Composition.

## size()

virtual size_t CompositionAbstract::size | ( |  | ) | const

nodiscardpure virtualnoexcept

Implemented in fourdst::composition::Composition.

The documentation for this class was generated from the following file:

- src/composition/include/fourdst/composition/composition_abstract.h