#include <src/Base/Data.hpp>
template<uint8_t Layout>
Data class
Zero-runtime-cost data-layout wrappers with type-based compile-time dispatch.
Public static functions
- static auto layout() -> std::string
Constructors, destructors, conversion operators
Public functions
-
auto operator()(ncomp_
t unknown, ncomp_ t component) const -> const tk:: real& -
auto operator()(ncomp_
t unknown, ncomp_ t component) -> tk:: real& -
auto nunk() const -> ncomp_
t noexcept -
auto nprop() const -> ncomp_
t noexcept -
auto extract(ncomp_
t component) const -> std::vector<tk:: real> -
auto operator[](ncomp_
t unknown) const -> std::vector<tk:: real> -
auto extract(ncomp_
t component, const std::array<ncomp_ t, 4>& N) const -> std::array<tk:: real, 4> -
auto vec() const -> const std::vector<tk::
real>& -
auto vec() -> std::vector<tk::
real>& - auto operator-=(const Data<Layout>& rhs) -> Data<Layout>&
- auto operator-(const Data<Layout>& rhs) const -> Data<Layout>
- auto operator+=(const Data<Layout>& rhs) -> Data<Layout>&
- auto operator+(const Data<Layout>& rhs) const -> Data<Layout>
- auto operator*=(const Data<Layout>& rhs) -> Data<Layout>&
- auto operator*(const Data<Layout>& rhs) const -> Data<Layout>
-
auto operator*=(tk::
real rhs) -> Data<Layout>& -
auto operator*(tk::
real rhs) const -> Data<Layout> - auto operator/=(const Data<Layout>& rhs) -> Data<Layout>&
- auto operator/(const Data<Layout>& rhs) const -> Data<Layout>
-
auto operator/=(tk::
real rhs) -> Data<Layout>& -
auto operator/(tk::
real rhs) const -> Data<Layout> -
void push_back(const std::vector<tk::
real>& prop) -
void resize(std::size_t count,
tk::
real value = 0.0) - void resize(std::size_t nu, std::size_t np)
-
void rm(const std::set<ncomp_
t>& unknown) -
void fill(ncomp_
t component, tk:: real value) -
void fill(tk::
real value) - auto empty() const -> bool noexcept
- Check if vector of unknowns is empty.
Pack/Unpack: Serialize Data object for Charm++
Function documentation
template<uint8_t Layout>
static std::string tk:: Data<Layout>:: layout()
Returns | The name of the data layout used |
---|
Layout name dispatch
template<uint8_t Layout>
const tk:: real& tk:: Data<Layout>:: operator()(ncomp_ t unknown,
ncomp_ t component) const
Parameters | |
---|---|
unknown in | Unknown index |
component in | Component index, i.e., position of a scalar within a system |
Returns | Const reference to data of type tk:: |
Const data access dispatch
Public interface to const-ref data access to a single real value. Use it as Data(p,c), where p is the unknown index, and c is the component index specifying the scalar equation within a system of equations. Requirement: component < nprop, unknown < nunk, enforced with an assert in DEBUG mode, see also the constructor.
template<uint8_t Layout>
tk:: real& tk:: Data<Layout>:: operator()(ncomp_ t unknown,
ncomp_ t component)
Parameters | |
---|---|
unknown in | Unknown index |
component in | Component index, i.e., position of a scalar within a system |
Returns | Non-const reference to data of type tk:: |
Non-const data access dispatch
Public interface to non-const-ref data access to a single real value. Use it as Data(p,c,o), where p is the unknown index, and c is the component index specifying the scalar equation within a system of equations. Requirement: component < nprop, unknown < nunk, enforced with an assert in DEBUG mode, see also the constructor.
template<uint8_t Layout>
std::vector<tk:: real> tk:: Data<Layout>:: extract(ncomp_ t component) const
Parameters | |
---|---|
component in | Component index, i.e., position of a scalar within a system |
Returns | A vector of unknowns given by component (length: nunk(), i.e., the first constructor argument) |
Extract vector of unknowns given component
Requirement: component < nprop, enforced with an assert in DEBUG mode, see also the constructor.
template<uint8_t Layout>
std::vector<tk:: real> tk:: Data<Layout>:: operator[](ncomp_ t unknown) const
Parameters | |
---|---|
unknown in | Index of unknown |
Returns | A vector of components for a single unknown (length: nprop, i.e., the second constructor argument) |
Extract all components for unknown
Requirement: unknown < nunk, enforced with an assert in DEBUG mode, see also the constructor.
template<uint8_t Layout>
std::array<tk:: real, 4> tk:: Data<Layout>:: extract(ncomp_ t component,
const std::array<ncomp_ t, 4>& N) const
Parameters | |
---|---|
component in | Component index, i.e., position of a scalar within a system |
N in | Indices of the 4 unknowns |
Returns | Array of the four values of component |
Extract (a copy of) four values of unknowns
Requirement: component < nprop, for all N[i] < nunk, enforced with an assert in DEBUG mode, see also the constructor.
template<uint8_t Layout>
Data<Layout>& tk:: Data<Layout>:: operator-=(const Data<Layout>& rhs)
Parameters | |
---|---|
rhs in | Data object to subtract |
Returns | Reference to ourselves after subtraction |
Compound operator-=
template<uint8_t Layout>
Data<Layout>& tk:: Data<Layout>:: operator+=(const Data<Layout>& rhs)
Parameters | |
---|---|
rhs in | Data object to add |
Returns | Reference to ourselves after addition |
Compound operator+=
template<uint8_t Layout>
Data<Layout>& tk:: Data<Layout>:: operator*=(const Data<Layout>& rhs)
Parameters | |
---|---|
rhs in | Data object to multiply with |
Returns | Reference to ourselves after multiplication |
Compound operator*= multiplying by another Data object item by item
template<uint8_t Layout>
Data<Layout> tk:: Data<Layout>:: operator*(const Data<Layout>& rhs) const
Parameters | |
---|---|
rhs in | Data object to multiply with |
Returns | Copy of Data object after rhs has been multiplied with |
Operator * multiplying by another Data object item by item Implemented in terms of compound operator*=
template<uint8_t Layout>
Data<Layout>& tk:: Data<Layout>:: operator*=(tk:: real rhs)
Parameters | |
---|---|
rhs in | Scalar to multiply with |
Returns | Reference to ourselves after multiplication |
Compound operator*= multiplying all items by a scalar
template<uint8_t Layout>
Data<Layout>& tk:: Data<Layout>:: operator/=(const Data<Layout>& rhs)
Parameters | |
---|---|
rhs in | Data object to divide by |
Returns | Reference to ourselves after division |
Compound operator/=
template<uint8_t Layout>
Data<Layout>& tk:: Data<Layout>:: operator/=(tk:: real rhs)
Parameters | |
---|---|
rhs in | Scalar to divide with |
Returns | Reference to ourselves after division |
Compound operator/= dividing all items by a scalar
template<uint8_t Layout>
void tk:: Data<Layout>:: resize(std::size_t nu,
std::size_t np)
Parameters | |
---|---|
nu in | Number of unknowns to allocate memory for |
np in | Total number of properties, i.e., scalar variables or components, per unknown |
Resize data given number of unknowns and number of properties
template<uint8_t Layout>
void tk:: Data<Layout>:: fill(ncomp_ t component,
tk:: real value)
Parameters | |
---|---|
component in | Component index, i.e., position of a scalar within a system |
value in | Value to fill vector of unknowns with |
Fill vector of unknowns with the same value
Requirement: component < nprop, enforced with an assert in DEBUG mode, see also the constructor.
template<uint8_t Layout>
void tk:: Data<Layout>:: pup(PUP::er& p)
Pack/Unpack serialize member function.
Parameters | |
---|---|
p in/out | Charm++'s PUP::er serializer object reference |