24#ifndef DUMUX_DISCRETIZATION_CVFE_GRID_FLUXVARSCACHE_HH
25#define DUMUX_DISCRETIZATION_CVFE_GRID_FLUXVARSCACHE_HH
39template<
class P,
class FVC>
45 template<
class Gr
idFluxVariablesCache,
bool cachingEnabled>
54template<
class Problem,
55 class FluxVariablesCache,
56 bool cachingEnabled =
false,
65template<
class P,
class FVC,
class Traits>
68 using Problem =
typename Traits::Problem;
76 static constexpr bool cachingEnabled =
true;
83 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
84 void update(
const GridGeometry& gridGeometry,
85 const GridVolumeVariables& gridVolVars,
86 const SolutionVector& sol,
87 bool forceUpdate =
false)
92 fluxVarsCache_.resize(gridGeometry.gridView().size(0));
93 Dumux::parallelFor(gridGeometry.gridView().size(0), [&, &problem = problem()](
const std::size_t eIdx)
96 const auto element = gridGeometry.element(eIdx);
97 const auto fvGeometry =
localView(gridGeometry).bind(element);
98 const auto elemVolVars =
localView(gridVolVars).bind(element, fvGeometry, sol);
101 fluxVarsCache_[eIdx].resize(fvGeometry.numScvf());
102 for (
const 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.
Parallel for loop (multithreading)
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
void parallelFor(const std::size_t count, const FunctorType &functor)
A parallel for loop (multithreading)
Definition: parallel_for.hh:172
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
The flux variables caches for an element.
Definition: discretization/cvfe/elementfluxvariablescache.hh:43
Flux variable caches traits.
Definition: discretization/cvfe/gridfluxvariablescache.hh:41
P Problem
Definition: discretization/cvfe/gridfluxvariablescache.hh:42
FVC FluxVariablesCache
Definition: discretization/cvfe/gridfluxvariablescache.hh:43
Flux variable caches on a gridview.
Definition: discretization/cvfe/gridfluxvariablescache.hh:58
Flux variable caches on a gridview with grid caching enabled.
Definition: discretization/cvfe/gridfluxvariablescache.hh:67
FluxVariablesCache & cache(std::size_t eIdx, std::size_t scvfIdx)
Definition: discretization/cvfe/gridfluxvariablescache.hh:116
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition: discretization/cvfe/gridfluxvariablescache.hh:73
const Problem & problem() const
Definition: discretization/cvfe/gridfluxvariablescache.hh:108
const FluxVariablesCache & cache(std::size_t eIdx, std::size_t scvfIdx) const
Definition: discretization/cvfe/gridfluxvariablescache.hh:112
CVFEGridFluxVariablesCache(const Problem &problem)
Definition: discretization/cvfe/gridfluxvariablescache.hh:81
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: discretization/cvfe/gridfluxvariablescache.hh:79
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition: discretization/cvfe/gridfluxvariablescache.hh:84
Flux variable caches on a gridview with grid caching disabled.
Definition: discretization/cvfe/gridfluxvariablescache.hh:131
CVFEGridFluxVariablesCache(const Problem &problem)
Definition: discretization/cvfe/gridfluxvariablescache.hh:145
const Problem & problem() const
Definition: discretization/cvfe/gridfluxvariablescache.hh:153
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: discretization/cvfe/gridfluxvariablescache.hh:143
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition: discretization/cvfe/gridfluxvariablescache.hh:137
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition: discretization/cvfe/gridfluxvariablescache.hh:148
Global flux variable cache.