https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ParsedChainControl.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
10#include "ParsedChainControl.h"
12
14
17{
20
22 "Parses and evaluates a function expression to populate a control value.");
23
24 params.addRequiredCustomTypeParam<std::string>(
25 "expression", "FunctionExpression", "Expression to parse to create the function to evaluate");
26 params.addParam<Point>("point", Point(), "Spatial point at which to evaluate the function");
27
28 return params;
29}
30
32 : ChainControl(parameters),
33 MooseParsedFunctionBase(parameters),
34 _function_expression(verifyFunction(getParam<std::string>("expression"))),
35 _value(declareChainControlData<Real>("value")),
36 _point(getParam<Point>("point"))
37{
38}
39
40void
42{
43 if (!_function_ptr)
44 {
45 THREAD_ID tid = 0;
46 if (isParamValid("_tid"))
47 tid = getParam<THREAD_ID>("_tid");
48
49 _function_ptr = std::make_unique<ChainControlParsedFunctionWrapper>(
51 }
52}
53
54void
56{
58
59 // Add dependencies for the chain control data used in the function expression
60 for (auto & data_ptr : _function_ptr->getRealChainControlData())
61 addChainControlDataDependency(data_ptr->name());
62 for (auto & data_ptr : _function_ptr->getBoolChainControlData())
63 addChainControlDataDependency(data_ptr->name());
64}
65
66void
unsigned int THREAD_ID
Definition MooseTypes.h:237
registerMooseObject("MooseApp", ParsedChainControl)
Control that additionally provides the capability to produce/consume data values, to allow control op...
static InputParameters validParams()
void addChainControlDataDependency(const std::string &data_name)
Adds a chain control data dependency into the list.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addRequiredCustomTypeParam(const std::string &name, const std::string &custom_type, const std::string &doc_string)
These methods add an option parameter and with a customer type to the InputParameters object.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition MooseBase.h:199
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
Definition MooseBase.h:87
Adds user facing parameters for parsed function.
const std::vector< std::string > _vals
Values passed by the user, they may be Reals for Postprocessors.
FEProblemBase & _pfb_feproblem
Reference to the FEProblemBase class for this object.
static InputParameters validParams()
Class constructor for the interface.
const std::vector< std::string > _vars
Variables passed to libMesh::ParsedFunction.
Parses and evaluates a function expression to populate a control value.
Real & _value
Control value to populate.
static InputParameters validParams()
virtual void init() override
Initialization that occurs in ChainControlSetupAction, right before the dependencies are added.
const std::string _function_expression
Function expression to parse and evaluate.
ParsedChainControl(const InputParameters &parameters)
void buildFunction()
Builds the function that will be evaluated by this control.
virtual void execute() override
Execute the control.
std::unique_ptr< ChainControlParsedFunctionWrapper > _function_ptr
Pointer to the Parsed chain control function.
const Point _point
Spatial point at which to evaluate the function.