www.mooseframework.org
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MutableCoefficientsFunctionInterface Class Referenceabstract

Interface for a type of functions using coefficients that may be changed before or after a solve. More...

#include <MutableCoefficientsFunctionInterface.h>

Inheritance diagram for MutableCoefficientsFunctionInterface:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 
typedef FunctorBase< RealFunctorType
 
typedef Real ValueType
 
typedef typename FunctorReturnType< Real, FunctorEvaluationKind::Gradient >::type GradientType
 
typedef ValueType DotType
 

Public Member Functions

 MutableCoefficientsFunctionInterface (const MooseObject *moose_object, const InputParameters &parameters)
 
virtual void meshChanged () override
 
void useCache (bool use)
 Enable/disable the cache. More...
 
virtual Real value (Real time, const Point &point) const final
 
virtual ADReal value (const ADReal &time, const ADPoint &point) const final
 
virtual Real value (Real t, const Point &p) const
 
virtual ADReal value (const ADReal &t, const ADPoint &p) const
 
ChainedReal value (const ChainedReal &t) const
 
auto value (const U &t) const
 
auto value (const U &t, const U &x, const U &y=0, const U &z=0) const
 
ChainedReal value (const ChainedReal &t) const
 
auto value (const U &t) const
 
auto value (const U &t, const U &x, const U &y=0, const U &z=0) const
 
ChainedReal value (const ChainedReal &t) const
 
auto value (const U &t) const
 
auto value (const U &t, const U &x, const U &y=0, const U &z=0) const
 
virtual RealVectorValue vectorValue (Real t, const Point &p) const
 
virtual RealVectorValue curl (Real t, const Point &p) const
 
virtual Real div (Real t, const Point &p) const
 
virtual RealGradient gradient (Real t, const Point &p) const
 
GradientType gradient (const ElemArg &elem, const StateArg &state) const
 
GradientType gradient (const FaceArg &face, const StateArg &state) const
 
