https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MutableCoefficientsFunctionInterface.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11
14{
16
18
19 params.addClassDescription("Interface based on MutableCoefficientsInterface for natively "
20 "supporting operations based on an array of coefficients");
21
22 params.addParam<std::vector<Real>>("coefficients", "Coefficients required by the function.");
23
24 return params;
25}
26
28 const MooseObject * moose_object, const InputParameters & parameters)
29 : MemoizedFunctionInterface(parameters),
31 MutableCoefficientsInterface(moose_object, parameters)
32{
33 if (isParamValid("coefficients"))
34 setCoefficients(getParam<std::vector<Real>>("coefficients")), enforceSize(true);
35}
36
37void
39{
40 // The coefficients have changed, which invalidates the cache
42}
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
Implementation of Function that memoizes (caches) former evaluations in an unordered map using a hash...
void invalidateCache()
Called by derived classes to invalidate the cache, perhaps due to a state change.
static InputParameters validParams()
const T & getParam(const std::string &name) const
bool isParamValid(const std::string &name) const
virtual void coefficientsChanged() override
Called when the coefficients have been changed.
MutableCoefficientsFunctionInterface(const MooseObject *moose_object, const InputParameters &parameters)
This class is designed to provide a uniform interface for any class that uses an array of coefficient...
void enforceSize(bool enforce)
Toggle whether the size of the coefficient array can be changed.
void setCoefficients(const std::vector< Real > &new_coefficients)
Set the coefficients using a copy operation.