25#ifndef DUMUX_SWITCHABLE_PRIMARY_VARIABLES_HH
26#define DUMUX_SWITCHABLE_PRIMARY_VARIABLES_HH
28#include <dune/common/exceptions.hh>
37template<
class PrimaryVariables,
class StateType>
40 using ParentType = PrimaryVariables;
43 using ParentType::ParentType;
45 using ParentType::operator=;
51 DUNE_THROW(Dune::InvalidStateException,
"Model demands setting a primary variable state (like a phase presence)"
52 <<
" but none was set! Use its setState method to set the state.");
62 state_ = std::move(
state);
74 bool stateIsSet_{
false};
81template<
class PrimaryVariables,
class StateType>
84 static constexpr std::size_t
numEq = PrimaryVariables::size();
85 using type = PrimaryVariables;
A helper to deduce a vector with the same size as numbers of equations.
Definition: numeqvector.hh:33
static constexpr std::size_t numEq
Definition: numeqvector.hh:34
A primary variable vector with a state to allow variable switches.
Definition: switchableprimaryvariables.hh:39
void invalidateState()
Invalidate the state.
Definition: switchableprimaryvariables.hh:67
StateType state() const
Ask for the state of this primary variable object, e.g. the phase presence.
Definition: switchableprimaryvariables.hh:48
void setState(StateType state)
Set the state of this primary variable object, e.g. the phase presence.
Definition: switchableprimaryvariables.hh:58
PrimaryVariables type
Definition: switchableprimaryvariables.hh:85