19 const std::string & function_str,
20 const std::vector<std::string> &
vars,
21 const std::vector<std::string> & vals,
23 : _feproblem(feproblem), _function_str(function_str), _vars(
vars), _vals_input(vals), _tid(tid)
30 for (
auto & v :
_vars)
52 (*_function_ptr)(p, t, output);
94 for (
unsigned int i = 0; i <
_vals_input.size(); ++i)
130 val = MooseUtils::convert<Real>(
_vals_input[i],
true);
132 catch (
const std::invalid_argument & e)
134 mooseError(
"'No postprocessor, scalar variable, or function with the name '",
147 for (
unsigned int i = 0; i <
_pp_index.size(); ++i)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Real PostprocessorValue
various MOOSE typedefs
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual bool hasScalarVariable(const std::string &var_name) const override
Returns a Boolean indicating whether any system contains a variable with the name provided.
virtual MooseVariableScalar & getScalarVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the scalar variable reference from whichever system contains it.
const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name, std::size_t t_index=0) const
Get a read-only reference to the value associated with a Postprocessor that exists.
const ReporterData & getReporterData() const
Provides const access the ReporterData object.
virtual bool hasFunction(const std::string &name, const THREAD_ID tid=0)
virtual Function & getFunction(const std::string &name, const THREAD_ID tid=0)
Base class for function objects.
const std::vector< std::string > & _vars
List of variables supplied from the user.
void update()
Updates postprocessor and scalar values for use in the libMesh::ParsedFunction.
T evaluate(Real t, const Point &p)
A template method for performing the evaluation of the libMesh::ParsedFunction Within the source two ...
const std::string & _function_str
Reference to the string containing the function to evaluate.
std::unique_ptr< libMesh::ParsedFunction< Real > > _function_ptr
Pointer to the libMesh::ParsedFunction object.
void initialize()
Initialization method that prepares the _vars and _initial_vals for use by the libMesh::ParsedFunctio...
std::vector< Real * > _addr
Pointers to the variables that store the values of _vars inside the libMesh::ParsedFunction object.
const THREAD_ID _tid
The thread id passed from owning Function object.
const std::vector< std::string > & _vals_input
List of the values for the variables supplied by the user.
std::vector< Real > _initial_vals
Storage for the initial values of _vars variables used by the libMesh::ParsedFunction object.
virtual ~MooseParsedFunctionWrapper()
Class destruction Deletes the pointer to the dynamically allocated instance of the underlying libMesh...
RealGradient evaluateGradient(Real t, const Point &p)
Evaluate the gradient of the function which libMesh provides through automatic differentiation.
std::vector< unsigned int > _function_index
Stores indices into _addr that are connected to Functions this libMesh::ParsedFunction is using.
std::vector< unsigned int > _scalar_index
Stores indicies into _addr variable that are connected to Scalar Variables.
FEProblemBase & _feproblem
Reference to the FEProblemBase object.
std::vector< const Function * > _functions
Vector of Functions this parsed function is using.
Real evaluateDot(Real t, const Point &p)
Evaluate the time derivative of the function which libMesh provides through automatic differentiation...
void updateFunctionValues(Real t, const Point &pt)
Updates function values for use in the libMesh::ParsedFunction.
std::vector< const Real * > _pp_vals
Vector of pointers to postprocessor values this parsed function is using.
std::vector< unsigned int > _pp_index
Stores indices into _addr variable that are connected to Postprocessors.
MooseParsedFunctionWrapper(FEProblemBase &feproblem, const std::string &function_str, const std::vector< std::string > &vars, const std::vector< std::string > &vals, const THREAD_ID tid=0)
Class constructor.
std::vector< const Real * > _scalar_vals
Vector of pointers to scalar variables values.
const VariableValue & sln() const
bool hasReporterValue(const ReporterName &reporter_name) const
Return True if a Reporter value with the given type and name have been created.
The Reporter system is comprised of objects that can contain any number of data values.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
VectorValue< Real > RealVectorValue
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real