Chemical reaction

class CChemicalReaction

Description of the chemical reaction.

Public Types

enum class ESubstance

Substance type.

Values:

enumerator REACTANT

Educt substance.

enumerator PRODUCT

Product substance.

Public Functions

CChemicalReaction() = default

Default constructor.

CChemicalReaction(const CChemicalReaction &_other)

Copy constructor.

Parameters

_other – Target chemical reaction.

CChemicalReaction &operator=(const CChemicalReaction &_other)

Copy assignment operator.

Parameters

_other – Target chemical reaction.

Returns

Reference to this reaction.

CChemicalReaction(CChemicalReaction &&_other) = default

Move constructor.

Parameters

_other – Target chemical reaction.

CChemicalReaction &operator=(CChemicalReaction &&_other) = default

Move assignment operator.

Parameters

_other – Target chemical reaction.

Returns

Reference to this reaction.

void Swap(CChemicalReaction &_other) noexcept

Swaps two reactions.

Parameters

_other – Target chemical reaction.

void SetName(const std::string &_name)

Sets name of the reaction.

Parameters

_name – Reaction name.

std::string GetName() const

Returns name of the reaction.

Returns

Reaction name.

SChemicalSubstance *AddSubstance()

Adds a new empty chemical substance to the reaction.

Returns

Pointer to the added reaction.

void AddSubstance(const SChemicalSubstance &_substance)

Adds a new chemical substance to the reaction.

Parameters

_substance – New substance.

void RemoveSubstance(size_t _index)

Removes substance with the specified index.

Parameters

_index – Index of the substance.

std::vector<const SChemicalSubstance*> GetSubstances() const

Returns all defined substances.

Returns

Constant pointers to all defined substances.

std::vector<SChemicalSubstance*> GetSubstances()

Returns all defined substances.

Returns

Pointers to all defined substances.

size_t GetSubstancesNumber() const

Returns number of defined substances.

Returns

Number of defined substances.

std::vector<const SChemicalSubstance*> GetSubstances(EPhase _phase) const

Returns all defined substances of the specified phase.

Parameters

_phase – Target phase.

Returns

Constant pointers to substances.

std::vector<SChemicalSubstance*> GetSubstances(EPhase _phase)

Returns all defined substances of the specified phase.

Parameters

_phase – Target phase.

Returns

Pointers to substances.

std::vector<const SChemicalSubstance*> GetSubstances(ESubstance _type) const

Returns all defined substances of the specified type.

Parameters

_type – Type of the substance.

Returns

Constant pointers to substances.

std::vector<SChemicalSubstance*> GetSubstances(ESubstance _type)

Returns all defined substances of the specified type.

Parameters

_type – Type of the substance.

Returns

Pointers to substances.

std::vector<const SChemicalSubstance*> GetSubstances(EPhase _phase, ESubstance _type) const

Returns all defined substances of the specified phase and type.

Parameters
  • _phase – Target phase.

  • _type – Type of the substance.

Returns

Constant pointers to substances.

std::vector<SChemicalSubstance*> GetSubstances(EPhase _phase, ESubstance _type)

Returns all defined substances of the specified phase and type.

Parameters
  • _phase – Target phase.

  • _type – Type of the substance.

Returns

Pointers to substances.

void SetBaseSubstance(size_t _index)

Sets index of the base substance.

Parameters

_index – Index of the substance.

const SChemicalSubstance *GetBaseSubstance() const

Returns base substance.

Returns

Pointer to the substance.

SChemicalSubstance *GetBaseSubstance()

Returns base substance.

Returns

Pointer to the substance.

size_t GetBaseSubstanceIndex() const

Returns index of the base substance.

Returns

Index to the substance.

void SetEnthalpy(double _enthalpy)

Sets specific reaction enthalpy [J/mol].

Parameters

_enthalpy – Reaction enthalpy.

double GetEnthalpy() const

Returns specific reaction enthalpy [J/mol].

Returns

Reaction enthalpy.

struct SChemicalSubstance

Description of the chemical substance.

Public Functions

SChemicalSubstance() = default

Default constructor.

inline SChemicalSubstance(std::string _key, double _nu, double _order, EPhase _phase)

Creates a new substance.

Parameters
  • _key – Unique key of the chemical substance from MDB.

  • _nu – Stoichiometric coefficient of the substance in the reaction. >0 - product, <0 - reactant.

  • _order – Partial order of reaction for the substance.

  • _phase – Phase of the substance.

inline ESubstance GetType() const

Returns type of the substance based on the value of stoichiometric coefficient.

Returns

Type of the substance in the reaction.

Public Members

std::string key

Unique key of the chemical substance from MDB.

double nu = 1.0

Stoichiometric coefficient of this substance in the reaction.

double order = 0.0

Partial order of reaction for this substance.

EPhase phase = EPhase::UNDEFINED

Phase of this substance.

double MM = 0.0

Molar mass of this substance.