GradientType gradient (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradient (const NodeArg &node, const StateArg &state) const
 
GradientType gradient (const ElemArg &elem, const StateArg &state) const
 
GradientType gradient (const FaceArg &face, const StateArg &state) const
 
GradientType gradient (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradient (const NodeArg &node, const StateArg &state) const
 
GradientType gradient (const ElemArg &elem, const StateArg &state) const
 
GradientType gradient (const FaceArg &face, const StateArg &state) const
 
GradientType gradient (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradient (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradient (const NodeArg &node, const StateArg &state) const
 
virtual Real timeDerivative (Real t, const Point &p) const
 
auto timeDerivative (const U &t) const
 
auto timeDerivative (const U &t, const U &x, const U &y=0, const U &z=0) const
 
auto timeDerivative (const U &t) const
 
auto timeDerivative (const U &t, const U &x, const U &y=0, const U &z=0) const
 
virtual Real integral () const
 
virtual Real average () const
 
void timestepSetup () override
 
void residualSetup () override
 
void jacobianSetup () override
 
void customSetup (const ExecFlagType &exec_type) override
 
bool hasBlocks (SubdomainID) const override
 
bool supportsFaceArg () const override final
 
bool supportsElemSideQpArg () const override final
 
virtual bool enabled () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &name, const std::string *param=nullptr) const
 
virtual void initialSetup ()
 
virtual void subdomainSetup ()
 
const ExecFlagEnumgetExecuteOnEnum () const
 
bool isImplicit ()
 
bool isDefaultPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessor (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessorByName (const PostprocessorName &name) const
 
std::size_t coupledPostprocessors (const std::string &param_name) const
 
const PostprocessorName & getPostprocessorName (const std::string &param_name, const unsigned int index=0) const
 
UserObjectName getUserObjectName (const std::string &param_name) const
 
const T & getUserObject (const std::string &param_name, bool is_dependency=true) const
 
const T & getUserObjectByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const UserObjectgetUserObjectBase (const std::string &param_name, bool is_dependency=true) const
 
const UserObjectgetUserObjectBaseByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const std::vector< MooseVariableScalar *> & getCoupledMooseScalarVars ()
 
const std::set< TagID > & getScalarVariableCoupleableVectorTags () const
 
const std::set< TagID > & getScalarVariableCoupleableMatrixTags () const
 
FunctorReturnType< Real, FET >::type genericEvaluate (const Space &r, const State &state) const
 
const MooseFunctorName & functorName () const
 
void setCacheClearanceSchedule (const std::set< ExecFlagType > &clearance_schedule)
 
virtual bool isExtrapolatedBoundaryFace (const FaceInfo &, const Elem *, const StateArg &) const
 
bool isInternalFace (const FaceInfo &) const
 
virtual bool isConstant () const
 
virtual bool hasFaceSide (const FaceInfo &fi, const bool fi_elem_side) const override
 
Moose::FaceArg checkFace (const Moose::FaceArg &face) const
 
const PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
virtual const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name) const
 
virtual const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (const PostprocessorName &name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
ValueType operator() (const ElemArg &elem, const StateArg &state) const
 
ValueType operator() (const FaceArg &face, const StateArg &state) const
 
ValueType operator() (const ElemQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemSideQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemPointArg &elem_point, const StateArg &state) const
 
ValueType operator() (const NodeArg &node, const StateArg &state) const
 
ValueType operator() (const ElemArg &elem, const StateArg &state) const
 
ValueType operator() (const FaceArg &face, const StateArg &state) const
 
ValueType operator() (const ElemQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemSideQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemPointArg &elem_point, const StateArg &state) const
 
ValueType operator() (const NodeArg &node, const StateArg &state) const
 
ValueType operator() (const ElemArg &elem, const StateArg &state) const
 
ValueType operator() (const FaceArg &face, const StateArg &state) const
 
ValueType operator() (const ElemQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemSideQpArg &qp, const StateArg &state) const
 
ValueType operator() (const ElemPointArg &elem_point, const StateArg &state) const
 
ValueType operator() (const NodeArg &node, const StateArg &state) const
 
DotType dot (const ElemArg &elem, const StateArg &state) const
 
DotType dot (const FaceArg &face, const StateArg &state) const
 
DotType dot (const ElemQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemSideQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemPointArg &elem_point, const StateArg &state) const
 
DotType dot (const NodeArg &node, const StateArg &state) const
 
DotType dot (const ElemArg &elem, const StateArg &state) const
 
DotType dot (const FaceArg &face, const StateArg &state) const
 
DotType dot (const ElemQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemSideQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemPointArg &elem_point, const StateArg &state) const
 
DotType dot (const NodeArg &node, const StateArg &state) const
 
DotType dot (const ElemArg &elem, const StateArg &state) const
 
DotType dot (const FaceArg &face, const StateArg &state) const
 
DotType dot (const ElemQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemSideQpArg &qp, const StateArg &state) const
 
DotType dot (const ElemPointArg &elem_point, const StateArg &state) const
 
DotType dot (const NodeArg &node, const StateArg &state) const
 
GradientType gradDot (const ElemArg &elem, const StateArg &state) const
 
GradientType gradDot (const FaceArg &face, const StateArg &state) const
 
GradientType gradDot (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradDot (const NodeArg &node, const StateArg &state) const
 
GradientType gradDot (const ElemArg &elem, const StateArg &state) const
 
GradientType gradDot (const FaceArg &face, const StateArg &state) const
 
GradientType gradDot (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradDot (const NodeArg &node, const StateArg &state) const
 
GradientType gradDot (const ElemArg &elem, const StateArg &state) const
 
GradientType gradDot (const FaceArg &face, const StateArg &state) const
 
GradientType gradDot (const ElemQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemSideQpArg &qp, const StateArg &state) const
 
GradientType gradDot (const ElemPointArg &elem_point, const StateArg &state) const
 
GradientType gradDot (const NodeArg &node, const StateArg &state) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
Real operator[] (std::size_t index) const
 Get the value of the coefficient at the corresponding index. More...
 
const std::vector< std::size_t > & getCharacteristics () const
 Get a reference to the characteristics array. More...
 
const std::vector< Real > & getCoefficients () const
 Get a read-only reference to the vector of coefficients. More...
 
std::vector< Real > & getCoefficients ()
 Get a writeable reference to the vector of coefficients. More...
 
std::string getCoefficientsTable () const
 Get a formatted string of the coefficients. More...
 
std::size_t getSize () const
 Get the size, aka number of coefficients. More...
 
bool isCompatibleWith (const MutableCoefficientsInterface &other) const
 Checks to see if another instance is compatible. More...
 
bool isSizeEnforced () const
 Returns true if the size of the coefficient array is fixed and enforced. More...
 
void enforceSize (bool enforce)
 Toggle whether the size of the coefficient array can be changed. More...
 
void importCoefficients (const MutableCoefficientsInterface &other)
 Import the coefficients from another instance. More...
 
void resize (std::size_t size, Real fill=0.0, bool fill_out_to_size=true)
 Resize the array, using the value for fill if the new size is larger. More...
 
void setCharacteristics (const std::vector< std::size_t > &new_characteristics)
 Sets the characteristics array. More...
 
void setCoefficients (const std::vector< Real > &new_coefficients)
 Set the coefficients using a copy operation. More...
 
void setCoefficients (std::vector< Real > &&dropin_coefficients)
 Set the coefficients using a move operation (only works with temp objects) More...
 

Static Public Member Functions

static InputParameters validParams ()
 

Public Attributes

const ConsoleStream _console
 

Protected Member Functions

virtual void coefficientsChanged () override
 Called when the coefficients have been changed. More...
 
virtual Real evaluateValue (Real time, const Point &point)=0
 Used in derived classes, equivalent to Function::value() More...
 
void invalidateCache ()
 Called by derived classes to invalidate the cache, perhaps due to a state change. More...
 
Moose::StateArg determineState () const
 
virtual void addPostprocessorDependencyHelper (const PostprocessorName &) const
 
virtual void addUserObjectDependencyHelper (const UserObject &) const
 
T & declareRestartableData (const std::string &data_name, Args &&... args)
 
ManagedValue< T > declareManagedRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
const T & getRestartableData (const std::string &data_name) const
 
T & declareRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
T & declareRecoverableData (const std::string &data_name, Args &&... args)
 
T & declareRestartableDataWithObjectName (const std::string &data_name, const std::string &object_name, Args &&... args)
 
T & declareRestartableDataWithObjectNameWithContext (const std::string &data_name, const std::string &object_name, void *context, Args &&... args)
 
std::string restartableName (const std::string &data_name) const
 
bool isCoupledScalar (const std::string &var_name, unsigned int i=0) const
 
unsigned int coupledScalarComponents (const std::string &var_name) const
 
unsigned int coupledScalar (const std::string &var_name, unsigned int comp=0) const
 
Order coupledScalarOrder (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< is_ad > & coupledGenericScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< false > & coupledGenericScalarValue (const std::string &var_name, const unsigned int comp) const
 
const GenericVariableValue< true > & coupledGenericScalarValue (const std::string &var_name, const unsigned int comp) const
 
const VariableValuecoupledVectorTagScalarValue (const std::string &var_name, TagID tag, unsigned int comp=0) const
 
const VariableValuecoupledMatrixTagScalarValue (const std::string &var_name, TagID tag, unsigned int comp=0) const
 
const VariableValuecoupledScalarValueOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarValueOlder (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDot (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledScalarDot (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDot (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDotOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDu (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDotDu (const std::string &var_name, unsigned int comp=0) const
 
const MooseVariableScalargetScalarVar (const std::string &var_name, unsigned int comp) const
 
virtual GradientType evaluateGradDot (const ElemArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const FaceArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemSideQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemPointArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const NodeArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const FaceArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemSideQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemPointArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const NodeArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const FaceArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemSideQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const ElemPointArg &, const StateArg &) const
 
virtual GradientType evaluateGradDot (const NodeArg &, const StateArg &) const
 
virtual ValueType evaluate (const ElemArg &elem, const StateArg &state) const =0
 
virtual ValueType evaluate (const FaceArg &face, const StateArg &state) const =0
 
virtual ValueType evaluate (const ElemQpArg &qp, const StateArg &state) const =0
 
virtual ValueType evaluate (const ElemSideQpArg &side_qp, const StateArg &state) const =0
 
virtual ValueType evaluate (const ElemPointArg &elem_point, const StateArg &state) const =0
 
virtual ValueType evaluate (const NodeArg &node, const StateArg &state) const =0
 
virtual GradientType evaluateGradient (const ElemArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const FaceArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const ElemQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const ElemSideQpArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const ElemPointArg &, const StateArg &) const
 
virtual GradientType evaluateGradient (const NodeArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemArg &, const StateArg &) const
 
virtual DotType evaluateDot (const FaceArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemQpArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemSideQpArg &, const StateArg &) const
 
virtual DotType evaluateDot (const ElemPointArg &, const StateArg &) const
 
virtual DotType evaluateDot (const NodeArg &, const StateArg &) const
 
const FunctiongetFunction (const std::string &name) const
 
const FunctiongetFunctionByName (const FunctionName &name) const
 
bool hasFunction (const std::string &param_name) const
 
bool hasFunctionByName (const FunctionName &name) const
 

Protected Attributes

const bool & _enabled
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
const ExecFlagEnum_execute_enum
 
const ExecFlagType_current_execute_flag
 
const InputParameters_ti_params
 
FEProblemBase_ti_feproblem
 
bool _is_implicit
 
Real_t
 
int_t_step
 
Real_dt
 
Real_dt_old
 
bool _is_transient
 
MooseApp_restartable_app
 
const std::string _restartable_system_name
 
const THREAD_ID _restartable_tid
 
const bool _restartable_read_only
 
FEProblemBase_mci_feproblem
 
FEProblemBase_sc_fe_problem
 
const THREAD_ID _sc_tid
 
const Real_real_zero
 
const VariableValue_scalar_zero
 
const Point & _point_zero
 
const Parallel::Communicator & _communicator
 
std::vector< std::size_t > & _characteristics
 An array of integer characteristics that can be used to check compatibility. More...
 
std::vector< Real > & _coefficients
 The coefficient array. More...
 
bool _enforce_size
 Boolean that locks or allows resizing of the coefficient array. More...
 
const bool _print_coefficients
 Boolean to flag if the coefficients should be printed when set. More...
 

Detailed Description

Interface for a type of functions using coefficients that may be changed before or after a solve.

Definition at line 20 of file MutableCoefficientsFunctionInterface.h.

Constructor & Destructor Documentation

◆ MutableCoefficientsFunctionInterface()

MutableCoefficientsFunctionInterface::MutableCoefficientsFunctionInterface ( const MooseObject moose_object,
const InputParameters parameters 
)

Definition at line 27 of file MutableCoefficientsFunctionInterface.C.

30  FunctionInterface(this),
32 {
33  if (isParamValid("coefficients"))
34  setCoefficients(getParam<std::vector<Real>>("coefficients")), enforceSize(true);
35 }
void setCoefficients(const std::vector< Real > &new_coefficients)
Set the coefficients using a copy operation.
FunctionInterface(const MooseObject *moose_object)
bool isParamValid(const std::string &name) const
MutableCoefficientsInterface(const MooseObject *moose_object, const InputParameters &parameters)
const T & getParam(const std::string &name) const
MemoizedFunctionInterface(const InputParameters &parameters)
const InputParameters & parameters() const
void enforceSize(bool enforce)
Toggle whether the size of the coefficient array can be changed.

Member Function Documentation

◆ coefficientsChanged()

void MutableCoefficientsFunctionInterface::coefficientsChanged ( )
overrideprotectedvirtual

Called when the coefficients have been changed.

Reimplemented from MutableCoefficientsInterface.

Definition at line 38 of file MutableCoefficientsFunctionInterface.C.

39 {
40  // The coefficients have changed, which invalidates the cache
42 }
void invalidateCache()
Called by derived classes to invalidate the cache, perhaps due to a state change. ...

◆ enforceSize()

void MutableCoefficientsInterface::enforceSize ( bool  enforce)
inherited

Toggle whether the size of the coefficient array can be changed.

Definition at line 111 of file MutableCoefficientsInterface.C.

Referenced by FunctionSeries::FunctionSeries(), and MutableCoefficientsFunctionInterface().

112 {
113  _enforce_size = enforce;
114 }
bool _enforce_size
Boolean that locks or allows resizing of the coefficient array.

◆ evaluateValue()

virtual Real MemoizedFunctionInterface::evaluateValue ( Real  time,
const Point &  point 
)
protectedpure virtualinherited

Used in derived classes, equivalent to Function::value()

Implemented in FunctionSeries.

Referenced by MemoizedFunctionInterface::value().

◆ getCharacteristics()

const std::vector< std::size_t > & MutableCoefficientsInterface::getCharacteristics ( ) const
inherited

Get a reference to the characteristics array.

Definition at line 51 of file MutableCoefficientsInterface.C.

52 {
53  return _characteristics;
54 }
std::vector< std::size_t > & _characteristics
An array of integer characteristics that can be used to check compatibility.

◆ getCoefficients() [1/2]

const std::vector< Real > & MutableCoefficientsInterface::getCoefficients ( ) const
inherited

Get a read-only reference to the vector of coefficients.

Definition at line 57 of file MutableCoefficientsInterface.C.

58 {
59  return _coefficients;
60 }
std::vector< Real > & _coefficients
The coefficient array.

◆ getCoefficients() [2/2]

std::vector< Real > & MutableCoefficientsInterface::getCoefficients ( )
inherited

Get a writeable reference to the vector of coefficients.

Definition at line 63 of file MutableCoefficientsInterface.C.

64 {
65  return _coefficients;
66 }
std::vector< Real > & _coefficients
The coefficient array.

◆ getCoefficientsTable()

std::string MutableCoefficientsInterface::getCoefficientsTable ( ) const
inherited

Get a formatted string of the coefficients.

Definition at line 69 of file MutableCoefficientsInterface.C.

70 {
71  std::stringbuf string;
72  std::ostream table(&string);
73 
74  table << *this;
75 
76  return string.str();
77 }

◆ getSize()

std::size_t MutableCoefficientsInterface::getSize ( ) const
inherited

Get the size, aka number of coefficients.

Definition at line 80 of file MutableCoefficientsInterface.C.

Referenced by MutableCoefficientsInterface::isCompatibleWith(), and operator<<().

81 {
82  return _coefficients.size();
83 }
std::vector< Real > & _coefficients
The coefficient array.

◆ importCoefficients()

void MutableCoefficientsInterface::importCoefficients ( const MutableCoefficientsInterface other)
inherited

Import the coefficients from another instance.

Definition at line 117 of file MutableCoefficientsInterface.C.

Referenced by MultiAppFXTransfer::execute().

118 {
119  if (!isCompatibleWith(other))
120  mooseError("Cannot import coefficients from incompatible MutableCoefficientsInterface");
121 
123 
125  _console << *this;
126 
128 }
void mooseError(Args &&... args)
virtual void coefficientsChanged()
Called when the coefficients have been changed.
const bool _print_coefficients
Boolean to flag if the coefficients should be printed when set.
bool isCompatibleWith(const MutableCoefficientsInterface &other) const
Checks to see if another instance is compatible.
std::vector< Real > & _coefficients
The coefficient array.
const ConsoleStream & _console
MooseObject instance of this to provide access to _console

◆ invalidateCache()

void MemoizedFunctionInterface::invalidateCache ( )
protectedinherited

Called by derived classes to invalidate the cache, perhaps due to a state change.

Definition at line 89 of file MemoizedFunctionInterface.C.

Referenced by coefficientsChanged(), MemoizedFunctionInterface::meshChanged(), MemoizedFunctionInterface::useCache(), and MemoizedFunctionInterface::value().

90 {
91  _cache.clear();
92 }
std::unordered_map< hashing::HashValue, Real > _cache
Cached evaluations for each point.

◆ isCompatibleWith()

bool MutableCoefficientsInterface::isCompatibleWith ( const MutableCoefficientsInterface other) const
inherited

Checks to see if another instance is compatible.

Definition at line 86 of file MutableCoefficientsInterface.C.

Referenced by MultiAppFXTransfer::execute(), and MutableCoefficientsInterface::importCoefficients().

87 {
88  // Check the coefficient sizes if requested
89  if ((_enforce_size && other._enforce_size) && getSize() != other.getSize())
90  return false;
91 
92  // Check the size of the characteristics array
93  if (_characteristics.size() != other._characteristics.size())
94  return false;
95 
96  // Check the values of the characteristics array
97  for (std::size_t i = 0; i < _characteristics.size(); ++i)
98  if (_characteristics[i] != other._characteristics[i])
99  return false;
100 
101  return true;
102 }
bool _enforce_size
Boolean that locks or allows resizing of the coefficient array.
std::vector< std::size_t > & _characteristics
An array of integer characteristics that can be used to check compatibility.
std::size_t getSize() const
Get the size, aka number of coefficients.

◆ isSizeEnforced()

bool MutableCoefficientsInterface::isSizeEnforced ( ) const
inherited

Returns true if the size of the coefficient array is fixed and enforced.

Definition at line 105 of file MutableCoefficientsInterface.C.

106 {
107  return _enforce_size;
108 }
bool _enforce_size
Boolean that locks or allows resizing of the coefficient array.

◆ meshChanged()

void MemoizedFunctionInterface::meshChanged ( )
overridevirtualinherited

Reimplemented from Function.

Definition at line 39 of file MemoizedFunctionInterface.C.

40 {
41  // The mesh has changed, which invalidates the cache
43 }
void invalidateCache()
Called by derived classes to invalidate the cache, perhaps due to a state change. ...

◆ operator[]()

Real MutableCoefficientsInterface::operator[] ( std::size_t  index) const
inherited

Get the value of the coefficient at the corresponding index.

Definition at line 45 of file MutableCoefficientsInterface.C.

46 {
47  return _coefficients[index];
48 }
std::vector< Real > & _coefficients
The coefficient array.

◆ resize()

void MutableCoefficientsInterface::resize ( std::size_t  size,
Real  fill = 0.0,
bool  fill_out_to_size = true 
)
inherited

Resize the array, using the value for fill if the new size is larger.

Definition at line 131 of file MutableCoefficientsInterface.C.

Referenced by FunctionSeries::FunctionSeries().

132 {
133  if (size != _coefficients.size())
134  {
135  if (_enforce_size &&
136  (size > _coefficients.size() || (size < _coefficients.size() && !fill_out_to_size)))
137  mooseError("Cannot resize coefficient array with size enforcement enabled.");
138 
139  _coefficients.resize(size, fill);
140 
142  _console << *this;
143 
145  }
146 }
void mooseError(Args &&... args)
virtual void coefficientsChanged()
Called when the coefficients have been changed.
const bool _print_coefficients
Boolean to flag if the coefficients should be printed when set.
bool _enforce_size
Boolean that locks or allows resizing of the coefficient array.
std::vector< Real > & _coefficients
The coefficient array.
const ConsoleStream & _console
MooseObject instance of this to provide access to _console

◆ setCharacteristics()

void MutableCoefficientsInterface::setCharacteristics ( const std::vector< std::size_t > &  new_characteristics)
inherited

Sets the characteristics array.

Definition at line 149 of file MutableCoefficientsInterface.C.

Referenced by FunctionSeries::FunctionSeries().

151 {
152  _characteristics = new_characteristics;
153 }
std::vector< std::size_t > & _characteristics
An array of integer characteristics that can be used to check compatibility.

◆ setCoefficients() [1/2]

void MutableCoefficientsInterface::setCoefficients ( const std::vector< Real > &  new_coefficients)
inherited

Set the coefficients using a copy operation.

Definition at line 156 of file MutableCoefficientsInterface.C.

Referenced by MutableCoefficientsFunctionInterface().

157 {
158  if (_enforce_size && new_coefficients.size() != _coefficients.size())
159  mooseError("Cannon assigned a coefficient array with differing size when size enforcement is "
160  "enabled.");
161 
162  _coefficients = new_coefficients;
163 
165  _console << *this;
166 
168 }
void mooseError(Args &&... args)
virtual void coefficientsChanged()
Called when the coefficients have been changed.
const bool _print_coefficients
Boolean to flag if the coefficients should be printed when set.
bool _enforce_size
Boolean that locks or allows resizing of the coefficient array.
std::vector< Real > & _coefficients
The coefficient array.
const ConsoleStream & _console
MooseObject instance of this to provide access to _console

◆ setCoefficients() [2/2]

void MutableCoefficientsInterface::setCoefficients ( std::vector< Real > &&  dropin_coefficients)
inherited

Set the coefficients using a move operation (only works with temp objects)

Definition at line 171 of file MutableCoefficientsInterface.C.

172 {
173  if (_enforce_size && dropin_coefficients.size() != _coefficients.size())
174  mooseError("Cannon assigned a coefficient array with differing size when size enforcement is "
175  "enabled.");
176 
177  _coefficients = dropin_coefficients;
178 
180  _console << *this;
181 
183 }
void mooseError(Args &&... args)
virtual void coefficientsChanged()
Called when the coefficients have been changed.
const bool _print_coefficients
Boolean to flag if the coefficients should be printed when set.
bool _enforce_size
Boolean that locks or allows resizing of the coefficient array.
std::vector< Real > & _coefficients
The coefficient array.
const ConsoleStream & _console
MooseObject instance of this to provide access to _console

◆ useCache()

void MemoizedFunctionInterface::useCache ( bool  use)
inherited

Enable/disable the cache.

Definition at line 80 of file MemoizedFunctionInterface.C.

Referenced by FXFluxBC::FXFluxBC(), FXValueBC::FXValueBC(), and FXValuePenaltyBC::FXValuePenaltyBC().

81 {
82  _enable_cache = use;
83 
84  if (!_enable_cache)
86 }
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.

◆ validParams()

InputParameters MutableCoefficientsFunctionInterface::validParams ( )
static

Definition at line 13 of file MutableCoefficientsFunctionInterface.C.

Referenced by FunctionSeries::validParams().

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 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)

◆ value() [1/10]

virtual ADReal Function::value
inherited

◆ value() [2/10]

auto Function::value
inherited

◆ value() [3/10]

ChainedReal Function::value
inherited

◆ value() [4/10]

auto Function::value
inherited

◆ value() [5/10]

auto Function::value
inherited

◆ value() [6/10]

virtual Real Function::value
inherited

◆ value() [7/10]

ChainedReal Function::value
inherited

◆ value() [8/10]

auto Function::value
inherited

◆ value() [9/10]

Real MemoizedFunctionInterface::value ( Real  time,
const Point &  point 
) const
finalvirtualinherited

Reimplemented from Function.

Definition at line 46 of file MemoizedFunctionInterface.C.

47 {
48  MemoizedFunctionInterface * ptr = const_cast<MemoizedFunctionInterface *>(this);
49 
50  if (_enable_cache)
51  {
52  // Start the cache over if we are at a new time step
53  if (_respect_time && time != _current_time)
54  {
55  _current_time = time;
56  ptr->invalidateCache();
57  }
58 
59  // Try to insert a new value into the cache
60  auto result = _cache.insert({hashing::hashCombine(time, point), 0.0});
61 
62  // Evaluate and apply if the insertion worked, i.e. the element didn't exist
63  if (result.second)
64  result.first->second = ptr->evaluateValue(time, point);
65 
66  // Return the cached value
67  return result.first->second;
68  }
69 
70  return ptr->evaluateValue(time, point);
71 }
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.
Real _current_time
Stores the time evaluation of the cache.
void hashCombine(HashValue &)
Final iteration of the variadic template with no additional arguments.
Definition: Hashing.h:28
bool _respect_time
Flag for whether changes in time invalidate the cache.
std::unordered_map< hashing::HashValue, Real > _cache
Cached evaluations for each point.
Implementation of Function that memoizes (caches) former evaluations in an unordered map using a hash...
virtual Real evaluateValue(Real time, const Point &point)=0
Used in derived classes, equivalent to Function::value()

◆ value() [10/10]

ADReal MemoizedFunctionInterface::value ( const ADReal time,
const ADPoint point 
) const
finalvirtualinherited

Reimplemented from Function.

Definition at line 74 of file MemoizedFunctionInterface.C.

75 {
76  mooseError("Not implemented");
77 }
void mooseError(Args &&... args) const

Member Data Documentation

◆ _characteristics

std::vector<std::size_t>& MutableCoefficientsInterface::_characteristics
protectedinherited

◆ _coefficients

std::vector<Real>& MutableCoefficientsInterface::_coefficients
protectedinherited

◆ _enforce_size

bool MutableCoefficientsInterface::_enforce_size
protectedinherited

◆ _print_coefficients

const bool MutableCoefficientsInterface::_print_coefficients
protectedinherited

Boolean to flag if the coefficients should be printed when set.

Definition at line 117 of file MutableCoefficientsInterface.h.

Referenced by MutableCoefficientsInterface::importCoefficients(), MutableCoefficientsInterface::resize(), and MutableCoefficientsInterface::setCoefficients().


The documentation for this class was generated from the following files: