12#ifndef DUMUX_DISCRETIZATION_CVFE_ELEMENT_FLUXVARSCACHE_HH
13#define DUMUX_DISCRETIZATION_CVFE_ELEMENT_FLUXVARSCACHE_HH
29template<
class GFVC,
bool cachingEnabled>
48 : gridFluxVarsCachePtr_(&global) {}
52 template<
class FVElementGeometry,
class ElementVolumeVariables>
53 void bind(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
54 const FVElementGeometry& fvGeometry,
55 const ElementVolumeVariables& elemVolVars) &
56 { bindElement(element, fvGeometry, elemVolVars); }
63 template<
class FVElementGeometry,
class ElementVolumeVariables>
65 const FVElementGeometry& fvGeometry,
66 const ElementVolumeVariables& elemVolVars) &&
68 this->bind(element, fvGeometry, elemVolVars);
69 return std::move(*
this);
72 template<
class FVElementGeometry,
class ElementVolumeVariables>
73 void bindElement(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
74 const FVElementGeometry& fvGeometry,
75 const ElementVolumeVariables& elemVolVars) &
76 { eIdx_ = fvGeometry.gridGeometry().elementMapper().index(element); }
83 template<
class FVElementGeometry,
class ElementVolumeVariables>
85 const FVElementGeometry& fvGeometry,
86 const ElementVolumeVariables& elemVolVars) &&
88 this->bindElement(element, fvGeometry, elemVolVars);
89 return std::move(*
this);
92 template<
class FVElementGeometry,
class ElementVolumeVariables>
93 void bindScvf(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
94 const FVElementGeometry& fvGeometry,
95 const ElementVolumeVariables& elemVolVars,
96 const typename FVElementGeometry::SubControlVolumeFace& scvf) &
97 { bindElement(element, fvGeometry, elemVolVars); }
104 template<
class FVElementGeometry,
class ElementVolumeVariables>
106 const FVElementGeometry& fvGeometry,
107 const ElementVolumeVariables& elemVolVars,
108 const typename FVElementGeometry::SubControlVolumeFace& scvf) &&
110 this->bindScvf(element, fvGeometry, elemVolVars, scvf);
111 return std::move(*
this);
115 template<
class FVElementGeometry,
class ElementVolumeVariables>
116 void update(
const typename FVElementGeometry::Element& element,
117 const FVElementGeometry& fvGeometry,
118 const ElementVolumeVariables& elemVolVars) {}
121 template<
class SubControlVolumeFace>
123 {
return gridFluxVarsCache().cache(eIdx_, scvf.index()); }
127 {
return *gridFluxVarsCachePtr_; }
130 const GridFluxVariablesCache* gridFluxVarsCachePtr_;
149 : gridFluxVarsCachePtr_(&global) {}
153 template<
class FVElementGeometry,
class ElementVolumeVariables>
154 void bind(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
155 const FVElementGeometry& fvGeometry,
156 const ElementVolumeVariables& elemVolVars) &
158 bindElement(element, fvGeometry, elemVolVars);
166 template<
class FVElementGeometry,
class ElementVolumeVariables>
168 const FVElementGeometry& fvGeometry,
169 const ElementVolumeVariables& elemVolVars) &&
171 this->bind(element, fvGeometry, elemVolVars);
172 return std::move(*
this);
175 template<
class FVElementGeometry,
class ElementVolumeVariables>
176 void bindElement(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
177 const FVElementGeometry& fvGeometry,
178 const ElementVolumeVariables& elemVolVars) &
181 fluxVarsCache_.resize(fvGeometry.numScvf());
182 for (
auto&& scvf : scvfs(fvGeometry))
183 (*this)[scvf].update(gridFluxVarsCache().problem(), element, fvGeometry, elemVolVars, scvf);
191 template<
class FVElementGeometry,
class ElementVolumeVariables>
193 const FVElementGeometry& fvGeometry,
194 const ElementVolumeVariables& elemVolVars) &&
196 this->bindElement(element, fvGeometry, elemVolVars);
197 return std::move(*
this);
200 template<
class FVElementGeometry,
class ElementVolumeVariables>
201 void bindScvf(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
202 const FVElementGeometry& fvGeometry,
203 const ElementVolumeVariables& elemVolVars,
204 const typename FVElementGeometry::SubControlVolumeFace& scvf) &
206 fluxVarsCache_.resize(fvGeometry.numScvf());
207 (*this)[scvf].update(gridFluxVarsCache().problem(), element, fvGeometry, elemVolVars, scvf);
215 template<
class FVElementGeometry,
class ElementVolumeVariables>
217 const FVElementGeometry& fvGeometry,
218 const ElementVolumeVariables& elemVolVars,
219 const typename FVElementGeometry::SubControlVolumeFace& scvf) &&
221 this->bindScvf(element, fvGeometry, elemVolVars, scvf);
222 return std::move(*
this);
229 template<
class FVElementGeometry,
class ElementVolumeVariables>
230 void update(
const typename FVElementGeometry::Element& element,
231 const FVElementGeometry& fvGeometry,
232 const ElementVolumeVariables& elemVolVars)
234 if constexpr (FluxVariablesCache::isSolDependent)
236 fluxVarsCache_.resize(fvGeometry.numScvf());
237 for (
const auto& scvf : scvfs(fvGeometry))
238 (*
this)[scvf].update(gridFluxVarsCache().problem(), element, fvGeometry, elemVolVars, scvf);
243 template<
class SubControlVolumeFace>
245 {
return fluxVarsCache_[scvf.index()]; }
248 template<
class SubControlVolumeFace>
250 {
return fluxVarsCache_[scvf.index()]; }
254 {
return *gridFluxVarsCachePtr_; }
257 const GridFluxVariablesCache* gridFluxVarsCachePtr_;
258 std::vector<FluxVariablesCache> fluxVarsCache_;
const GridFluxVariablesCache & gridFluxVarsCache() const
The global object we are a restriction of.
Definition: discretization/cvfe/elementfluxvariablescache.hh:253
GFVC GridFluxVariablesCache
export the type of the grid flux variables cache
Definition: discretization/cvfe/elementfluxvariablescache.hh:143
void bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const typename FVElementGeometry::SubControlVolumeFace &scvf) &
Definition: discretization/cvfe/elementfluxvariablescache.hh:201
CVFEElementFluxVariablesCache bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: discretization/cvfe/elementfluxvariablescache.hh:192
CVFEElementFluxVariablesCache bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const typename FVElementGeometry::SubControlVolumeFace &scvf) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: discretization/cvfe/elementfluxvariablescache.hh:216
CVFEElementFluxVariablesCache bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: discretization/cvfe/elementfluxvariablescache.hh:167
CVFEElementFluxVariablesCache(const GridFluxVariablesCache &global)
Definition: discretization/cvfe/elementfluxvariablescache.hh:148
void update(const typename FVElementGeometry::Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars)
Update the caches if the volume variables have changed and the cache is solution-dependent.
Definition: discretization/cvfe/elementfluxvariablescache.hh:230
void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &
Definition: discretization/cvfe/elementfluxvariablescache.hh:176
void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &
Definition: discretization/cvfe/elementfluxvariablescache.hh:154
typename GFVC::FluxVariablesCache FluxVariablesCache
export the type of the flux variables cache
Definition: discretization/cvfe/elementfluxvariablescache.hh:146
const GridFluxVariablesCache & gridFluxVarsCache() const
The global object we are a restriction of.
Definition: discretization/cvfe/elementfluxvariablescache.hh:126
void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &
Definition: discretization/cvfe/elementfluxvariablescache.hh:73
void bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const typename FVElementGeometry::SubControlVolumeFace &scvf) &
Definition: discretization/cvfe/elementfluxvariablescache.hh:93
CVFEElementFluxVariablesCache bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const typename FVElementGeometry::SubControlVolumeFace &scvf) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: discretization/cvfe/elementfluxvariablescache.hh:105
CVFEElementFluxVariablesCache(const GridFluxVariablesCache &global)
Definition: discretization/cvfe/elementfluxvariablescache.hh:47
void update(const typename FVElementGeometry::Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars)
Specialization for the global caching being enabled - do nothing here.
Definition: discretization/cvfe/elementfluxvariablescache.hh:116
CVFEElementFluxVariablesCache bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: discretization/cvfe/elementfluxvariablescache.hh:84
GFVC GridFluxVariablesCache
export the type of the grid flux variables cache
Definition: discretization/cvfe/elementfluxvariablescache.hh:42
CVFEElementFluxVariablesCache bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: discretization/cvfe/elementfluxvariablescache.hh:64
typename GFVC::FluxVariablesCache FluxVariablesCache
export the type of the flux variables cache
Definition: discretization/cvfe/elementfluxvariablescache.hh:45
void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &
Definition: discretization/cvfe/elementfluxvariablescache.hh:53
The flux variables caches for an element.
Definition: discretization/cvfe/elementfluxvariablescache.hh:31