| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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/GenericFunctions.hh"
11 #include "CLHEP/GenericFunctions/Argument.hh"
12 #include "CLHEP/GenericFunctions/AbsFunction.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 {
38 typedef Genfun::GaudiMathImplementation::SimpleFunction GSLFunction ;
39
40 class GAUDI_API GSLFunctionWithError : public AbsFunction
41 {
42 public:
44 typedef int (*Function)( double , gsl_sf_result* ) ;
45 public:
47 FUNCTION_OBJECT_DEF( GSLFunctionWithError )
48 public:
50 GSLFunctionWithError ( Function function ) ;
52 GSLFunctionWithError ( const GSLFunctionWithError& ) ;
54 ~GSLFunctionWithError () override = default;
56 double operator() ( double x ) const override;
57 double operator() ( const Argument& x ) const override;
58 bool hasAnalyticDerivative () const override { return true ; }
59 unsigned int dimensionality () const override { return 1 ; }
60 Genfun::Derivative partial ( unsigned int i ) const override;
61
63 Function function () const ;
65 const gsl_sf_result& result () const ;
67 double error () const ;
68 private:
69 // default constructor is disabled
70 GSLFunctionWithError () ;
71 // assignement operator is disabled
72 GSLFunctionWithError& operator=( const GSLFunctionWithError & ) ;
73 private:
74 Function m_function ;
75 std::unique_ptr<gsl_sf_result> m_result ;
76 };
78 FUNCTION_OBJECT_IMP( GSLFunctionWithError )
79
80 class GAUDI_API GSLFunctionWithMode : public AbsFunction
81 {
82 public:
84 typedef double (*Function)( double , gsl_mode_t ) ;
85 public:
87 FUNCTION_OBJECT_DEF( GSLFunctionWithMode )
88 public:
90 GSLFunctionWithMode ( Function fun ,
91 const gsl_mode_t& mode ) ;
93 GSLFunctionWithMode ( const GSLFunctionWithMode& ) ;
95 ~GSLFunctionWithMode () override = default;
97 double operator() ( double x ) const override;
98 double operator() ( const Argument& x ) const override;
99 bool hasAnalyticDerivative () const override { return true ; }
100 unsigned int dimensionality () const override { return 1 ; }
101 Genfun::Derivative partial ( unsigned int i ) const override ;
103 Function function () const ;
105 const gsl_mode_t& mode () const ;
106 private:
107 // default constructor is disabled
108 GSLFunctionWithMode () ;
109 // assignement operator is disabled
110 GSLFunctionWithMode& operator=( const GSLFunctionWithError & ) ;
111 private:
112 Function m_function ;
113 gsl_mode_t* m_mode ;
114 };
116 FUNCTION_OBJECT_IMP( GSLFunctionWithMode )
117
118 class GAUDI_API GSLFunctionWithModeAndError : public AbsFunction
119 {
120 public:
122 typedef int (*Function)( double ,
123 gsl_mode_t ,
124 gsl_sf_result* ) ;
125 public:
127 FUNCTION_OBJECT_DEF( GSLFunctionWithModeAndError )
128 public:
130 GSLFunctionWithModeAndError ( Function fun ,
131 const gsl_mode_t& mode ) ;
133 GSLFunctionWithModeAndError ( const GSLFunctionWithModeAndError& ) ;
135 ~GSLFunctionWithModeAndError () override = default;
137 double operator() ( double x ) const override;
138 double operator() ( const Argument& x ) const override;
139 bool hasAnalyticDerivative () const override { return true ; }
140 unsigned int dimensionality () const override { return 1 ; }
141 Genfun::Derivative partial ( unsigned int i ) const override;
143 Function function () const ;
145 const gsl_mode_t& mode () const ;
147 const gsl_sf_result& result () const ;
149 double error () const ;
150 private:
151 // default constructor is disabled
152 GSLFunctionWithModeAndError () ;
153 // assignement operator is disabled
154 GSLFunctionWithModeAndError& operator=
155 ( const GSLFunctionWithModeAndError & ) ;
156 private:
157 Function m_function ;
158 std::unique_ptr<gsl_mode_t> m_mode ;
159 std::unique_ptr<gsl_sf_result> m_result ;
160 };
162 FUNCTION_OBJECT_IMP( GSLFunctionWithModeAndError )
163
164 } // end of namespace GaudiMath Implemnentation
165 } // end of namespace Genfun
166
167 #if defined(__clang__) || defined(__CLING__)
168 #pragma clang diagnostic pop
169 #elif defined(__GNUC__) && __GNUC__ >= 5
170 #pragma GCC diagnostic pop
171 #endif
172
173 #endif // GAUDIMATH_GSLFUNADAPTERS_H
174 // ============================================================================
GaudiMath::GSLFunctionWithMode
Genfun::GaudiMathImplementation::GSLFunctionWithMode GSLFunctionWithMode
Definition: Adapters.h:25
Kernel.h
GaudiMath::GSLFunctionWithError
Genfun::GaudiMathImplementation::GSLFunctionWithError GSLFunctionWithError
Definition: Adapters.h:27
Genfun::GaudiMathImplementation::GSLFunctionWithMode::m_mode
gsl_mode_t * m_mode
Definition: GSLFunAdapters.h:113
gaudirun.default
default
Definition: gaudirun.py:141
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError::m_mode
std::unique_ptr< gsl_mode_t > m_mode
Definition: GSLFunAdapters.h:158
Genfun::GaudiMathImplementation::SimpleFunction
mandatory macro from CLHEP/GenericFunctions
Definition: FunAdapters.h:216
GaudiMath::Function
Genfun::AbsFunction Function
Definition: GaudiMath.h:24
class
#define class
Definition: HistogramPersistencySvc.cpp:45
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError::dimensionality
unsigned int dimensionality() const override
Definition: GSLFunAdapters.h:140
GaudiMath::Derivative
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:29
operator=
PropertyMgr & operator=(const PropertyMgr &)=delete
Genfun::GaudiMathImplementation::GSLFunction
Genfun::GaudiMathImplementation::SimpleFunction GSLFunction
the actual type for primitive adaptor
Definition: GSLFunAdapters.h:38
FunAdapters.h
Genfun::GaudiMathImplementation::GSLFunctionWithMode
mandatory macro from CLHEP/GenericFunctions
Definition: GSLFunAdapters.h:80
Genfun::GaudiMathImplementation::GSLFunctionWithError::m_result
std::unique_ptr< gsl_sf_result > m_result
Definition: GSLFunAdapters.h:75
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError::m_result
std::unique_ptr< gsl_sf_result > m_result
Definition: GSLFunAdapters.h:159
GaudiMath::GSLFunctionWithModeAndError
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError GSLFunctionWithModeAndError
Definition: Adapters.h:29
std::unique_ptr< gsl_sf_result >
fun
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
Genfun::GaudiMathImplementation::GSLFunctionWithError::m_function
Function m_function
Definition: GSLFunAdapters.h:74
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError::m_function
Function m_function
Definition: GSLFunAdapters.h:157
Genfun::GaudiMathImplementation::GSLFunctionWithMode::dimensionality
unsigned int dimensionality() const override
Definition: GSLFunAdapters.h:100
Genfun
CLHEP.
Definition: IEqSolver.h:13
Genfun::GaudiMathImplementation::GSLFunctionWithError
Definition: GSLFunAdapters.h:40
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError
mandatory macro from CLHEP/GenericFunctions
Definition: GSLFunAdapters.h:118
Genfun::GaudiMathImplementation::GSLFunctionWithMode::m_function
Function m_function
Definition: GSLFunAdapters.h:112
Genfun::GaudiMathImplementation::GSLFunctionWithError::dimensionality
unsigned int dimensionality() const override
Definition: GSLFunAdapters.h:59