template<typename... Tags>
tk::ctr::ncomponents class

Number of components storage.

All this trickery with template meta-programming allows the code below to be generic. As a result, adding a new component requires adding a single line (a tag and its type) to the already existing list, see typedefs 'ncomps'. The member functions, doing initialization, computing the number of total components, the offset for a given tag, and computing the offset map, need no change – even if the order of the number of components change.

Constructors, destructors, conversion operators

ncomponents()
Default constructor: set defaults to zero for all number of components.

Public functions

auto nprop() const -> ncomp_t noexcept
template<typename tag>
auto offset(ncomp_t c) const -> ncomp_t noexcept
Compute the offset for a given equation tag, i.e., the sum of the number of components up to a given tag.
template<class InputDeck>
auto offsetmap(const InputDeck& d) const -> OffsetMap
template<class InputDeck>
auto ncompmap(const InputDeck& d) const -> NcompMap
Compute map of number of properties (scalar components) associated to dependent variables.
template<class InputDeck>
auto depvar(const InputDeck& deck) const -> std::vector<std::string>
Return vector of dependent variables + component id for all equations configured.

Function documentation

template<typename... Tags>
ncomp_t tk::ctr::ncomponents<Tags>::nprop() const noexcept

Returns Total number of components

Compute total number of components in the systems of systems configured

template<typename... Tags> template<typename tag>
ncomp_t tk::ctr::ncomponents<Tags>::offset(ncomp_t c) const noexcept

Compute the offset for a given equation tag, i.e., the sum of the number of components up to a given tag.

Parameters
in Index for system given by template argument tag
Returns offset for tag

This offset is used to index into the data array (the equation systems operate on during the numerical solution) and get to the beginning of data for a given differential equation system.

template<typename... Tags> template<class InputDeck>
OffsetMap tk::ctr::ncomponents<Tags>::offsetmap(const InputDeck& d) const

Parameters
in Input deck to operate on
Returns Map of offsets associated to dependent variables

Compute map of offsets associated to dependent variables

template<typename... Tags> template<class InputDeck>
NcompMap tk::ctr::ncomponents<Tags>::ncompmap(const InputDeck& d) const

Compute map of number of properties (scalar components) associated to dependent variables.

Parameters
in Input deck to operate on
Returns Map of number of properties associated to dependent variables

template<typename... Tags> template<class InputDeck>
std::vector<std::string> tk::ctr::ncomponents<Tags>::depvar(const InputDeck& deck) const

Return vector of dependent variables + component id for all equations configured.

Parameters
deck in Input deck to operate on
Returns Vector of dependent variables + comopnent id for all equations configured. The length of this vector equals the total number of components configured, see nprop(), containing the depvar + the component index relative to the given equation. E.g., c1, c2, u1, u2, u3, u4, u5.