PARTONS/NumA++  
Numerical Analysis C++ routines
Public Member Functions | List of all members
NumA::FunctionTypeMD Class Referenceabstract

Class for defining multi-dimensional functions that can be used as arguments in virtual methods. More...

Inheritance diagram for NumA::FunctionTypeMD:
NumA::FunctorMD< PointerToObj, PointerToFunc >

Public Member Functions

 FunctionTypeMD ()
 Empty constructor. More...
 
virtual ~FunctionTypeMD ()
 Default destructor. More...
 
virtual double operator() (VectorD &variables, std::vector< double > &parameters)=0
 Operator allowing the functor to be used as a function. More...
 
virtual double operator() (VectorD &variables)=0
 Operator allowing the functor to be used as a function. More...
 

Detailed Description

Class for defining multi-dimensional functions that can be used as arguments in virtual methods.

This is needed to circumvent the issue that templates and virtual methods are incompatible.

Usage:

&MyClass::myFunction);
Class for defining multi-dimensional functions that can be used as arguments in virtual methods.
Definition: FunctionTypeMD.h:50
static FunctorMD< PointerToObj, PointerToMemFn > * newFunctorMD(PointerToObj *object, PointerToMemFn function)
Defines a new functor with the given multi-dimensional function.
Definition: FunctorUtils.h:52

where myFunction is some function defined in some class MyClass with the following signature:

double MyClass::myFunction(NumA::VectorD& variables, std::vector<double>& parameters);
Object representing a mathematical vector.
Definition: VectorD.h:33

The pointer this needs to be replaced by a pointer to the object instantiating MyClass, if the first line is not written inside MyClass.

Now, you can pass myFunctor as argument to any method (e.g. integration routines), even virtual ones:

virtual SomeReturnType someVirtualMethod(..., NumA::FunctionTypeMD* functor, ...);

and use the functor as a function (with the operator()) inside this method:

functor(variables, parameters); // parameters is optional.

See also FunctorUtils documentation.

For one dimensional functions, see FunctionType1D.

Constructor & Destructor Documentation

◆ FunctionTypeMD()

NumA::FunctionTypeMD::FunctionTypeMD ( )
inline

Empty constructor.

◆ ~FunctionTypeMD()

virtual NumA::FunctionTypeMD::~FunctionTypeMD ( )
inlinevirtual

Default destructor.

Member Function Documentation

◆ operator()() [1/2]

virtual double NumA::FunctionTypeMD::operator() ( VectorD variables)
pure virtual

Operator allowing the functor to be used as a function.

Parameters
variablesMulti-variate argument of the function represented by the functor.
Returns
double

Implemented in NumA::FunctorMD< PointerToObj, PointerToFunc >.

◆ operator()() [2/2]

virtual double NumA::FunctionTypeMD::operator() ( VectorD variables,
std::vector< double > &  parameters 
)
pure virtual

Operator allowing the functor to be used as a function.

Parameters
variablesMulti-variate argument of the function represented by the functor.
parametersParameters that can be passed to the function.
Returns
double

Implemented in NumA::FunctorMD< PointerToObj, PointerToFunc >.


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