template<typename... Tags>
ncomponents class
Number of components storage.
Contents
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>
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 | |
---|---|
c 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>
NcompMap tk:: ctr:: ncomponents<Tags>:: ncompmap(const InputDeck& d) const
Compute map of number of properties (scalar components) associated to dependent variables.
Parameters | |
---|---|
d 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. |