24#ifndef DUMUX_DISCRETIZATION_BOX_GRID_FLUXVARSCACHE_HH
25#define DUMUX_DISCRETIZATION_BOX_GRID_FLUXVARSCACHE_HH
37template<
class P,
class FVC>
43 template<
class Gr
idFluxVariablesCache,
bool cachingEnabled>
52template<
class Problem,
53 class FluxVariablesCache,
54 bool cachingEnabled =
false,
63template<
class P,
class FVC,
class Traits>
66 using Problem =
typename Traits::Problem;
74 static constexpr bool cachingEnabled =
true;
81 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
82 void update(
const GridGeometry& gridGeometry,
83 const GridVolumeVariables& gridVolVars,
84 const SolutionVector& sol,
85 bool forceUpdate =
false)
90 fluxVarsCache_.resize(gridGeometry.gridView().size(0));
91 for (
const auto& element : elements(gridGeometry.gridView()))
93 auto eIdx = gridGeometry.elementMapper().index(element);
95 auto fvGeometry =
localView(gridGeometry);
96 fvGeometry.bind(element);
98 auto elemVolVars =
localView(gridVolVars);
99 elemVolVars.bind(element, fvGeometry, sol);
101 fluxVarsCache_[eIdx].resize(fvGeometry.numScvf());
102 for (
auto&& scvf : scvfs(fvGeometry))
103 cache(eIdx, scvf.index()).update(problem(), element, fvGeometry, elemVolVars, scvf);
109 {
return *problemPtr_; }
113 {
return fluxVarsCache_[eIdx][scvfIdx]; }
117 {
return fluxVarsCache_[eIdx][scvfIdx]; }
121 const Problem* problemPtr_;
122 std::vector<std::vector<FluxVariablesCache>> fluxVarsCache_;
129template<
class P,
class FVC,
class Traits>
132 using Problem =
typename Traits::Problem;
140 static constexpr bool cachingEnabled =
false;
147 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
148 void update(
const GridGeometry& gridGeometry,
149 const GridVolumeVariables& gridVolVars,
150 const SolutionVector& sol,
151 bool forceUpdate =
false) {}
154 {
return *problemPtr_; }
157 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
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
The flux variables caches for an element.
Definition: box/elementfluxvariablescache.hh:42
Flux variable caches traits.
Definition: box/gridfluxvariablescache.hh:39
P Problem
Definition: box/gridfluxvariablescache.hh:40
FVC FluxVariablesCache
Definition: box/gridfluxvariablescache.hh:41
Flux variable caches on a gridview.
Definition: box/gridfluxvariablescache.hh:56
Flux variable caches on a gridview with grid caching enabled.
Definition: box/gridfluxvariablescache.hh:65
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition: box/gridfluxvariablescache.hh:82
const Problem & problem() const
Definition: box/gridfluxvariablescache.hh:108
const FluxVariablesCache & cache(std::size_t eIdx, std::size_t scvfIdx) const
Definition: box/gridfluxvariablescache.hh:112
BoxGridFluxVariablesCache(const Problem &problem)
Definition: box/gridfluxvariablescache.hh:79
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition: box/gridfluxvariablescache.hh:71
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: box/gridfluxvariablescache.hh:77
FluxVariablesCache & cache(std::size_t eIdx, std::size_t scvfIdx)
Definition: box/gridfluxvariablescache.hh:116
Flux variable caches on a gridview with grid caching disabled.
Definition: box/gridfluxvariablescache.hh:131
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition: box/gridfluxvariablescache.hh:137
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: box/gridfluxvariablescache.hh:143
const Problem & problem() const
Definition: box/gridfluxvariablescache.hh:153
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition: box/gridfluxvariablescache.hh:148
BoxGridFluxVariablesCache(const Problem &problem)
Definition: box/gridfluxvariablescache.hh:145
Global flux variable cache.