SERiF 0.0.1a
3+1D Stellar Structure and Evolution
Loading...
Searching...
No Matches
serif::composition::CompositionEntry Struct Reference

Represents an entry in the composition with a symbol and mass fraction. More...

#include <composition.h>

Public Member Functions

 CompositionEntry ()
 Default constructor.
 
 CompositionEntry (const std::string &symbol, bool massFracMode=true)
 Constructs a CompositionEntry with the given symbol and mode.
 
 CompositionEntry (const CompositionEntry &entry)
 Copy constructor.
 
void setSpecies (const std::string &symbol)
 Sets the species for the composition entry.
 
std::string symbol () const
 Gets the chemical symbol of the species.
 
double mass_fraction () const
 Gets the mass fraction of the species.
 
double mass_fraction (double meanMolarMass) const
 Gets the mass fraction of the species given the mean molar mass.
 
double number_fraction () const
 Gets the number fraction of the species.
 
double number_fraction (double totalMoles) const
 Gets the number fraction of the species given the total moles.
 
double rel_abundance () const
 Gets the relative abundance of the species.
 
serif::atomic::Species isotope () const
 Gets the isotope of the species.
 
bool getMassFracMode () const
 Gets the mode of the composition entry.
 
void setMassFraction (double mass_fraction)
 Sets the mass fraction of the species.
 
void setNumberFraction (double number_fraction)
 Sets the number fraction of the species.
 
bool setMassFracMode (double meanMolarMass)
 Sets the mode to mass fraction mode.
 
bool setNumberFracMode (double totalMoles)
 Sets the mode to number fraction mode.
 

Public Attributes

std::string m_symbol
 The chemical symbol of the species.
 
serif::atomic::Species m_isotope
 The isotope of the species.
 
bool m_massFracMode = true
 The mode of the composition entry. True if mass fraction, false if number fraction.
 
double m_massFraction = 0.0
 The mass fraction of the species.
 
double m_numberFraction = 0.0
 The number fraction of the species.
 
double m_relAbundance = 0.0
 The relative abundance of the species for converting between mass and number fractions.
 
bool m_initialized = false
 True if the composition entry has been initialized.
 

Friends

std::ostream & operator<< (std::ostream &os, const CompositionEntry &entry)
 Overloaded output stream operator for CompositionEntry.
 

Detailed Description

Represents an entry in the composition with a symbol and mass fraction.

Definition at line 64 of file composition.h.

Constructor & Destructor Documentation

◆ CompositionEntry() [1/3]

serif::composition::CompositionEntry::CompositionEntry ( )

Default constructor.

Definition at line 38 of file composition.cpp.

◆ CompositionEntry() [2/3]

serif::composition::CompositionEntry::CompositionEntry ( const std::string & symbol,
bool massFracMode = true )

Constructs a CompositionEntry with the given symbol and mode.

Parameters
symbolThe chemical symbol of the species.
massFracModeTrue if mass fraction mode, false if number fraction mode. Example Usage:
CompositionEntry entry("H", true);
CompositionEntry()
Default constructor.

Definition at line 42 of file composition.cpp.

◆ CompositionEntry() [3/3]

serif::composition::CompositionEntry::CompositionEntry ( const CompositionEntry & entry)

Copy constructor.

Parameters
entryThe CompositionEntry to copy.

Definition at line 46 of file composition.cpp.

Member Function Documentation

◆ getMassFracMode()

bool serif::composition::CompositionEntry::getMassFracMode ( ) const

Gets the mode of the composition entry.

Returns
True if mass fraction mode, false if number fraction mode.

Definition at line 142 of file composition.cpp.

◆ isotope()

serif::atomic::Species serif::composition::CompositionEntry::isotope ( ) const

Gets the isotope of the species.

Returns
The isotope of the species.

Definition at line 104 of file composition.cpp.

◆ mass_fraction() [1/2]

double serif::composition::CompositionEntry::mass_fraction ( ) const

Gets the mass fraction of the species.

Returns
The mass fraction of the species.

Definition at line 71 of file composition.cpp.

