24#ifndef DUMUX_DISCRETIZATION_BOX_ELEMENT_VOLUMEVARIABLES_HH
25#define DUMUX_DISCRETIZATION_BOX_ELEMENT_VOLUMEVARIABLES_HH
41template<
class GVV,
bool cachingEnabled>
61 : gridVolVarsPtr_(&gridVolVars) {}
64 {
return gridVolVars().volVars(eIdx_, scvIdx); }
66 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
68 {
return gridVolVars().volVars(eIdx_, scv.indexInElement()); }
75 template<
class FVElementGeometry,
class SolutionVector>
77 const FVElementGeometry& fvGeometry,
78 const SolutionVector& sol) &&
80 this->bindElement(element, fvGeometry, sol);
81 return std::move(*
this);
86 template<
class FVElementGeometry,
class SolutionVector>
87 void bind(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
88 const FVElementGeometry& fvGeometry,
89 const SolutionVector& sol) &
91 bindElement(element, fvGeometry, sol);
99 template<
class FVElementGeometry,
class SolutionVector>
101 const FVElementGeometry& fvGeometry,
102 const SolutionVector& sol) &&
104 this->bindElement(element, fvGeometry, sol);
105 return std::move(*
this);
109 template<
class FVElementGeometry,
class SolutionVector>
110 void bindElement(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
111 const FVElementGeometry& fvGeometry,
112 const SolutionVector& sol) &
114 eIdx_ = fvGeometry.gridGeometry().elementMapper().index(element);
119 {
return *gridVolVarsPtr_; }
122 const GridVolumeVariables* gridVolVarsPtr_;
143 : gridVolVarsPtr_(&gridVolVars) {}
150 template<
class FVElementGeometry,
class SolutionVector>
152 const FVElementGeometry& fvGeometry,
153 const SolutionVector& sol) &&
155 this->bindElement(element, fvGeometry, sol);
156 return std::move(*
this);
160 template<
class FVElementGeometry,
class SolutionVector>
161 void bind(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
162 const FVElementGeometry& fvGeometry,
163 const SolutionVector& sol) &
165 bindElement(element, fvGeometry, sol);
173 template<
class FVElementGeometry,
class SolutionVector>
175 const FVElementGeometry& fvGeometry,
176 const SolutionVector& sol) &&
178 this->bindElement(element, fvGeometry, sol);
179 return std::move(*
this);
183 template<
class FVElementGeometry,
class SolutionVector>
184 void bindElement(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
185 const FVElementGeometry& fvGeometry,
186 const SolutionVector& sol) &
189 auto elemSol =
elementSolution(element, sol, fvGeometry.gridGeometry());
192 volumeVariables_.resize(fvGeometry.numScv());
193 for (
auto&& scv : scvs(fvGeometry))
194 volumeVariables_[scv.indexInElement()].update(elemSol, gridVolVars().problem(), element, scv);
198 {
return volumeVariables_[scvIdx]; }
201 {
return volumeVariables_[scvIdx]; }
203 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
205 {
return volumeVariables_[scv.indexInElement()]; }
207 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
209 {
return volumeVariables_[scv.indexInElement()]; }
213 {
return *gridVolVarsPtr_; }
216 const GridVolumeVariables* gridVolVarsPtr_;
217 std::vector<VolumeVariables> volumeVariables_;
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethods::box, BoxElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for box schemes.
Definition: box/elementsolution.hh:118
The local (stencil) volume variables class for box models.
Definition: box/elementvolumevariables.hh:42
void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &
Definition: box/elementvolumevariables.hh:110
typename GridVolumeVariables::VolumeVariables VolumeVariables
export type of the volume variables
Definition: box/elementvolumevariables.hh:57
void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &
Definition: box/elementvolumevariables.hh:87
BoxElementVolumeVariables bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: box/elementvolumevariables.hh:100
GVV GridVolumeVariables
export type of the grid volume variables
Definition: box/elementvolumevariables.hh:54
const GridVolumeVariables & gridVolVars() const
The global volume variables object we are a restriction of.
Definition: box/elementvolumevariables.hh:118
BoxElementVolumeVariables(const GridVolumeVariables &gridVolVars)
Constructor.
Definition: box/elementvolumevariables.hh:60
BoxElementVolumeVariables bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: box/elementvolumevariables.hh:76
BoxElementVolumeVariables bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: box/elementvolumevariables.hh:151
BoxElementVolumeVariables bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: box/elementvolumevariables.hh:174
BoxElementVolumeVariables(const GridVolumeVariables &gridVolVars)
Constructor.
Definition: box/elementvolumevariables.hh:142
GVV GridVolumeVariables
export type of the grid volume variables
Definition: box/elementvolumevariables.hh:136
const GridVolumeVariables & gridVolVars() const
The global volume variables object we are a restriction of.
Definition: box/elementvolumevariables.hh:212
void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &
Definition: box/elementvolumevariables.hh:161
typename GridVolumeVariables::VolumeVariables VolumeVariables
export type of the volume variables
Definition: box/elementvolumevariables.hh:139
void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &
Definition: box/elementvolumevariables.hh:184
The local element solution class for the box method.