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

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

#include <ExprFunctions.h>

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

Classes

struct  Arg
 A struct representing a spatial function argument. More...
 

Public Member Functions

 EvalFuncSpatial (const char *function, Real epsX=Real(1.0e-8), Real epsT=Real(1.0e-12))
 The constructor parses the expression string.
 
virtual ~EvalFuncSpatial ()
 Defaulted destructor. More...
 
void addDerivative (const std::string &function, const std::string &variables, int d1, int d2=0)
 Adds an expression function for a first or second derivative.
 
bool isConstant () const override
 Returns whether the function is time-independent or not.
 
Real deriv (const Vec3 &X, int dir) const override
 Returns first-derivative of the function.
 
Real dderiv (const Vec3 &X, int dir1, int dir2) const override
 Returns second-derivative of the function.
 
void setParam (const std::string &name, Real value) override
 Sets an additional parameter in the function.
 
Vec3 gradient (const Vec3 &X) const override
 Evaluates first derivatives of the function.
 
SymmTensor hessian (const Vec3 &X) const override
 Evaluates first derivatives of the function.
 
Real deriv (const Vec3 &X, int dir) const
 Returns a first-derivative of the function.
 
Real deriv (const Vec3 &X, int dir) const
 Returns a first-derivative of the function.
 
Real dderiv (const Vec3 &X, int d1, int d2) const
 Returns a second-derivative of the function.
 
Real dderiv (const Vec3 &X, int d1, int d2) const
 Returns a second-derivative of the function.
 
Vec3 gradient (const Vec3 &X) const
 Evaluates first derivatives of the function.
 
SymmTensor hessian (const Vec3 &X) const
 Evaluates second derivatives of the function.
 
- Public Member Functions inherited from RealFunc
unsigned char getType () const override
 Returns the function type flag.
 
std::vector< RealgetValue (const Vec3 &X) const override
 Returns the function value as an array.
 
Real getScalarValue (const Vec3 &X) const override
 Returns a representative scalar equivalent of the function value.
 
Real timeDerivative (const Vec3 &X) const
 Returns the time derivative of the function.
 
- Public Member Functions inherited from utl::Function< Arg, Result >
virtual ~Function ()
 Empty destructor.
 
virtual bool isZero () const
 Returns whether the function is identically zero or not.
 
Result operator() (const Arg &x) const
 Operator returning the function value for the given argument.
 
- Public Member Functions inherited from FunctionBase
virtual ~FunctionBase ()
 Empty destructor.
 
size_t dim () const
 Returns the number of components of the return value.
 
virtual bool initPatch (size_t)
 Sets the active patch.
 
virtual bool inDomain (const Vec3 &) const
 Checks if a specified point is within the function domain.
 
void setParam (const std::string &name, const Vec3 &value)
 Sets additional parameter values in the function.
 

Protected Member Functions

Real evaluate (const Vec3 &X) const override
 Evaluates the function expression.
 
- Protected Member Functions inherited from RealFunc
 RealFunc ()
 The constructor is protected to allow sub-class instances only.
 
- Protected Member Functions inherited from utl::SpatialFunction< Real >
 SpatialFunction (const Real &val)
 The constructor is protected to allow sub-class instances only.
 
virtual std::vector< RealevalGradient (const Vec3 &) const
 Returns the gradient of the function as a 1D array.
 
virtual std::vector< RealevalHessian (const Vec3 &) const
 Returns the hessian of the function as a 1D array.
 
virtual std::vector< RealevalTimeDerivative (const Vec3 &) const
 Returns the time derivatives of the function as a 1D array.
 
- Protected Member Functions inherited from utl::Function< Arg, Result >
 Function ()
 The constructor is protected to allow sub-class instances only.
 
virtual Result evaluate (const Arg &x) const =0
 Evaluates the function for the argument x.
 
- Protected Member Functions inherited from FunctionBase
 FunctionBase ()
 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 = EvalFuncSpatial< 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< Argarg
 Function argument values.
 
std::array< std::unique_ptr< FuncType >, 4 > derivative1
 First order derivative expressions.
 
std::array< std::unique_ptr< FuncType >, 6 > derivative2
 Second order derivative expressions.
 
bool IAmConstant
 Indicates whether the time coordinate is given or not.
 
Real dx
 Domain increment for calculation of numerical derivative.
 
Real dt
 Domain increment for calculation of numerical time-derivative.
 

Additional Inherited Members

- Public Types inherited from utl::Function< Arg, Result >
typedef Arg Input
 Input type.
 
typedef Result Output
 Output type.
 
- Protected Attributes inherited from utl::SpatialFunction< Real >
Real zero
 Return value for default implementations of derivatives.
 
- Protected Attributes inherited from FunctionBase
size_t ncmp
 Number of components in the return value.
 

Detailed Description

template<class Scalar>
class EvalFuncSpatial< Scalar >

A scalar-valued spatial function, general function expression.

Constructor & Destructor Documentation

◆ ~EvalFuncSpatial()

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

Defaulted destructor.

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


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