Template Class SysState

Class Documentation

template<int dim>
class SysState

SysState utility class describing the state of a system.

Public Types

typedef std::array<std::pair<std::string, real_t>, dim> value_type

The type of the stored values.

Public Functions

SysState()

Constructor. Initialize the state with no names.

SysState(std::array<std::pair<std::string, real_t>, dim> &&values)

Constructor. Initialize the state with the given names and values.

SysState(std::array<std::string, dim> &&names, real_t val)

Constructor. Initialize the state with the given names all variables will be initialized with val.

SysState(const SysState<dim> &other)

Copy constructor.

template<int other_dim>
SysState(const SysState<other_dim> &other)

Copy constructor.

SysState &operator=(const SysState<dim> &other)

Copy assignement constructor.

SysState(SysState &&other)

Move copy constructor.

SysState &operator=(SysState &&other)

Move copy constructor.

SysState &operator+=(const DynVec<real_t> &vec)

Add to this state the entries of the give vector.

SysState &operator-=(const DynVec<real_t> &vec)

Subtract from this state the entries of the give vector.

SysState &operator*=(real_t val)

Scale this state by the given factor.

real_t get(const std::string &name) const

Returns the value for the variable name.

DynVec<real_t> as_vector() const

Returns the entries of this state as a DynVec.

void set(const std::string &name, real_t val)

Set the value for the variable name.

void set(uint_t i, const std::pair<std::string, real_t> &value)

Set the name and value of the i-th variable.

void add(const DynVec<real_t> &container)

Set the values of state variables container must be of size dim.

void add(const std::vector<real_t> &container)

Set the values of state variables container must be of size dim.

inline uint_t size() const

Returns the size of the system.

const std::array<real_t, dim> get_values() const

Returns a copy of the state values.

const std::vector<std::string_view> get_names() const

Returns a copy of the state names.

real_t &operator[](uint_t)

Access operator.

const real_t &operator[](uint_t) const

Access operator.

inline real_t &operator[](const std::string &name)

Access operator.

inline const real_t &operator[](const std::string &name) const

Access operator.

real_t &operator()(const std::string &name)

Access operator.

const real_t &operator()(const std::string &name) const

Access operator.

inline real_t &operator()(const std::string_view name)

Access operator.

inline const real_t &operator()(const std::string_view name) const

Access operator.

void clear()

clear the state

std::ostream &print(std::ostream &out) const

Print the state at the given stream.

const std::string as_string() const

Return the state as string.

void scale(real_t val)

Scale the values of the state.

template<typename Container>
void set(const Container &container)

Set the values.

Public Static Functions

template<int dim1, int dim2>
static void extract(const SysState<dim1> &state, SysState<dim2> &other)

Extract a state of different dimension.

Public Static Attributes

static const int dimension = dim

The dimension of the state.