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 auto fvGeometry =
localView(gridGeometry);
82 for (
const auto& element : elements(gridGeometry.gridView()))
84 auto eIdx = gridGeometry.elementMapper().index(element);
85 fvGeometry.bindElement(element);
91 volumeVariables_[eIdx].resize(fvGeometry.numScv());
92 for (
auto&& scv : scvs(fvGeometry))
93 volumeVariables_[eIdx][scv.indexInElement()].update(elemSol, problem(), element, scv);
97 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
99 {
return volumeVariables_[scv.elementIndex()][scv.indexInElement()]; }
101 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
103 {
return volumeVariables_[scv.elementIndex()][scv.indexInElement()]; }
106 {
return volumeVariables_[eIdx][scvIdx]; }
109 {
return volumeVariables_[eIdx][scvIdx]; }
112 {
return *problemPtr_; }
115 const Problem* problemPtr_;
116 std::vector<std::vector<VolumeVariables>> volumeVariables_;
121template<
class P,
class VV,
class Traits>
134 static constexpr bool cachingEnabled =
false;
141 template<
class Gr
idGeometry,
class SolutionVector>
142 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol) {}
145 {
return *problemPtr_;}
148 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==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
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:98
const Problem & problem() const
Definition: box/gridvolumevariables.hh:111
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:102
VolumeVariables & volVars(const std::size_t eIdx, const std::size_t scvIdx)
Definition: box/gridvolumevariables.hh:108
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:105
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:123
const Problem & problem() const
Definition: box/gridvolumevariables.hh:144
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: box/gridvolumevariables.hh:137
typename Traits::VolumeVariables VolumeVariables
export the volume variables type
Definition: box/gridvolumevariables.hh:131
void update(const GridGeometry &gridGeometry, const SolutionVector &sol)
Definition: box/gridvolumevariables.hh:142
BoxGridVolumeVariables(const Problem &problem)
Definition: box/gridvolumevariables.hh:139
typename Traits::Problem Problem
export the problem type
Definition: box/gridvolumevariables.hh:128
The local element solution class for the box method.
The local volume variables class.