13#ifndef DUMUX_SWITCHABLE_PRIMARY_VARIABLES_HH
14#define DUMUX_SWITCHABLE_PRIMARY_VARIABLES_HH
16#include <dune/common/ftraits.hh>
17#include <dune/common/exceptions.hh>
26template<
class PrimaryVariables,
class StateType>
29 using ParentType = PrimaryVariables;
32 using ParentType::ParentType;
34 using ParentType::operator=;
40 DUNE_THROW(Dune::InvalidStateException,
"Model demands setting a primary variable state (like a phase presence)"
41 <<
" but none was set! Use its setState method to set the state.");
51 state_ = std::move(
state);
63 bool stateIsSet_{
false};
70template<
class PrimaryVariables,
class StateType>
73 static constexpr std::size_t
numEq = PrimaryVariables::size();
74 using type = PrimaryVariables;
82template <
class PrimaryVariables,
class StateType>
83struct FieldTraits<
Dumux::SwitchablePrimaryVariables<PrimaryVariables, StateType>>
84:
public FieldTraits<PrimaryVariables>
A primary variable vector with a state to allow variable switches.
Definition: switchableprimaryvariables.hh:28
void invalidateState()
Invalidate the state.
Definition: switchableprimaryvariables.hh:56
StateType state() const
Ask for the state of this primary variable object, e.g. the phase presence.
Definition: switchableprimaryvariables.hh:37
void setState(StateType state)
Set the state of this primary variable object, e.g. the phase presence.
Definition: switchableprimaryvariables.hh:47
Definition: common/pdesolver.hh:24
A helper to deduce a vector with the same size as numbers of equations.
PrimaryVariables type
Definition: switchableprimaryvariables.hh:74
Definition: numeqvector.hh:21
static constexpr std::size_t numEq
Definition: numeqvector.hh:22