Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:51:48

0001 #ifndef MATH_INTEGRATOR_MODULE_H
0002 #define MATH_INTEGRATOR_MODULE_H
0003 
0004 /**
0005  * @file MathIntegratorModule.h
0006  * @author Bryan BERTHOU (SPhN / CEA Saclay)
0007  * @date 29 July 2014
0008  * @version 1.0
0009  */
0010 
0011 #include <NumA/integration/one_dimension/IntegratorType1D.h>
0012 #include <string>
0013 #include <vector>
0014 
0015 namespace ElemUtils {
0016 class Parameters;
0017 } /* namespace ElemUtils */
0018 namespace NumA {
0019 class FunctionType1D;
0020 class Integrator1D;
0021 } /* namespace NumA */
0022 
0023 namespace PARTONS {
0024 
0025 /**
0026  * @class MathIntegratorModule
0027  *
0028  * @brief Wrapper for integration routines. Can be inherited by a module that uses integration.
0029  */
0030 class MathIntegratorModule {
0031 public:
0032     static const std::string PARAM_NAME_INTEGRATOR_TYPE; ///< Parameter used in configureIntegrator() or XML automation to set the type of integrator.
0033 
0034     /**
0035      * Default constructor.
0036      */
0037     MathIntegratorModule();
0038     /**
0039      * Default destructor.
0040      */
0041     virtual ~MathIntegratorModule();
0042 
0043 protected:
0044     /**
0045      * Copy constructor.
0046      *
0047      * @param other
0048      */
0049     MathIntegratorModule(const MathIntegratorModule &other);
0050 
0051     /**
0052      * Sets a given integrator available in NumA++.
0053      * @param integratorType
0054      */
0055     void setIntegrator(NumA::IntegratorType1D::Type integratorType);
0056 
0057     /**
0058      * Computes the integral of a function defined via a functor.
0059      * @param pFunction Functor.
0060      * @param a Lower bound.
0061      * @param b Upper bound.
0062      * @param parameters List of parameters needed by the function.
0063      * @return Integral.
0064      */
0065     double integrate(NumA::FunctionType1D* pFunction, double a, double b,
0066             std::vector<double> &parameters);
0067 
0068     /**
0069      * Provides a generic method to configure all types of integration routines by passing a Parameters object.
0070      * Parameters class represents a list of couples key/value (see Parameters class documentation for more info).
0071      * Can also be used to set the integrator via the key PARAM_NAME_INTEGRATOR_TYPE.
0072      * @param parameters
0073      */
0074     void configureIntegrator(const ElemUtils::Parameters &parameters);
0075 
0076     /**
0077      *
0078      * @return Integration routine. Pointer to NumA::Integrator1D object.
0079      */
0080     NumA::Integrator1D* getMathIntegrator();
0081 
0082 private:
0083     NumA::Integrator1D* m_mathIntegrator; ///< Integration routine. Pointer to NumA::Integrator1D object.
0084 };
0085 
0086 } /* namespace PARTONS */
0087 
0088 #endif /* MATH_INTEGRATOR_MODULE_H */