PARTONS/NumA++  
Numerical Analysis C++ routines
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
NumA::Integrator1D Class Referenceabstract

Abstract class for all integration routines. More...

Inheritance diagram for NumA::Integrator1D:
NumA::DExpIntegrator1D NumA::GaussKronrodAdaptive NumA::QuadratureIntegrator1D NumA::ChebyshevAIntegrator1D NumA::ChebyshevBIntegrator1D NumA::GaussLegendreIntegrator1D NumA::GaussLegendreSeStIntegrator1D NumA::TrapezoidalIntegrator1D NumA::TrapezoidalLogIntegrator1D

Public Member Functions

 Integrator1D ()
 Default constructor. More...
 
virtual ~Integrator1D ()
 Default destructor. More...
 
virtual Integrator1Dclone () const =0
 
virtual double integrate (FunctionType1D *pFunction, double a, double b, std::vector< double > &parameters)=0
 Integration routine. More...
 
virtual void configure (const ElemUtils::Parameters &parameters)
 Provides a generic method to configure all types of integrations by passing a Parameters object. More...
 
const TolerancesgetTolerances () const
 
void setTolerances (const Tolerances &tolerances)
 
const ErrorsgetErrors () const
 
void setErrors (const Errors &errors)
 

Static Public Member Functions

template<typename PointerToObj , typename PointerToMemFn >
static Functor1D< PointerToObj, PointerToMemFn > * newIntegrationFunctor (PointerToObj *object, PointerToMemFn function)
 Use FunctorUtils::newFunctor1D instead. More...
 
static Integrator1DnewIntegrator (const IntegratorType1D::Type &oneDimIntegratorType)
 Instantiates an Integrator object. More...
 

Static Public Attributes

static const std::string PARAM_NAME_ABSOLUTE_TOLERANCE
 Parameter used in the configure() to set the absolute tolerance. More...
 
static const std::string PARAM_NAME_RELATIVE_TOLERANCE
 Parameter used in the configure() to set the relative tolerance. More...
 

Protected Member Functions

 Integrator1D (const Integrator1D &other)
 Copy constructor. More...
 

Protected Attributes

Tolerances m_tolerances
 Absolute and relative tolerances. More...
 
Errors m_errors
 Absolute and relative errors estimations. More...
 

Detailed Description

Abstract class for all integration routines.

Example:

NumA::Integrator1D* integrator = NumA::Integrator1D::newIntegrator(NumA::IntegratorType1D::GaussLegendre); // Using Gauss-Legendre quadrature.
NumA::FunctionType1D* functor = NumA::FunctorUtils::newFunctor1D(pointerMyClass, &MyClass::myFunction); // See FunctionType1D documentation.
double integral = integrator.integrate(functor, -1., 1.); // We integrate a function on [-1,1].
Class for defining one-dimensional functions that can be used as arguments in virtual methods.
Definition: FunctionType1D.h:50
static Functor1D< PointerToObj, PointerToMemFn > * newFunctor1D(PointerToObj *object, PointerToMemFn function)
Defines a new functor with the given one-dimensional function.
Definition: FunctorUtils.h:35
Abstract class for all integration routines.
Definition: Integrator1D.h:38
static Integrator1D * newIntegrator(const IntegratorType1D::Type &oneDimIntegratorType)
Instantiates an Integrator object.
Definition: Integrator1D.cpp:35
virtual double integrate(FunctionType1D *pFunction, double a, double b, std::vector< double > &parameters)=0
Integration routine.

Constructor & Destructor Documentation

◆ Integrator1D() [1/2]

NumA::Integrator1D::Integrator1D ( )

Default constructor.

◆ ~Integrator1D()

NumA::Integrator1D::~Integrator1D ( )
virtual

Default destructor.

◆ Integrator1D() [2/2]

NumA::Integrator1D::Integrator1D ( const Integrator1D other)
protected

Copy constructor.

Called by clone().

Parameters
otherIntegrator1D object to copy.

Member Function Documentation

◆ clone()

virtual Integrator1D* NumA::Integrator1D::clone ( ) const
pure virtual

◆ configure()

void NumA::Integrator1D::configure ( const ElemUtils::Parameters &  parameters)
virtual

Provides a generic method to configure all types of integrations by passing a Parameters object.

Parameters class represents a list of couples key/value (see Parameters class documentation for more info).

Parameters
parametersElemUtils::Parameters object.

Reimplemented in NumA::TrapezoidalLogIntegrator1D, and NumA::QuadratureIntegrator1D.

◆ getErrors()

const Errors & NumA::Integrator1D::getErrors ( ) const
Returns
Absolute and relative errors estimations.

◆ getTolerances()

const Tolerances & NumA::Integrator1D::getTolerances ( ) const
Returns
Absolute and relative tolerances.

◆ integrate()

virtual double NumA::Integrator1D::integrate ( FunctionType1D pFunction,
double  a,
double  b,
std::vector< double > &  parameters 
)
pure virtual

Integration routine.

Parameters
pFunctionFunctor representing the one-dimensional function to integrate.
aLower bound.
bUpper bound.
parametersParameters that can be passed to the function.
Returns
Integral.

Implemented in NumA::TrapezoidalLogIntegrator1D, NumA::QuadratureIntegrator1D, NumA::GaussKronrodAdaptive, and NumA::DExpIntegrator1D.

◆ newIntegrationFunctor()

template<typename PointerToObj , typename PointerToMemFn >
static Functor1D<PointerToObj, PointerToMemFn>* NumA::Integrator1D::newIntegrationFunctor ( PointerToObj *  object,
PointerToMemFn  function 
)
inlinestatic

Use FunctorUtils::newFunctor1D instead.

TODO: Remove this method.

◆ newIntegrator()

Integrator1D * NumA::Integrator1D::newIntegrator ( const IntegratorType1D::Type oneDimIntegratorType)
static

Instantiates an Integrator object.

Will be replaced by a Factory/Registry system in the future.

Parameters
oneDimIntegratorTypeType of integrator.
Returns
Integrator1D pointer.

◆ setErrors()

void NumA::Integrator1D::setErrors ( const Errors errors)
Parameters
errorsAbsolute and relative errors estimations.

◆ setTolerances()

void NumA::Integrator1D::setTolerances ( const Tolerances tolerances)
Parameters
tolerancesAbsolute and relative tolerances.

Member Data Documentation

◆ m_errors

Errors NumA::Integrator1D::m_errors
protected

Absolute and relative errors estimations.

◆ m_tolerances

Tolerances NumA::Integrator1D::m_tolerances
protected

Absolute and relative tolerances.

◆ PARAM_NAME_ABSOLUTE_TOLERANCE

const std::string NumA::Integrator1D::PARAM_NAME_ABSOLUTE_TOLERANCE
static
Initial value:
=
"absoluteTolerance"

Parameter used in the configure() to set the absolute tolerance.

◆ PARAM_NAME_RELATIVE_TOLERANCE

const std::string NumA::Integrator1D::PARAM_NAME_RELATIVE_TOLERANCE
static
Initial value:
=
"relativeTolerance"

Parameter used in the configure() to set the relative tolerance.


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