12#ifndef DUMUX_DISCRETIZATION_CVFE_LAZY_ELEMENT_CACHE_HH
13#define DUMUX_DISCRETIZATION_CVFE_LAZY_ELEMENT_CACHE_HH
27template<
class Cache,
class Problem,
class ElementVariables>
30 using Update = void(*)(Cache&,
const void*,
const Problem&,
const ElementVariables&);
37 template<
class ElementDiscretization>
38 void bind(
const ElementDiscretization& elemDisc)
40 elemDisc_ = &elemDisc;
41 update_ = [](Cache& cache,
const void* elemDiscPtr,
const Problem& problem,
const ElementVariables& elemVars)
43 const auto& elemDisc = *
static_cast<const ElementDiscretization*
>(elemDiscPtr);
44 cache.update(problem, elemDisc.element(), elemDisc, elemVars);
50 const Cache&
get(
const Problem& problem,
const ElementVariables& elemVars)
const
54 update_(cache_, elemDisc_, problem, elemVars);
61 Cache&
get(
const Problem& problem,
const ElementVariables& elemVars)
63 std::as_const(*this).get(problem, elemVars);
69 mutable bool isUpToDate_ =
false;
70 const void* elemDisc_ =
nullptr;
71 Update update_ =
nullptr;
An element cache that is updated on its first access after binding.
Definition lazyelementcache.hh:29
void bind(const ElementDiscretization &elemDisc)
Bind to an element discretization, the cache is updated on the next access.
Definition lazyelementcache.hh:38
const Cache & get(const Problem &problem, const ElementVariables &elemVars) const
The cache, updated if this is the first access after binding.
Definition lazyelementcache.hh:50
Cache & get(const Problem &problem, const ElementVariables &elemVars)
The cache, updated if this is the first access after binding.
Definition lazyelementcache.hh:61
Definition elementinterpolationpointdatacache.hh:21