24#ifndef DUMUX_COMMON_VARIABLES_HH
25#define DUMUX_COMMON_VARIABLES_HH
29#include <dune/common/typetraits.hh>
52 template<class T, bool indexable = Dune::IsIndexable<T>::value>
53 struct ScalarT {
using type = T; };
56 struct ScalarT<T, true>
58 using Element = std::decay_t<decltype(std::declval<T>()[0])>;
59 using type =
typename ScalarT<Element>::type;
67 using Scalar =
typename ScalarT<X>::type;
84 : x_(std::move(x)), t_(t)
88 template<
class Initializer,
89 std::enable_if_t<(std::is_invocable_r_v<void, Initializer, X&>),
int> = 0>
90 explicit Variables(
const Initializer& initializeSolution,
94 initializeSolution(x_);
Class that represents a time level during time integration.
Definition: variables.hh:32
Class that represents the variables of a model. We assume that models are formulated on the basis of ...
Definition: variables.hh:51
void update(const SolutionVector &x, const TimeLevel &t)
Update the state to a new solution & time level.
Definition: variables.hh:116
void update(const SolutionVector &x)
Update the state to a new solution.
Definition: variables.hh:108
void updateTime(const TimeLevel &t)
Update the time level only.
Definition: variables.hh:112
const SolutionVector & dofs() const
Return reference to the solution.
Definition: variables.hh:102
const TimeLevel & timeLevel() const
Return the time level.
Definition: variables.hh:98
Variables(const Initializer &initializeSolution, const TimeLevel &timeLevel=TimeLevel{0.0})
Construction from initializer lambda.
Definition: variables.hh:90
Variables(const SolutionVector &x, const TimeLevel &t=TimeLevel{0.0})
Construction from a solution.
Definition: variables.hh:76
Variables(SolutionVector &&x, const TimeLevel &t=TimeLevel{0.0})
Construction from a solution.
Definition: variables.hh:82
Variables()
Default constructor.
Definition: variables.hh:73
X SolutionVector
export the type of solution vector
Definition: variables.hh:64
typename ScalarT< X >::type Scalar
export the underlying scalar type
Definition: variables.hh:67
SolutionVector & dofs()
Non-const access still required for privar switch (TODO: Remove dependency)
Definition: variables.hh:105
Class that represents a time level during time integration.
Definition: timelevel.hh:34