25#ifndef DUMUX_SWITCHABLE_PRIMARY_VARIABLES_HH
26#define DUMUX_SWITCHABLE_PRIMARY_VARIABLES_HH
28#include <dune/common/exceptions.hh>
36template<
class PrimaryVariables,
class StateType>
39 using ParentType = PrimaryVariables;
42 using ParentType::ParentType;
44 using ParentType::operator=;
50 DUNE_THROW(Dune::InvalidStateException,
"Model demands setting a primary variable state (like a phase presence)"
51 <<
" but none was set! Use its setState method to set the state.");
61 state_ = std::move(
state);
73 bool stateIsSet_{
false};
A primary variable vector with a state to allow variable switches.
Definition: switchableprimaryvariables.hh:38
void invalidateState()
Invalidate the state.
Definition: switchableprimaryvariables.hh:66
StateType state() const
Ask for the state of this primary variable object, e.g. the phase presence.
Definition: switchableprimaryvariables.hh:47
void setState(StateType state)
Set the state of this primary variable object, e.g. the phase presence.
Definition: switchableprimaryvariables.hh:57