Flow123d  JS_before_hm-1621-g63a12c7
Public Member Functions | List of all members
FunctorBase< Type > Class Template Referenceabstract

Abstract templated explicit functor class. More...

#include <adaptivesimpson.hh>

Inheritance diagram for FunctorBase< Type >:
Inheritance graph
[legend]
Collaboration diagram for FunctorBase< Type >:
Collaboration graph
[legend]

Public Member Functions

 FunctorBase ()
 Constructor. More...
 
virtual ~FunctorBase ()
 Destructor. More...
 
virtual Type operator() (Type x)=0
 Virtual operator () with type Type. More...
 
- Public Member Functions inherited from FunctorCommon< Type >
 FunctorCommon ()
 Constructor. More...
 
virtual ~FunctorCommon ()
 Destructor. More...
 
void set_param (unsigned int param_name, double param_value)
 Sets a functor's parameter. More...
 
template<class TType >
void set_param_from_func (FunctorCommon< TType > *func)
 Sets a functor's parameters from another functor. More...
 
double param (unsigned int param_name)
 Returns parameter. More...
 

Additional Inherited Members

- Protected Attributes inherited from FunctorCommon< Type >
std::vector< double > param_
 

Detailed Description

template<class Type>
class FunctorBase< Type >

Abstract templated explicit functor class.

This class represents an explicit functor. Actual non-abstract functor is obtained by deriving from this class and overriding the operator(). Parameters can be set and used by the methods of ancestor class FunctorCommon.

The template is used to enable computing derivates by FADBAD++ library. The virtual operator() needs to operate both with type double and FADBAD++ types, such as B<double> and T<double>.

Simple usage example for function $ x^3p_1+\frac{p_2}{p_3} $ with three parameters:

template<class Type=double>
class Cubic : public FunctorBase<Type>
{
public:
typedef enum{ p1, p2, p3
} Parameters;
Cubic(double pp1, double pp2, double pp3)
{
this->set_param(p1, pp1);
this->set_param(p2, pp2);
this->set_param(p3, pp3);
}
Type operator()(Type x)
{
return x*x*x * this->param(p1) + this->param(p2)/this->param(p3);
}
};

Definition at line 21 of file adaptivesimpson.hh.

Constructor & Destructor Documentation

template<class Type >
FunctorBase< Type >::FunctorBase ( )

Constructor.

Definition at line 70 of file functors_impl.hh.

template<class Type >
FunctorBase< Type >::~FunctorBase ( )
virtual

Destructor.

Definition at line 73 of file functors_impl.hh.

Member Function Documentation

template<class Type>
virtual Type FunctorBase< Type >::operator() ( Type  x)
pure virtual

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