The Gaudi Framework  v29r0 (ff2e7097)
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  ~GSLFunctionWithError() override = default;
57  double operator()( double x ) const override;
58  double operator()( const Argument& x ) const override;
59  bool hasAnalyticDerivative() const override { return true; }
60  unsigned int dimensionality() const override { return 1; }
61  Genfun::Derivative partial( unsigned int i ) const override;
62 
64  Function function() const;
66  const gsl_sf_result& result() const;
68  double error() const;
69 
70  private:
71  // default constructor is disabled
73  // assignement operator is disabled
75 
76  private:
79  };
81  FUNCTION_OBJECT_IMP( GSLFunctionWithError )
82 
83  class GAUDI_API GSLFunctionWithMode : public AbsFunction
84  {
85  public:
87  typedef double ( *Function )( double, gsl_mode_t );
88 
89  public:
91  FUNCTION_OBJECT_DEF( GSLFunctionWithMode )
92  public:
94  GSLFunctionWithMode( Function fun, const gsl_mode_t& mode );
98  ~GSLFunctionWithMode() override = default;
100  double operator()( double x ) const override;
101  double operator()( const Argument& x ) const override;
102  bool hasAnalyticDerivative() const override { return true; }
103  unsigned int dimensionality() const override { return 1; }
104  Genfun::Derivative partial( unsigned int i ) const override;
106  Function function() const;
108  const gsl_mode_t& mode() const;
109 
110  private:
111  // default constructor is disabled
113  // assignement operator is disabled
115 
116  private:
119  };
121  FUNCTION_OBJECT_IMP( GSLFunctionWithMode )
122 
124  {
125  public:
127  typedef int ( *Function )( double, gsl_mode_t, gsl_sf_result* );
128 
129  public:
131  FUNCTION_OBJECT_DEF( GSLFunctionWithModeAndError )
132  public:
134  GSLFunctionWithModeAndError( Function fun, const gsl_mode_t& mode );
138  ~GSLFunctionWithModeAndError() override = default;
140  double operator()( double x ) const override;
141  double operator()( const Argument& x ) const override;
142  bool hasAnalyticDerivative() const override { return true; }
143  unsigned int dimensionality() const override { return 1; }
144  Genfun::Derivative partial( unsigned int i ) const override;
146  Function function() const;
148  const gsl_mode_t& mode() const;
150  const gsl_sf_result& result() const;
152  double error() const;
153 
154  private:
155  // default constructor is disabled
157  // assignement operator is disabled
159 
160  private:
164  };
166  FUNCTION_OBJECT_IMP( GSLFunctionWithModeAndError )
167 
168  } // end of namespace GaudiMath Implemnentation
169 } // end of namespace Genfun
170 
171 #if defined( __clang__ ) || defined( __CLING__ )
172 #pragma clang diagnostic pop
173 #elif defined( __GNUC__ ) && __GNUC__ >= 5
174 #pragma GCC diagnostic pop
175 #endif
176 
177 #endif // GAUDIMATH_GSLFUNADAPTERS_H
178 // ============================================================================
Genfun::GaudiMathImplementation::GSLFunctionWithMode GSLFunctionWithMode
Definition: Adapters.h:20
Genfun::GaudiMathImplementation::GSLFunctionWithError GSLFunctionWithError
Definition: Adapters.h:21
mandatory macro from CLHEP/GenericFunctions
Definition: FunAdapters.h:268
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
CLHEP.
Definition: IEqSolver.h:13
#define GAUDI_API
Definition: Kernel.h:110
mandatory macro from CLHEP/GenericFunctions