17 params.
addClassDescription(
"The function uses a cache to potentially reduce the computational " 18 "burden of reusing a complex or costly function");
20 params.
addParam<
bool>(
"enable_cache",
22 "Enables cached function evaluations. Recommended only if this function is " 23 "used directly in a BC or Kernel. This will be enabled automatically if " 24 "any of the FX-based BCs are used.");
26 params.
addParam<
bool>(
"respect_time",
false,
"Enable to clear the cache at each new time step.");
33 _enable_cache(getParam<bool>(
"enable_cache")),
34 _respect_time(getParam<bool>(
"respect_time"))
67 return result.first->second;
void invalidateCache()
Called by derived classes to invalidate the cache, perhaps due to a state change. ...
bool _enable_cache
Flag for whether to cache values.
virtual Real value(Real time, const Point &point) const final
Real _current_time
Stores the time evaluation of the cache.
void hashCombine(HashValue &)
Final iteration of the variadic template with no additional arguments.
static InputParameters validParams()
bool _respect_time
Flag for whether changes in time invalidate the cache.
std::unordered_map< hashing::HashValue, Real > _cache
Cached evaluations for each point.
MemoizedFunctionInterface(const InputParameters ¶meters)
virtual void meshChanged() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
void useCache(bool use)
Enable/disable the cache.
Implementation of Function that memoizes (caches) former evaluations in an unordered map using a hash...
static InputParameters validParams()
virtual Real evaluateValue(Real time, const Point &point)=0
Used in derived classes, equivalent to Function::value()