12#ifndef DUMUX_PNM_2P_ELEMNT_FLUXVARSCACHE_HH
13#define DUMUX_PNM_2P_ELEMNT_FLUXVARSCACHE_HH
27template<
class GFVC,
bool cachingEnabled>
39 using ParentType::ParentType;
57 : gridFluxVarsCachePtr_(&global) {}
61 template<
class FVElementGeometry,
class ElementVolumeVariables>
62 void bind(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
63 const FVElementGeometry& fvGeometry,
64 const ElementVolumeVariables& elemVolVars) &
65 { bindElement(element, fvGeometry, elemVolVars); }
72 template<
class FVElementGeometry,
class ElementVolumeVariables>
74 const FVElementGeometry& fvGeometry,
75 const ElementVolumeVariables& elemVolVars) &&
77 this->bind(element, fvGeometry, elemVolVars);
78 return std::move(*
this);
81 template<
class FVElementGeometry,
class ElementVolumeVariables>
82 void bindElement(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
83 const FVElementGeometry& fvGeometry,
84 const ElementVolumeVariables& elemVolVars) &
86 for (
auto&& scvf : scvfs(fvGeometry))
87 fluxVarsCache_.update(gridFluxVarsCache().problem(), element, fvGeometry, elemVolVars, scvf, gridFluxVarsCache().invasionState().invaded(element));
95 template<
class FVElementGeometry,
class ElementVolumeVariables>
97 const FVElementGeometry& fvGeometry,
98 const ElementVolumeVariables& elemVolVars) &&
100 this->bindElement(element, fvGeometry, elemVolVars);
101 return std::move(*
this);
104 template<
class FVElementGeometry,
class ElementVolumeVariables>
105 void bindScvf(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
106 const FVElementGeometry& fvGeometry,
107 const ElementVolumeVariables& elemVolVars,
108 const typename FVElementGeometry::SubControlVolumeFace& scvf) &
110 fluxVarsCache_.update(gridFluxVarsCache().problem(), element, fvGeometry, elemVolVars, scvf, gridFluxVarsCache().invasionState().invaded(element));
118 template<
class FVElementGeometry,
class ElementVolumeVariables>
120 const FVElementGeometry& fvGeometry,
121 const ElementVolumeVariables& elemVolVars,
122 const typename FVElementGeometry::SubControlVolumeFace& scvf) &&
124 this->bindScvf(element, fvGeometry, elemVolVars, scvf);
125 return std::move(*
this);
132 template<
class FVElementGeometry,
class ElementVolumeVariables>
133 void update(
const typename FVElementGeometry::Element& element,
134 const FVElementGeometry& fvGeometry,
135 const ElementVolumeVariables& elemVolVars)
137 if constexpr (FluxVariablesCache::isSolDependent)
139 for (
const auto& scvf : scvfs(fvGeometry))
140 fluxVarsCache_.update(
141 gridFluxVarsCache().problem(), element, fvGeometry, elemVolVars, scvf,
142 gridFluxVarsCache().invasionState().invaded(element)
148 template<
class SubControlVolumeFace>
150 {
return fluxVarsCache_; }
153 template<
class SubControlVolumeFace>
155 {
return fluxVarsCache_; }
159 {
return *gridFluxVarsCachePtr_; }
162 const GridFluxVariablesCache* gridFluxVarsCachePtr_;
163 FluxVariablesCache fluxVarsCache_;
The flux variables caches for an element with caching enabled.
Definition: discretization/cvfe/elementfluxvariablescache.hh:39
The flux variables caches for an element.
Definition: discretization/cvfe/elementfluxvariablescache.hh:31
void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &
Definition: porenetwork/2p/elementfluxvariablescache.hh:82
typename GFVC::FluxVariablesCache FluxVariablesCache
export the type of the flux variables cache
Definition: porenetwork/2p/elementfluxvariablescache.hh:54
PNMTwoPElementFluxVariablesCache 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: porenetwork/2p/elementfluxvariablescache.hh:73
GFVC GridFluxVariablesCache
export the type of the grid flux variables cache
Definition: porenetwork/2p/elementfluxvariablescache.hh:51
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: porenetwork/2p/elementfluxvariablescache.hh:133
void bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const typename FVElementGeometry::SubControlVolumeFace &scvf) &
Definition: porenetwork/2p/elementfluxvariablescache.hh:105
PNMTwoPElementFluxVariablesCache 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: porenetwork/2p/elementfluxvariablescache.hh:119
PNMTwoPElementFluxVariablesCache(const GridFluxVariablesCache &global)
Definition: porenetwork/2p/elementfluxvariablescache.hh:56
PNMTwoPElementFluxVariablesCache 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: porenetwork/2p/elementfluxvariablescache.hh:96
void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &
Definition: porenetwork/2p/elementfluxvariablescache.hh:62
const GridFluxVariablesCache & gridFluxVarsCache() const
The global object we are a restriction of.
Definition: porenetwork/2p/elementfluxvariablescache.hh:158
The flux variables caches for an element.
Definition: porenetwork/2p/elementfluxvariablescache.hh:28
Global flux variable cache.
Definition: discretization/porenetwork/fvelementgeometry.hh:24