Gaudi Framework, version v20r2

Generated: 18 Jul 2008

NumericalIndefiniteIntegral.h

Go to the documentation of this file.
00001 // $Id: NumericalIndefiniteIntegral.h,v 1.1 2003/11/19 17:09:40 mato Exp $
00002 // ============================================================================
00003 #ifndef GAUDIMATH_NUMERICALINDEFINITEINTEGRAL_H 
00004 #define GAUDIMATH_NUMERICALINDEFINITEINTEGRAL_H 1
00005 // ============================================================================
00006 // Include files
00007 // ============================================================================
00008 // STD & STL
00009 // ============================================================================
00010 #include <string>
00011 // ============================================================================
00012 // GaudiKernel
00013 // ============================================================================
00014 #include "GaudiKernel/StatusCode.h"
00015 // ============================================================================
00016 // GaudiMath
00017 // ============================================================================
00018 #include "GaudiMath/Integration.h"
00019 // ============================================================================
00020 // CLHEP
00021 // ============================================================================
00022 #include "CLHEP/GenericFunctions/AbsFunction.hh"
00023 // ============================================================================
00024 
00025 
00027 
00028 namespace Genfun
00029 {
00030   namespace GaudiMathImplementation
00031   { 
00076     class NumericalIndefiniteIntegral : public AbsFunction
00077     {
00078     public:
00079       struct _Workspace ;
00080       struct _Function  ;
00081     public:
00082       
00084       typedef std::vector<double>   Points ;
00085       
00086     public:
00087       
00089       FUNCTION_OBJECT_DEF( NumericalIndefiniteIntegral ) ;
00090       
00091     public:
00092       
00156       NumericalIndefiniteIntegral
00157       ( const AbsFunction&                         function                   ,
00158         const size_t                               index                      , 
00159         const double                               a                          , 
00160         const GaudiMath::Integration::Limit        limit  = 
00161         GaudiMath::Integration::VariableHighLimit , 
00162         const GaudiMath::Integration::Type         type   = 
00163         GaudiMath::Integration::Adaptive          , 
00164         const GaudiMath::Integration::KronrodRule  rule   = 
00165         GaudiMath::Integration::Default           , 
00166         const double                               epsabs = 1e-10             , 
00167         const double                               epsrel = 1.e-7             , 
00168         const size_t                               size   = 1000              );
00169       
00211       NumericalIndefiniteIntegral 
00212       ( const AbsFunction&                  function                      ,
00213         const size_t                        index                         , 
00214         const double                        a                             , 
00215         const Points&                       points                        ,
00216         const GaudiMath::Integration::Limit limit     = 
00217         GaudiMath::Integration::VariableHighLimit , 
00218         const double                        epsabs    = 1e-9              , 
00219         const double                        epsrel    = 1.e-6             ,
00220         const size_t                        size      = 1000              ) ;
00221       
00259       NumericalIndefiniteIntegral 
00260       ( const AbsFunction&                  function                      ,
00261         const size_t                        index                         , 
00262         const GaudiMath::Integration::Limit limit     = 
00263         GaudiMath::Integration::VariableHighLimit ,
00264         const double                        epsabs    = 1e-9              , 
00265         const double                        epsrel    = 1.e-6             , 
00266         const size_t                        size      = 1000              ) ;
00267       
00269       NumericalIndefiniteIntegral 
00270       ( const NumericalIndefiniteIntegral& ) ;
00271       
00273       virtual ~NumericalIndefiniteIntegral() ;
00274 
00275     public:
00276       
00278       virtual unsigned int dimensionality() const { return m_DIM ; }
00279       
00281       virtual double operator() ( double          argument ) const ;   
00283       virtual double operator() ( const Argument& argument ) const ; 
00284       
00286       virtual bool hasAnalyticDerivative() const { return true ;}
00287       
00289       virtual Genfun::Derivative partial ( unsigned int index ) const;
00290      
00291     public:
00292       
00294       const AbsFunction& function () const { return *m_function ; }
00296       double             a        () const { return         m_a ; }
00298       const Points&      points   () const { return    m_points ; }
00300       double             epsabs   () const { return    m_epsabs ; }
00302       double             epsrel   () const { return    m_epsrel ; }
00303       
00305       double             result   () const { return    m_result ; }
00307       double             error    () const { return     m_error ; }
00308       
00309       // maximal number of bisection integvals for adaptive algorithms 
00310       const size_t       size     () const { return      m_size ; }
00311       
00313       GaudiMath::Integration::Limit              
00314       limit    () const { return     m_limit ; }
00316       GaudiMath::Integration::Type               
00317       type     () const { return      m_type ; }
00319       GaudiMath::Integration::Category 
00320       category () const { return  m_category ; }
00322       GaudiMath::Integration::KronrodRule        
00323       rule     () const { return      m_rule ; }
00324       
00325     protected:
00326       
00327       // adaptive integration on infinite intervals 
00328       double                     QAGI ( _Function* fun ) const ;
00329       // adaptive integration  with known singular points 
00330       double                     QAGP ( _Function* fun ) const ;
00331       // non-adaptive integration
00332       double                     QNG  ( _Function* fun ) const ;
00333       // adaptive integration
00334       double                     QAG  ( _Function* fun ) const ;
00335       // adaptive integral with singularities 
00336       double                     QAGS ( _Function* fun ) const ;
00337       
00338       // allocate the integration workspace 
00339       _Workspace*                allocate                () const ;
00340       // the integration workspace 
00341       _Workspace*                ws                      () const 
00342       { return m_ws ; };
00343       
00344       // throw the exception
00345       StatusCode Exception 
00346       ( const std::string& message , 
00347         const StatusCode&  sc = StatusCode::FAILURE ) const ;
00348       
00349    private:
00350       
00351       // default constructor is disabled 
00352       NumericalIndefiniteIntegral() ;     
00353       // assignement operator is disabled 
00354       NumericalIndefiniteIntegral& operator=
00355       ( const NumericalIndefiniteIntegral& ) ;
00356       
00357     private:
00358       
00359       const AbsFunction*                  m_function ;
00360       size_t                              m_DIM      ;
00361       size_t                              m_index    ;
00362       
00363       double                              m_a        ;
00364 
00365       GaudiMath::Integration::Limit       m_limit    ;
00366       GaudiMath::Integration::Type        m_type     ;
00367       GaudiMath::Integration::Category    m_category ;
00368       GaudiMath::Integration::KronrodRule m_rule     ;
00369       
00370       Points                              m_points   ;
00371       double*                             m_pdata    ;
00372       
00373       double                              m_epsabs   ;
00374       double                              m_epsrel   ;
00375       
00376       mutable double                      m_result   ;
00377       mutable double                      m_error    ;
00378       
00379       size_t                              m_size     ;
00380       mutable _Workspace*                 m_ws       ;
00381       
00382       mutable  Argument                   m_argument ;
00383       
00384     };
00385     
00386   }; // end of namespace GaudiMathImplementation
00387 }; // end of namespace Genfun 
00388 
00389 // ============================================================================
00390 // The END 
00391 // ============================================================================
00392 #endif // GAUDIMATH_NUMERICALINDEFINITEINTEGRAL_H
00393 // ============================================================================

Generated at Fri Jul 18 11:59:19 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004