The Gaudi Framework  v30r3 (a5ef0a68)
GSLFunAdapters.h
Go to the documentation of this file.
1 #ifndef GAUDIMATH_GSLFUNADAPTERS_H
2 #define GAUDIMATH_GSLFUNADAPTERS_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 #include <memory>
7 // ============================================================================
8 // from CLHEP
9 // ============================================================================
10 #include "CLHEP/GenericFunctions/AbsFunction.hh"
11 #include "CLHEP/GenericFunctions/Argument.hh"
12 #include "CLHEP/GenericFunctions/GenericFunctions.hh"
13 // ============================================================================
14 // GaudiGSL/GaudiMath
15 // ============================================================================
16 #include "GaudiMath/FunAdapters.h"
17 // ============================================================================
18 // GSL
19 // ============================================================================
20 #include "gsl/gsl_mode.h"
21 #include "gsl/gsl_sf_result.h"
22 // ============================================================================
23 #include "GaudiKernel/Kernel.h"
24 
25 #if defined( __clang__ ) || defined( __CLING__ )
26 #pragma clang diagnostic push
27 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
28 #elif defined( __GNUC__ ) && __GNUC__ >= 5
29 #pragma GCC diagnostic push
30 #pragma GCC diagnostic ignored "-Wsuggest-override"
31 #endif
32 
33 namespace Genfun
34 {
35  namespace GaudiMathImplementation
36  {
39 
40  class GAUDI_API GSLFunctionWithError : public AbsFunction
41  {
42  public:
44  typedef int ( *Function )( double, gsl_sf_result* );
45 
46  public:
48  FUNCTION_OBJECT_DEF( GSLFunctionWithError )
49  public:
51  GSLFunctionWithError( Function function );
55  double operator()( double x ) const override;
56  double operator()( const Argument& x ) const override;
57  bool hasAnalyticDerivative() const override { return true; }
58  unsigned int dimensionality() const override { return 1; }
59  Genfun::Derivative partial( unsigned int i ) const override;
60 
62  Function function() const;
64  const gsl_sf_result& result() const;
66  double error() const;
67 
68  private:
69  // default constructor is disabled
71  // assignement operator is disabled
73 
74  private:
77  };
79  FUNCTION_OBJECT_IMP( GSLFunctionWithError )
80 
81  class GAUDI_API GSLFunctionWithMode : public AbsFunction
82  {
83  public:
85  typedef double ( *Function )( double, gsl_mode_t );
86 
87  public:
89  FUNCTION_OBJECT_DEF( GSLFunctionWithMode )
90  public:
92  GSLFunctionWithMode( Function fun, const gsl_mode_t& mode );
96  double operator()( double x ) const override;
97  double operator()( const Argument& x ) const override;
98  bool hasAnalyticDerivative() const override { return true; }
99  unsigned int dimensionality() const override { return 1; }
100  Genfun::Derivative partial( unsigned int i ) const override;
102  Function function() const;
104  const gsl_mode_t& mode() const;
105 
106  private:
107  // default constructor is disabled
109  // assignement operator is disabled
111 
112  private:
115  };
117  FUNCTION_OBJECT_IMP( GSLFunctionWithMode )
118 
120  {
121  public:
123  typedef int ( *Function )( double, gsl_mode_t, gsl_sf_result* );
124 
125  public:
127  FUNCTION_OBJECT_DEF( GSLFunctionWithModeAndError )
128  public:
130  GSLFunctionWithModeAndError( Function fun, const gsl_mode_t& mode );
134  double operator()( double x ) const override;
135  double operator()( const Argument& x ) const override;
136  bool hasAnalyticDerivative() const override { return true; }
137  unsigned int dimensionality() const override { return 1; }
138  Genfun::Derivative partial( unsigned int i ) const override;
140  Function function() const;
142  const gsl_mode_t& mode() const;
144  const gsl_sf_result& result() const;
146  double error() const;
147 
148  private:
149  // default constructor is disabled
151  // assignement operator is disabled
153 
154  private:
158  };
160  FUNCTION_OBJECT_IMP( GSLFunctionWithModeAndError )
161 
162  } // end of namespace GaudiMath Implemnentation
163 } // end of namespace Genfun
164 
165 #if defined( __clang__ ) || defined( __CLING__ )
166 #pragma clang diagnostic pop
167 #elif defined( __GNUC__ ) && __GNUC__ >= 5
168 #pragma GCC diagnostic pop
169 #endif
170 
171 #endif // GAUDIMATH_GSLFUNADAPTERS_H
172 // ============================================================================
Genfun::GaudiMathImplementation::GSLFunctionWithMode GSLFunctionWithMode
Definition: Adapters.h:20
Genfun::GaudiMathImplementation::GSLFunctionWithError GSLFunctionWithError
Definition: Adapters.h:21
mandatory macro from CLHEP/GenericFunctions
Definition: FunAdapters.h:220
Genfun::AbsFunction Function
Definition: GaudiMath.h:24
#define class
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:27
PropertyMgr & operator=(const PropertyMgr &)=delete
Genfun::GaudiMathImplementation::SimpleFunction GSLFunction
the actual type for primitive adaptor
mandatory macro from CLHEP/GenericFunctions
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError GSLFunctionWithModeAndError
Definition: Adapters.h:22
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
#define GAUDI_API
Definition: Kernel.h:104
mandatory macro from CLHEP/GenericFunctions