| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# GSLFunAdapters.h

Go to the documentation of this file.

    00001 // $Id: GSLFunAdapters.h,v 1.2 2005/11/25 10:27:03 mato Exp $
    00002 // ============================================================================
    00003 #ifndef GAUDIMATH_GSLFUNADAPTERS_H
    00004 #define GAUDIMATH_GSLFUNADAPTERS_H 1
    00005 // ============================================================================
    00006 // Include files
    00007 // ============================================================================
    00008 // from CLHEP
    00009 // ============================================================================
    00010 #include "CLHEP/GenericFunctions/GenericFunctions.hh"
    00011 #include "CLHEP/GenericFunctions/Argument.hh"
    00012 #include "CLHEP/GenericFunctions/AbsFunction.hh"
    00013 // ============================================================================
    00014 // GaudiGSL/GaudiMath
    00015 // ============================================================================
    00016 #include "GaudiMath/FunAdapters.h"
    00017 // ============================================================================
    00018 // GSL
    00019 // ============================================================================
    00020 #include "gsl/gsl_mode.h"
    00021 #include "gsl/gsl_sf_result.h"
    00022 // ============================================================================
    00023
    00024 namespace Genfun
    00025 {
    00026   namespace GaudiMathImplementation
    00027   {
    00029     typedef Genfun::GaudiMathImplementation::SimpleFunction GSLFunction ;
    00030
    00031     class GSLFunctionWithError : public AbsFunction
    00032     {
    00033     public:
    00035       typedef int (*Function)( double , gsl_sf_result* ) ;
    00036     public:
    00038       FUNCTION_OBJECT_DEF( GSLFunctionWithError ) ;
    00039     public:
    00041       GSLFunctionWithError ( Function function ) ;
    00043       GSLFunctionWithError ( const GSLFunctionWithError& ) ;
    00045       virtual ~GSLFunctionWithError () ;
    00047       virtual double operator() (       double    x ) const ;
    00048       virtual double operator() ( const Argument& x ) const ;
    00049       virtual bool         hasAnalyticDerivative () const { return true ; }
    00050       virtual unsigned int dimensionality        () const { return    1 ; }
    00051       Genfun::Derivative partial ( unsigned int i ) const ;
    00052
    00054       Function             function () const ;
    00056       const gsl_sf_result& result   () const ;
    00058       double               error    () const ;
    00059     private:
    00060       // default constructor is disabled
    00061       GSLFunctionWithError () ;
    00062       // assignement operator is disabled
    00063       GSLFunctionWithError& operator=( const GSLFunctionWithError & ) ;
    00064     private:
    00065       Function        m_function ;
    00066       gsl_sf_result*  m_result   ;
    00067     };
    00068
    00069     class GSLFunctionWithMode : public AbsFunction
    00070     {
    00071     public:
    00073       typedef double (*Function)( double , gsl_mode_t ) ;
    00074     public:
    00076       FUNCTION_OBJECT_DEF( GSLFunctionWithMode ) ;
    00077     public:
    00079       GSLFunctionWithMode ( Function          fun  ,
    00080                             const gsl_mode_t& mode ) ;
    00082       GSLFunctionWithMode ( const GSLFunctionWithMode& ) ;
    00084       virtual ~GSLFunctionWithMode () ;
    00086       virtual double operator() (       double    x ) const ;
    00087       virtual double operator() ( const Argument& x ) const ;
    00088       virtual bool         hasAnalyticDerivative () const { return true ; }
    00089       virtual unsigned int dimensionality        () const { return    1 ; }
    00090       Genfun::Derivative partial ( unsigned int i ) const ;
    00092       Function             function () const ;
    00094       const gsl_mode_t&    mode     () const ;
    00095     private:
    00096       // default constructor is disabled
    00097       GSLFunctionWithMode () ;
    00098       // assignement operator is disabled
    00099       GSLFunctionWithMode& operator=( const GSLFunctionWithError & ) ;
    00100     private:
    00101       Function        m_function ;
    00102       gsl_mode_t*     m_mode     ;
    00103     };
    00104
    00105     class GSLFunctionWithModeAndError : public AbsFunction
    00106     {
    00107     public:
    00109       typedef int (*Function)( double          ,
    00110                                gsl_mode_t      ,
    00111                                gsl_sf_result*  ) ;
    00112     public:
    00114       FUNCTION_OBJECT_DEF( GSLFunctionWithModeAndError ) ;
    00115     public:
    00117       GSLFunctionWithModeAndError ( Function          fun  ,
    00118                                     const gsl_mode_t& mode ) ;
    00120       GSLFunctionWithModeAndError ( const GSLFunctionWithModeAndError& ) ;
    00122       virtual ~GSLFunctionWithModeAndError () ;
    00124       virtual double operator() (       double    x ) const ;
    00125       virtual double operator() ( const Argument& x ) const ;
    00126       virtual bool         hasAnalyticDerivative () const { return true ; }
    00127       virtual unsigned int dimensionality        () const { return    1 ; }
    00128       Genfun::Derivative partial ( unsigned int i ) const ;
    00130       Function             function () const ;
    00132       const gsl_mode_t&    mode     () const ;
    00134       const gsl_sf_result& result   () const ;
    00136       double               error    () const ;
    00137     private:
    00138       // default constructor is disabled
    00139       GSLFunctionWithModeAndError () ;
    00140       // assignement operator is disabled
    00141       GSLFunctionWithModeAndError& operator=
    00142       ( const GSLFunctionWithModeAndError & ) ;
    00143     private:
    00144       Function        m_function ;
    00145       gsl_mode_t*     m_mode     ;
    00146       gsl_sf_result*  m_result   ;
    00147     };
    00148
    00149   } ; // end of namespace GaudiMath Implemnentation
    00150 }; // end of namespace Genfun
    00151
    00152 #endif // GAUDIMATH_GSLFUNADAPTERS_H
    00153 // ============================================================================