A Function defined by a std::string. More...
#include <parsed_function.h>
Public Member Functions | |
ParsedFunction (const std::string &expression, const std::vector< std::string > *additional_vars=nullptr, const std::vector< Output > *initial_vals=nullptr) | |
ParsedFunction & | operator= (const ParsedFunction &)=delete |
ParsedFunction (const ParsedFunction &)=default | |
ParsedFunction (ParsedFunction &&)=default | |
ParsedFunction & | operator= (ParsedFunction &&)=default |
virtual | ~ParsedFunction ()=default |
void | reparse (const std::string &expression) |
virtual Output | operator() (const Point &p, const Real time=0) override |
virtual bool | has_derivatives () |
virtual Output | dot (const Point &p, const Real time=0) |
virtual OutputGradient | gradient (const Point &p, const Real time=0) |
virtual void | operator() (const Point &p, const Real time, DenseVector< Output > &output) override |
virtual Output | component (unsigned int i, const Point &p, Real time) override |
const std::string & | expression () |
virtual Output & | getVarAddress (const std::string &variable_name) |
virtual std::unique_ptr< FunctionBase< Output > > | clone () const override |
Output | get_inline_value (const std::string &inline_var_name) const |
void | set_inline_value (const std::string &inline_var_name, Output newval) |
ParsedFunction (const std::string &, const std::vector< std::string > *=nullptr, const std::vector< Output > *=nullptr) | |
ParsedFunction (ParsedFunction &&)=delete | |
ParsedFunction (const ParsedFunction &)=delete | |
ParsedFunction & | operator= (const ParsedFunction &)=delete |
ParsedFunction & | operator= (ParsedFunction &&)=delete |
virtual | ~ParsedFunction ()=default |
virtual Output | operator() (const Point &, const Real=0) |
virtual void | operator() (const Point &, const Real, DenseVector< Output > &) |
virtual void | init () |
virtual void | clear () |
virtual Output & | getVarAddress (const std::string &) |
virtual std::unique_ptr< FunctionBase< Output > > | clone () const |
void | operator() (const Point &p, DenseVector< Output > &output) |
bool | initialized () const |
void | set_is_time_dependent (bool is_time_dependent) |
bool | is_time_dependent () const |
Protected Member Functions | |
void | partial_reparse (const std::string &expression) |
std::size_t | find_name (const std::string &varname, const std::string &expr) const |
bool | expression_is_time_dependent (const std::string &expression) const |
Protected Attributes | |
const FunctionBase * | _master |
bool | _initialized |
bool | _is_time_dependent |
Private Member Functions | |
void | set_spacetime (const Point &p, const Real time=0) |
Output | eval (FunctionParserADBase< Output > &parser, const std::string &libmesh_dbg_var(function_name), unsigned int libmesh_dbg_var(component_idx)) const |
Private Attributes | |
std::string | _expression |
std::vector< std::string > | _subexpressions |
std::vector< FunctionParserADBase< Output > > | parsers |
std::vector< Output > | _spacetime |
std::vector< FunctionParserADBase< Output > > | dx_parsers |
std::vector< FunctionParserADBase< Output > > | dy_parsers |
std::vector< FunctionParserADBase< Output > > | dz_parsers |
std::vector< FunctionParserADBase< Output > > | dt_parsers |
bool | _valid_derivatives |
std::string | variables |
std::vector< std::string > | _additional_vars |
std::vector< Output > | _initial_vals |
Output | _dummy |
A Function defined by a std::string.
A Function generated (via FParser) by parsing a mathematical expression. All overridden virtual functions are documented in function_base.h.
Definition at line 59 of file parsed_function.h.
|
inlineexplicit |
Definition at line 210 of file parsed_function.h.
|
default |
The remaining special functions can be defaulted for this class.
|
default |
|
virtualdefault |
|
inline |
Definition at line 717 of file parsed_function.h.
|
delete |
When !LIBMESH_HAVE_FPARSER, this class is not implemented, so let's make that explicit by deleting the special functions.
|
delete |
|
virtualdefault |
|
inlinevirtual |
Clears the function.
Reimplemented from libMesh::FunctionBase< Output >.
Definition at line 743 of file parsed_function.h.
Referenced by libMesh::ParsedFunction< T >::partial_reparse().
|
inlineoverridevirtual |
The new copy should be as "deep" as necessary to allow independent destruction and simultaneous evaluations of the copies in different threads.
Implements libMesh::FunctionBase< Output >.
Definition at line 357 of file parsed_function.h.
|
inlinevirtual |
The new copy should be as "deep" as necessary to allow independent destruction and simultaneous evaluations of the copies in different threads.
Implements libMesh::FunctionBase< Output >.
Definition at line 745 of file parsed_function.h.
|
inlineoverridevirtual |
i
at coordinate p
and time time
. Reimplemented from libMesh::FunctionBase< Output >.
Definition at line 322 of file parsed_function.h.
|
inlinevirtual |
Definition at line 270 of file parsed_function.h.
|
inlineprivate |
Evaluate the ith FunctionParser and check the result.
Definition at line 653 of file parsed_function.h.
|
inline |
Definition at line 120 of file parsed_function.h.
|
inlineprotected |
true
if the expression is time-dependent, false otherwise. Definition at line 617 of file parsed_function.h.
|
inlineprotected |
|
inline |
Definition at line 367 of file parsed_function.h.
Referenced by libMesh::ParsedFunctionParameter< T >::get().
|
inlinevirtual |
Definition at line 341 of file parsed_function.h.
|
inlinevirtual |
Definition at line 744 of file parsed_function.h.
|
inlinevirtual |
Definition at line 279 of file parsed_function.h.
|
inlinevirtual |
Query if the automatic derivative generation was successful.
Definition at line 104 of file parsed_function.h.
|
inlinevirtual |
The actual initialization process.
Reimplemented from libMesh::FunctionBase< Output >.
Definition at line 742 of file parsed_function.h.
|
inlineinherited |
true
when this object is properly initialized and ready for use, false
otherwise. Definition at line 206 of file function_base.h.
|
inlineinherited |
true
when the function this object represents is actually time-dependent, false
otherwise. Definition at line 220 of file function_base.h.
Referenced by libMesh::CompositeFunction< Output >::attach_subfunction().
|
inlineoverridevirtual |
p
and time time
, which defaults to zero.Pure virtual, so you have to override it.
Implements libMesh::FunctionBase< Output >.
Definition at line 261 of file parsed_function.h.
|
inlineoverridevirtual |
Evaluation function for time-dependent vector-valued functions. Sets output values in the passed-in output
DenseVector.
Pure virtual, so you have to override it.
Implements libMesh::FunctionBase< Output >.
Definition at line 299 of file parsed_function.h.
|
inlineinherited |
Evaluation function for time-independent vector-valued functions. Sets output values in the passed-in output
DenseVector.
Definition at line 241 of file function_base.h.
|
inlinevirtual |
p
and time time
, which defaults to zero.Pure virtual, so you have to override it.
Implements libMesh::FunctionBase< Output >.
Definition at line 734 of file parsed_function.h.
|
inlinevirtual |
Evaluation function for time-dependent vector-valued functions. Sets output values in the passed-in output
DenseVector.
Pure virtual, so you have to override it.
Implements libMesh::FunctionBase< Output >.
Definition at line 738 of file parsed_function.h.
|
delete |
This class cannot be (default) copy assigned because the underlying FunctionParserADBase class does not define a custom copy assignment operator, and manually manages memory.
|
default |
|
delete |
|
delete |
|
inlineprotected |
Re-parse with minor changes to expression.
Definition at line 505 of file parsed_function.h.
|
inline |
Re-parse with new expression.
Definition at line 230 of file parsed_function.h.
|
inline |
Changes the value of an inline variable.
Definition at line 441 of file parsed_function.h.
Referenced by libMesh::ParsedFunctionParameter< T >::set().
|
inlineinherited |
Function to set whether this is a time-dependent function or not. This is intended to be only used by subclasses who cannot natively determine time-dependence. In such a case, this function should be used immediately following construction.
Definition at line 213 of file function_base.h.
|
inlineprivate |
Set the _spacetime argument vector.
Definition at line 633 of file parsed_function.h.
|
private |
Definition at line 201 of file parsed_function.h.
|
private |
Definition at line 750 of file parsed_function.h.
Referenced by libMesh::ParsedFunction< T >::getVarAddress().
|
private |
Definition at line 183 of file parsed_function.h.
Referenced by libMesh::ParsedFunction< T >::expression().
|
private |
Definition at line 202 of file parsed_function.h.
|
protectedinherited |
When init()
was called so that everything is ready for calls to operator()
(...), then this bool
is true.
Definition at line 180 of file function_base.h.
Referenced by libMesh::AnalyticFunction< Output >::AnalyticFunction(), libMesh::ConstFunction< Output >::ConstFunction(), and libMesh::WrappedFunction< Output >::WrappedFunction().
|
protectedinherited |
Cache whether or not this function is actually time-dependent.
Definition at line 185 of file function_base.h.
Referenced by libMesh::CompositeFunction< Output >::attach_subfunction(), and libMesh::ConstFunction< Output >::ConstFunction().
|
protectedinherited |
Const pointer to our master, initialized to nullptr
. There may be cases where multiple functions are required, but to save memory, one master handles some centralized data.
Definition at line 174 of file function_base.h.
|
private |
Definition at line 186 of file parsed_function.h.
|
private |
Definition at line 184 of file parsed_function.h.
|
private |
Definition at line 197 of file parsed_function.h.
Referenced by libMesh::ParsedFunction< T >::has_derivatives().
|
private |
Definition at line 196 of file parsed_function.h.
|
private |
Definition at line 189 of file parsed_function.h.
|
private |
Definition at line 191 of file parsed_function.h.
|
private |
Definition at line 194 of file parsed_function.h.
|
private |
Definition at line 185 of file parsed_function.h.
|
private |
Definition at line 200 of file parsed_function.h.