Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef QUADRATURE_INTEGRATOR_1D_H_
0002 #define QUADRATURE_INTEGRATOR_1D_H_
0003 
0004 /**
0005  * @file QuadratureIntegrator1D.h
0006  * @author Bryan BERTHOU (SPhN / CEA Saclay)
0007  * @date 15 February 2016
0008  * @version 1.0
0009  */
0010 
0011 #include <string>
0012 #include <vector>
0013 
0014 #include "Integrator1D.h"
0015 
0016 class FunctionType1D;
0017 
0018 namespace NumA {
0019 
0020 /**
0021  * @class QuadratureIntegrator1D
0022  *
0023  * @brief Abstract quadrature class (for fixed quadrature rules).
0024  *
0025  * Child classes must define a way to compute the nodes \f$ x_i \f$ and weights \f$ w_i \f$.\n
0026  * The integration itself is done by this abstract class:
0027  * \f$ \displaystyle \int_a^b f\left(x\right) \mathrm{d}x = \sum_{i=0}^{N-1} w_i f\left(x_i\right) \f$, through the integrate() routine.
0028  *
0029  * See Integrator1D documentation for an example.
0030  */
0031 
0032 class QuadratureIntegrator1D: public Integrator1D {
0033 public:
0034     static const std::string PARAM_NAME_N; ///< Parameter used in the configure() to set the order of the quadrature.
0035 
0036     /**
0037      * Constructor.
0038      * @param N Order of the quadrature (number of nodes).
0039      */
0040     QuadratureIntegrator1D(unsigned int N = 0);
0041     /**
0042      * Default destructor.
0043      */
0044     virtual ~QuadratureIntegrator1D();
0045 
0046     virtual QuadratureIntegrator1D* clone() const = 0;
0047 
0048     virtual double integrate(FunctionType1D* pFunction, double a, double b,
0049             std::vector<double> &parameters);
0050 
0051     virtual void configure(const ElemUtils::Parameters &parameters);
0052 
0053     /**
0054      *
0055      * @return Order of the quadrature (number of nodes).
0056      */
0057     unsigned int getN() const;
0058     /**
0059      *
0060      * @param n Order of the quadrature (number of nodes).
0061      */
0062     virtual void setN(unsigned int n) = 0;
0063     /**
0064      *
0065      * @return Nodes of the quadrature.
0066      */
0067     const std::vector<double>& getNodes() const;
0068     /**
0069      *
0070      * @return Weights of the quadrature.
0071      */
0072     const std::vector<double>& getWeights() const;
0073 
0074 protected:
0075     unsigned int m_N; ///< Order of the quadrature (number of nodes).
0076     std::vector<double> m_nodes; ///< Nodes of the quadrature.
0077     std::vector<double> m_weights; ///< Weights of the quadrature.
0078 
0079     /**
0080      * Copy constructor.
0081      * Called by clone().
0082      * @param other QuadratureIntegrator1D object to copy.
0083      */
0084     QuadratureIntegrator1D(const QuadratureIntegrator1D &other);
0085 };
0086 
0087 } // namespace NumA
0088 
0089 #endif /* QUADRATURE_INTEGRATOR_1D_H_ */