IFEM  90A354
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Private Attributes | List of all members
EvalFuncScalar< Scalar > Class Template Reference

A scalar-valued function, general expression. More...

#include <ExprFunctions.h>

Inheritance diagram for EvalFuncScalar< Scalar >:
Inheritance graph
[legend]
Collaboration diagram for EvalFuncScalar< Scalar >:
Collaboration graph
[legend]

Public Member Functions

 EvalFuncScalar (const char *function, const char *x="x", Real eps=Real(1.0e-8))
 The constructor parses the expression string.
 
virtual ~EvalFuncScalar ()
 Defaulted destructor. More...
 
void addDerivative (const std::string &function, const char *x="x")
 Adds an expression function for a first derivative.
 
bool isConstant () const override
 Returns whether the function is time-independent or not.
 
Real deriv (Real x) const override
 Returns the first-derivative of the function.
 
int numError
 Explicit instantiation.
 
Real deriv (Real x) const
 Returns the first-derivative of the function.
 
- Public Member Functions inherited from ScalarFunc
Real eval (Real x) const
 Returns the function value for the argument x.
 
- Public Member Functions inherited from utl::Function< Real, Real >
virtual ~Function ()
 Empty destructor.
 
virtual bool isZero () const
 Returns whether the function is identically zero or not.
 
Real operator() (const Real &x) const
 Operator returning the function value for the given argument.
 

Static Public Attributes

static int numError
 Error counter - set by the exception handler. More...
 

Protected Member Functions

Real evaluate (const Real &x) const override
 Evaluates the function expression.
 
- Protected Member Functions inherited from ScalarFunc
 ScalarFunc ()
 The constructor is protected to allow sub-class instances only.
 
- Protected Member Functions inherited from utl::Function< Real, Real >
 Function ()
 The constructor is protected to allow sub-class instances only.
 

Private Types

using Expression = ExprEval::Expression< Scalar >
 Type alias for expression tree.
 
using FunctionList = ExprEval::FunctionList< Scalar >
 Type alias for function list.
 
using ValueList = ExprEval::ValueList< Scalar >
 Type alias for value list.
 
using FuncType = EvalFuncScalar< Scalar >
 Type alias for function.
 

Private Attributes

std::vector< std::unique_ptr< Expression > > expr
 Roots of the expression tree.
 
std::vector< std::unique_ptr< FunctionList > > f
 Lists of functions.
 
std::vector< std::unique_ptr< ValueList > > v
 Lists of variables and constants.
 
std::vector< Scalar * > arg
 Function argument values.
 
std::unique_ptr< FuncTypegradient
 First derivative expression.
 
Real dx
 Domain increment for calculation of numerical derivative.
 

Additional Inherited Members

- Public Types inherited from utl::Function< Real, Real >
typedef Real Input
 Input type.
 
typedef Real Output
 Output type.
 

Detailed Description

template<class Scalar>
class EvalFuncScalar< Scalar >

A scalar-valued function, general expression.

Constructor & Destructor Documentation

◆ ~EvalFuncScalar()

template<class Scalar >
EvalFuncScalar< Scalar >::~EvalFuncScalar ( )
virtualdefault

Defaulted destructor.

The implementation needs to be in compile unit so we have the definition for the types of the unique_ptr's.

Member Data Documentation

◆ numError

int EvalFunc::numError
static

Error counter - set by the exception handler.

Explicit instantiation of error flag.

Referenced by utl::parseRealFunc(), and utl::parseVecFunc().


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