www.mooseframework.org
MutableCoefficientsFunctionInterface.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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),
30  FunctionInterface(this),
31  MutableCoefficientsInterface(moose_object, parameters)
32 {
33  if (isParamValid("coefficients"))
34  setCoefficients(getParam<std::vector<Real>>("coefficients")), enforceSize(true);
35 }
36 
37 void
39 {
40  // The coefficients have changed, which invalidates the cache
42 }
void setCoefficients(const std::vector< Real > &new_coefficients)
Set the coefficients using a copy operation.
void invalidateCache()
Called by derived classes to invalidate the cache, perhaps due to a state change. ...
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
bool isParamValid(const std::string &name) const
MutableCoefficientsFunctionInterface(const MooseObject *moose_object, const InputParameters &parameters)
const T & getParam(const std::string &name) const
void addClassDescription(const std::string &doc_string)
Implementation of Function that memoizes (caches) former evaluations in an unordered map using a hash...
This class is designed to provide a uniform interface for any class that uses an array of coefficient...
virtual void coefficientsChanged() override
Called when the coefficients have been changed.
void enforceSize(bool enforce)
Toggle whether the size of the coefficient array can be changed.