Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:17:15

0001 //
0002 // APFEL++ 2017
0003 //
0004 // Author: Valerio Bertone: valerio.bertone@cern.ch
0005 //
0006 
0007 #pragma once
0008 
0009 #include <vector>
0010 #include <iostream>
0011 
0012 namespace apfel
0013 {
0014   /**
0015    * @brief Class for the x-space interpolation SubGrids.
0016    *
0017    * Subgrids are the building blocks of the interpolation procedure.
0018    * This class defines the "SubGrid" object that includes, apart from the
0019    * grid itself, also the relevant parameters.
0020    *
0021    */
0022   class SubGrid
0023   {
0024   public:
0025     /**
0026      * @brief The SubGrid constructor.
0027      * @param nx number of grid points in x.
0028      * @param xMin lower edge x of the grid.
0029      * @param InterDegree interpolation degree.
0030      */
0031     SubGrid(int const& nx, double const& xMin, int const& InterDegree);
0032 
0033     /**
0034      * @brief The SubGrid constructor.
0035      * @param xsg a std::vector with the nodes of the grid
0036      * @param InterDegree interpolation degree
0037      */
0038     SubGrid(std::vector<double> const& xsg, int const& InterDegree);
0039 
0040     /**
0041      * @brief Check whether SubGrids are equal
0042      * @param sg the SubGrid to be compared
0043      * @return true/false
0044      */
0045     bool operator == (SubGrid const& sg) const;
0046     bool operator != (SubGrid const& sg) const;
0047 
0048     // Getters
0049     int                        nx()          const { return _nx; }                      //!< return the number of x points
0050     int                        InterDegree() const { return _InterDegree; }             //!< return the interpolation degree
0051     double                     xMin()        const { return _xMin; }                    //!< return the minimum node value
0052     double                     xMax()        const { return _xMax; }                    //!< return the maximum node value
0053     double                     Step()        const { return _Step; }                    //!< return the step size of the log grid
0054     std::vector<double> const& GetGrid()     const { return _xsg; }                     //!< return the grid
0055     std::vector<double> const& GetLogGrid()  const { return _lxsg; }                    //!< return the log-grid
0056     void                       Print()       const { std::cout << *this << std::endl; } //!< print the SubGrid object
0057 
0058   private:
0059     int                 _nx;           //!< Number intervals
0060     int                 _InterDegree;  //!< Interpolation degree
0061     double              _xMin;         //!< Minumim value of x
0062     double              _xMax;         //!< Maximum value of x (should always be 1)
0063     double              _Step;         //!< Step of the logarthmically spaced grid
0064     std::vector<double> _xsg;          //!< Actual grid
0065     std::vector<double> _lxsg;         //!< The log of the grid
0066 
0067     friend std::ostream& operator << (std::ostream& os, SubGrid const& sg);
0068   };
0069 
0070   /**
0071    * @brief Method which prints SubGrid with cout <<.
0072    */
0073   std::ostream& operator << (std::ostream& os, SubGrid const& sg);
0074 }