www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MooseParsedFunctionBase Class Reference

Adds user facing parameters for parsed function. More...

#include <MooseParsedFunctionBase.h>

Inheritance diagram for MooseParsedFunctionBase:
[legend]

Public Member Functions

 MooseParsedFunctionBase (const InputParameters &parameters)
 Class constructor for the interface. More...
 
virtual ~MooseParsedFunctionBase ()
 Class destructor. More...
 

Protected Member Functions

const std::string verifyFunction (const std::string &function_str)
 A helper method to check if the function value contains quotes. More...
 

Protected Attributes

FEProblemBase_pfb_feproblem
 Reference to the FEProblemBase class for this object. More...
 
const std::vector< std::string > _vars
 Variables passed to libMesh::ParsedFunction. More...
 
const std::vector< std::string > _vals
 Values passed by the user, they may be Reals for Postprocessors. More...
 
std::unique_ptr< MooseParsedFunctionWrapper_function_ptr
 Pointer to the Parsed function wrapper object for the scalar. More...
 

Detailed Description

Adds user facing parameters for parsed function.

See also
ParsedFunction ParsedVectorFunction ParsedGradFunction

Definition at line 47 of file MooseParsedFunctionBase.h.

Constructor & Destructor Documentation

MooseParsedFunctionBase::MooseParsedFunctionBase ( const InputParameters parameters)

Class constructor for the interface.

The first parameter, 'name' is not currently used.

Parameters
parametersInput parameters from the object, it must contain '_fe_problem'

Definition at line 34 of file MooseParsedFunctionBase.C.

35  : _pfb_feproblem(*parameters.get<FEProblemBase *>("_fe_problem_base")),
36  _vars(parameters.get<std::vector<std::string>>("vars")),
37  _vals(parameters.get<std::vector<std::string>>("vals"))
38 {
39  if (_vars.size() != _vals.size())
40  mooseError("Number of vars must match the number of vals for a MooseParsedFunction!");
41 
42  // Loop through the variables assigned by the user and give an error if x,y,z,t are used
43  for (const auto & var : _vars)
44  if (var.find_first_of("xyzt") != std::string::npos && var.size() == 1)
45  mooseError("The variables \"x, y, z, and t\" in the ParsedFunction are pre-declared for use "
46  "and must not be declared in \"vars\"");
47 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
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.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const std::vector< std::string > _vars
Variables passed to libMesh::ParsedFunction.
MooseParsedFunctionBase::~MooseParsedFunctionBase ( )
virtual

Class destructor.

Definition at line 49 of file MooseParsedFunctionBase.C.

49 {}

Member Function Documentation

const std::string MooseParsedFunctionBase::verifyFunction ( const std::string &  function_str)
protected

A helper method to check if the function value contains quotes.

This method should be called from within the initialization list of the object inheriting the MooseParsedFunctionInterface

Parameters
function_strThe name of the ParsedFunction
Returns
The vector of strings, if the input function is valid
See also
ParsedFunction

Definition at line 52 of file MooseParsedFunctionBase.C.

53 {
54  // Throws an error if quotes are found
55  if (function_str.find("\"") != std::string::npos)
56  mooseError("The value in ParsedFunction contains quotes(\") which cannot be properly parsed");
57 
58  // Return the input equation (no error)
59  return function_str;
60 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182

Member Data Documentation

std::unique_ptr<MooseParsedFunctionWrapper> MooseParsedFunctionBase::_function_ptr
protected
FEProblemBase& MooseParsedFunctionBase::_pfb_feproblem
protected
const std::vector<std::string> MooseParsedFunctionBase::_vals
protected

Values passed by the user, they may be Reals for Postprocessors.

Definition at line 79 of file MooseParsedFunctionBase.h.

Referenced by MooseParsedVectorFunction::initialSetup(), MooseParsedGradFunction::initialSetup(), MooseParsedFunction::initialSetup(), and MooseParsedFunctionBase().

const std::vector<std::string> MooseParsedFunctionBase::_vars
protected

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