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 auto fvGeometry =
localView(gridGeometry);
92 auto elemVolVars =
localView(gridVolVars);
93 for (
const auto& element : elements(gridGeometry.gridView()))
95 auto eIdx = gridGeometry.elementMapper().index(element);
98 fvGeometry.bind(element);
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
The flux variables caches for an element.
Definition: discretization/box/elementfluxvariablescache.hh:43
Flux variable caches traits.
Definition: discretization/box/gridfluxvariablescache.hh:39
P Problem
Definition: discretization/box/gridfluxvariablescache.hh:40
FVC FluxVariablesCache
Definition: discretization/box/gridfluxvariablescache.hh:41
Flux variable caches on a gridview.
Definition: discretization/box/gridfluxvariablescache.hh:56
Flux variable caches on a gridview with grid caching enabled.
Definition: discretization/box/gridfluxvariablescache.hh:65
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition: discretization/box/gridfluxvariablescache.hh:82
const Problem & problem() const
Definition: discretization/box/gridfluxvariablescache.hh:108
const FluxVariablesCache & cache(std::size_t eIdx, std::size_t scvfIdx) const
Definition: discretization/box/gridfluxvariablescache.hh:112
BoxGridFluxVariablesCache(const Problem &problem)
Definition: discretization/box/gridfluxvariablescache.hh:79
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition: discretization/box/gridfluxvariablescache.hh:71
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: discretization/box/gridfluxvariablescache.hh:77
FluxVariablesCache & cache(std::size_t eIdx, std::size_t scvfIdx)
Definition: discretization/box/gridfluxvariablescache.hh:116
Flux variable caches on a gridview with grid caching disabled.
Definition: discretization/box/gridfluxvariablescache.hh:131
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition: discretization/box/gridfluxvariablescache.hh:137
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: discretization/box/gridfluxvariablescache.hh:143
const Problem & problem() const
Definition: discretization/box/gridfluxvariablescache.hh:153
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition: discretization/box/gridfluxvariablescache.hh:148
BoxGridFluxVariablesCache(const Problem &problem)
Definition: discretization/box/gridfluxvariablescache.hh:145
Global flux variable cache.