PARTONS/NumA++
|
Numerical Analysis C++ routines
|
Class for defining multi-dimensional functions that can be used as arguments in virtual methods. More...
Public Member Functions | |
FunctionTypeMD () | |
Empty constructor. More... | |
virtual | ~FunctionTypeMD () |
Default destructor. More... | |
virtual double | operator() (VectorD &variables, std::vector< double > ¶meters)=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... | |
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:
where myFunction
is some function defined in some class MyClass
with the following signature:
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:
and use the functor as a function (with the operator()
) inside this method:
See also FunctorUtils documentation.
For one dimensional functions, see FunctionType1D.
|
inline |
Empty constructor.
|
inlinevirtual |
Default destructor.
|
pure virtual |
Operator allowing the functor to be used as a function.
variables | Multi-variate argument of the function represented by the functor. |
Implemented in NumA::FunctorMD< PointerToObj, PointerToFunc >.
|
pure virtual |
Operator allowing the functor to be used as a function.
variables | Multi-variate argument of the function represented by the functor. |
parameters | Parameters that can be passed to the function. |
Implemented in NumA::FunctorMD< PointerToObj, PointerToFunc >.