◆ mass_fraction() [2/2]

double serif::composition::CompositionEntry::mass_fraction ( double meanMolarMass) const

Gets the mass fraction of the species given the mean molar mass.

Parameters
meanMolarMassThe mean molar mass.
Returns
The mass fraction of the species.

Definition at line 78 of file composition.cpp.

◆ number_fraction() [1/2]

double serif::composition::CompositionEntry::number_fraction ( ) const

Gets the number fraction of the species.

Returns
The number fraction of the species.

Definition at line 86 of file composition.cpp.

◆ number_fraction() [2/2]

double serif::composition::CompositionEntry::number_fraction ( double totalMoles) const

Gets the number fraction of the species given the total moles.

Parameters
totalMolesThe total moles.
Returns
The number fraction of the species.

Definition at line 93 of file composition.cpp.

◆ rel_abundance()

double serif::composition::CompositionEntry::rel_abundance ( ) const

Gets the relative abundance of the species.

Returns
The relative abundance of the species.

Definition at line 100 of file composition.cpp.

◆ setMassFracMode()

bool serif::composition::CompositionEntry::setMassFracMode ( double meanMolarMass)

Sets the mode to mass fraction mode.

Parameters
meanMolarMassThe mean molar mass.
Returns
True if the mode was successfully set, false otherwise.

Definition at line 124 of file composition.cpp.

◆ setMassFraction()

void serif::composition::CompositionEntry::setMassFraction ( double mass_fraction)

Sets the mass fraction of the species.

Parameters
mass_fractionThe mass fraction to set.

Definition at line 108 of file composition.cpp.

◆ setNumberFracMode()

bool serif::composition::CompositionEntry::setNumberFracMode ( double totalMoles)

Sets the mode to number fraction mode.

Parameters
totalMolesThe total moles.
Returns
True if the mode was successfully set, false otherwise.

Definition at line 133 of file composition.cpp.

◆ setNumberFraction()

void serif::composition::CompositionEntry::setNumberFraction ( double number_fraction)

Sets the number fraction of the species.

Parameters
number_fractionThe number fraction to set.

Definition at line 116 of file composition.cpp.

◆ setSpecies()

void serif::composition::CompositionEntry::setSpecies ( const std::string & symbol)

Sets the species for the composition entry.

Parameters
symbolThe chemical symbol of the species.

Definition at line 55 of file composition.cpp.

◆ symbol()

std::string serif::composition::CompositionEntry::symbol ( ) const

Gets the chemical symbol of the species.

Returns
The chemical symbol of the species.

Definition at line 67 of file composition.cpp.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const CompositionEntry & entry )
friend

Overloaded output stream operator for CompositionEntry.

Parameters
osThe output stream.
entryThe CompositionEntry to output.
Returns
The output stream.

Definition at line 670 of file composition.cpp.

Member Data Documentation

◆ m_initialized

bool serif::composition::CompositionEntry::m_initialized = false

True if the composition entry has been initialized.

Definition at line 73 of file composition.h.

◆ m_isotope

serif::atomic::Species serif::composition::CompositionEntry::m_isotope

The isotope of the species.

Definition at line 66 of file composition.h.

◆ m_massFracMode

bool serif::composition::CompositionEntry::m_massFracMode = true

The mode of the composition entry. True if mass fraction, false if number fraction.

Definition at line 67 of file composition.h.

◆ m_massFraction

double serif::composition::CompositionEntry::m_massFraction = 0.0

The mass fraction of the species.

Definition at line 69 of file composition.h.

◆ m_numberFraction

double serif::composition::CompositionEntry::m_numberFraction = 0.0

The number fraction of the species.

Definition at line 70 of file composition.h.

◆ m_relAbundance

double serif::composition::CompositionEntry::m_relAbundance = 0.0

The relative abundance of the species for converting between mass and number fractions.

Definition at line 71 of file composition.h.

◆ m_symbol

std::string serif::composition::CompositionEntry::m_symbol

The chemical symbol of the species.

Definition at line 65 of file composition.h.


The documentation for this struct was generated from the following files: