24#ifndef DUMUX_DISCRETIZATION_BOX_GRID_VOLUMEVARIABLES_HH
25#define DUMUX_DISCRETIZATION_BOX_GRID_VOLUMEVARIABLES_HH
36template<
class P,
class VV>
42 template<
class Gr
idVolumeVariables,
bool cachingEnabled>
50template<
class Problem,
51 class VolumeVariables,
52 bool enableGridVolVarsCache =
false,
57template<
class P,
class VV,
class Traits>
70 static constexpr bool cachingEnabled =
true;
77 template<
class Gr
idGeometry,
class SolutionVector>
78 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol)
80 volumeVariables_.resize(gridGeometry.gridView().size(0));
81 for (
const auto& element : elements(gridGeometry.gridView()))
83 auto eIdx = gridGeometry.elementMapper().index(element);
85 auto fvGeometry =
localView(gridGeometry);
86 fvGeometry.bindElement(element);
92 volumeVariables_[eIdx].resize(fvGeometry.numScv());
93 for (
auto&& scv : scvs(fvGeometry))
94 volumeVariables_[eIdx][scv.indexInElement()].update(elemSol, problem(), element, scv);
98 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
100 {
return volumeVariables_[scv.elementIndex()][scv.indexInElement()]; }
102 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
104 {
return volumeVariables_[scv.elementIndex()][scv.indexInElement()]; }
107 {
return volumeVariables_[eIdx][scvIdx]; }
110 {
return volumeVariables_[eIdx][scvIdx]; }
113 {
return *problemPtr_; }
116 const Problem* problemPtr_;
117 std::vector<std::vector<VolumeVariables>> volumeVariables_;
122template<
class P,
class VV,
class Traits>
135 static constexpr bool cachingEnabled =
false;
142 template<
class Gr
idGeometry,
class SolutionVector>
143 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol) {}
146 {
return *problemPtr_;}
149 const Problem* problemPtr_;
Free function to get the local view of a grid cache object.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethod::box, BoxElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for box schemes.
Definition: box/elementsolution.hh:115
The local (stencil) volume variables class for box models.
Definition: box/elementvolumevariables.hh:41
Definition: box/gridvolumevariables.hh:38
VV VolumeVariables
Definition: box/gridvolumevariables.hh:40
P Problem
Definition: box/gridvolumevariables.hh:39
Base class for the grid volume variables.
Definition: box/gridvolumevariables.hh:54
Definition: box/gridvolumevariables.hh:59
const VolumeVariables & volVars(const SubControlVolume &scv) const
Definition: box/gridvolumevariables.hh:99
const Problem & problem() const
Definition: box/gridvolumevariables.hh:112
typename Traits::VolumeVariables VolumeVariables
export the volume variables type
Definition: box/gridvolumevariables.hh:67
void update(const GridGeometry &gridGeometry, const SolutionVector &sol)
Definition: box/gridvolumevariables.hh:78
VolumeVariables & volVars(const SubControlVolume &scv)
Definition: box/gridvolumevariables.hh:103
VolumeVariables & volVars(const std::size_t eIdx, const std::size_t scvIdx)
Definition: box/gridvolumevariables.hh:109
BoxGridVolumeVariables(const Problem &problem)
Definition: box/gridvolumevariables.hh:75
const VolumeVariables & volVars(const std::size_t eIdx, const std::size_t scvIdx) const
Definition: box/gridvolumevariables.hh:106
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: box/gridvolumevariables.hh:73
typename Traits::Problem Problem
export the problem type
Definition: box/gridvolumevariables.hh:64
Definition: box/gridvolumevariables.hh:124
const Problem & problem() const
Definition: box/gridvolumevariables.hh:145
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: box/gridvolumevariables.hh:138
typename Traits::VolumeVariables VolumeVariables
export the volume variables type
Definition: box/gridvolumevariables.hh:132
void update(const GridGeometry &gridGeometry, const SolutionVector &sol)
Definition: box/gridvolumevariables.hh:143
BoxGridVolumeVariables(const Problem &problem)
Definition: box/gridvolumevariables.hh:140
typename Traits::Problem Problem
export the problem type
Definition: box/gridvolumevariables.hh:129
The local element solution class for the box method.
The local volume variables class.