24#ifndef DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_GRID_FLUXVARSCACHE_HH
25#define DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_GRID_FLUXVARSCACHE_HH
37template<
class P,
class FVC,
class FVCF>
44 template<
class Gr
idFluxVariablesCache,
bool cachingEnabled>
53template<
class Problem,
54 class FluxVariablesCache,
55 class FluxVariablesCacheFiller,
56 bool cachingEnabled =
false,
65template<
class P,
class FVC,
class FVCF,
class Traits>
68 using Problem =
typename Traits::Problem;
70 using FluxVariablesCacheFiller =
typename Traits::FluxVariablesCacheFiller;
77 static constexpr bool cachingEnabled =
true;
85 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
86 void update(
const GridGeometry& gridGeometry,
87 const GridVolumeVariables& gridVolVars,
88 const SolutionVector& sol,
89 bool forceUpdate =
false)
92 if (FluxVariablesCacheFiller::isSolDependent || forceUpdate)
95 FluxVariablesCacheFiller filler(problem());
97 fluxVarsCache_.resize(gridGeometry.numScvf());
98 for (
const auto& element : elements(gridGeometry.gridView()))
101 auto fvGeometry =
localView(gridGeometry);
102 fvGeometry.bind(element);
104 auto elemVolVars =
localView(gridVolVars);
105 elemVolVars.bind(element, fvGeometry, sol);
107 for (
auto&& scvf : scvfs(fvGeometry))
109 filler.fill(*
this, fluxVarsCache_[scvf.index()], element, fvGeometry, elemVolVars, scvf, forceUpdate);
116 {
return *problemPtr_; }
118 template<
class SubControlVolumeFace>
120 {
return fluxVarsCache_[scvf.index()]; }
122 template<
class SubControlVolumeFace>
124 {
return fluxVarsCache_[scvf.index()]; }
128 const Problem* problemPtr_;
129 std::vector<FluxVariablesCache> fluxVarsCache_;
136template<
class P,
class FVC,
class FVCF,
class Traits>
139 using Problem =
typename Traits::Problem;
147 static constexpr bool cachingEnabled =
false;
154 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
155 void update(
const GridGeometry& gridGeometry,
156 const GridVolumeVariables& gridVolVars,
157 const SolutionVector& sol,
158 bool forceUpdate =
false) {}
161 {
return *problemPtr_; }
164 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/facecentered/staggered/elementfluxvariablescache.hh:42
Flux variable caches traits.
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:39
FVCF FluxVariablesCacheFiller
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:42
P Problem
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:40
FVC FluxVariablesCache
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:41
Flux variable caches on a gridview.
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:58
Flux variable caches on a gridview with grid caching enabled.
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:67
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:74
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:80
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:86
const Problem & problem() const
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:115
FaceCenteredStaggeredGridFluxVariablesCache(const Problem &problem)
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:82
Flux variable caches on a gridview with grid caching disabled.
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:138
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:144
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:155
const Problem & problem() const
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:160
FaceCenteredStaggeredGridFluxVariablesCache(const Problem &problem)
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:152
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: discretization/facecentered/staggered/gridfluxvariablescache.hh:150
Global flux variable cache.