www.mooseframework.org
MooseParsedVectorFunction.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
17 
18 template <>
21 {
24  params.addParam<std::string>("value_x", "0", "x-component of function.");
25  params.addParam<std::string>("value_y", "0", "y-component of function.");
26  params.addParam<std::string>("value_z", "0", "z-component of function.");
27  return params;
28 }
29 
31  : Function(parameters),
32  MooseParsedFunctionBase(parameters),
33  _vector_value(verifyFunction(std::string("{") + getParam<std::string>("value_x") + "}{" +
34  getParam<std::string>("value_y") + "}{" +
35  getParam<std::string>("value_z") + "}"))
36 {
37 }
38 
41 {
42  return _function_ptr->evaluate<RealVectorValue>(t, p);
43 }
44 
46 MooseParsedVectorFunction::gradient(Real /*t*/, const Point & /*p*/)
47 {
48  mooseError("The gradient method is not defined in MooseParsedVectorFunction");
49 }
50 
51 void
53 {
54  if (!_function_ptr)
55  {
56  THREAD_ID tid = 0;
57  if (isParamValid("_tid"))
58  tid = getParam<THREAD_ID>("_tid");
59 
60  _function_ptr = libmesh_make_unique<MooseParsedFunctionWrapper>(
62  }
63 }
std::unique_ptr< MooseParsedFunctionWrapper > _function_ptr
Pointer to the Parsed function wrapper object for the scalar.
RealVectorValue RealGradient
Definition: Assembly.h:43
Base class for function objects.
Definition: Function.h:46
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
Adds user facing parameters for parsed function.
VectorValue< Real > RealVectorValue
Definition: Assembly.h:40
virtual RealVectorValue vectorValue(Real t, const Point &p) override
Override this to evaluate the vector function at a point (t,x,y,z), by default this returns a zero ve...
InputParameters validParams< MooseParsedVectorFunction >()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
FEProblemBase & _pfb_feproblem
Reference to the FEProblemBase class for this object.
const std::vector< std::string > _vals
Values passed by the user, they may be Reals for Postprocessors.
std::string _vector_value
Storage for gradient input function(s), in format ready for libMesh.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition: MooseObject.h:67
InputParameters validParams< MooseParsedFunctionBase >()
Creates the &#39;vars&#39; and &#39;vals&#39; parameters used by all ParsedFunctions, the parameters provided from th...
virtual RealGradient gradient(Real t, const Point &p) override
Function objects can optionally provide a gradient at a point.
MooseParsedVectorFunction(const InputParameters &parameters)
Class constructor.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
void mooseError(Args &&...args) const
Definition: MooseObject.h:80
const std::vector< std::string > _vars
Variables passed to libMesh::ParsedFunction.
InputParameters validParams< Function >()
Definition: Function.C:19
unsigned int THREAD_ID
Definition: MooseTypes.h:79