| The Gaudi Framework v29r0 (ff2e7097)

- 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/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 {
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
46 public:
48 FUNCTION_OBJECT_DEF( GSLFunctionWithError )
49 public:
51 GSLFunctionWithError( Function function );
53 GSLFunctionWithError( const GSLFunctionWithError& );
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
72 GSLFunctionWithError();
73 // assignement operator is disabled
74 GSLFunctionWithError& operator=( const GSLFunctionWithError& );
75
76 private:
77 Function m_function;
78 std::unique_ptr<gsl_sf_result> m_result;
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 );
96 GSLFunctionWithMode( const GSLFunctionWithMode& );
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
112 GSLFunctionWithMode();
113 // assignement operator is disabled
114 GSLFunctionWithMode& operator=( const GSLFunctionWithError& );
115
116 private:
117 Function m_function;
118 std::unique_ptr<gsl_mode_t> m_mode;
119 };
121 FUNCTION_OBJECT_IMP( GSLFunctionWithMode )
122
123 class GAUDI_API GSLFunctionWithModeAndError : public AbsFunction
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 );
136 GSLFunctionWithModeAndError( const GSLFunctionWithModeAndError& );
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
156 GSLFunctionWithModeAndError();
157 // assignement operator is disabled
158 GSLFunctionWithModeAndError& operator=( const GSLFunctionWithModeAndError& );
159
160 private:
161 Function m_function;
162 std::unique_ptr<gsl_mode_t> m_mode;
163 std::unique_ptr<gsl_sf_result> m_result;
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 // ============================================================================
GaudiMath::GSLFunctionWithMode
Genfun::GaudiMathImplementation::GSLFunctionWithMode GSLFunctionWithMode
Definition: Adapters.h:20
Kernel.h
GaudiMath::GSLFunctionWithError
Genfun::GaudiMathImplementation::GSLFunctionWithError GSLFunctionWithError
Definition: Adapters.h:21
gaudirun.default
default
Definition: gaudirun.py:149
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError::m_mode
std::unique_ptr< gsl_mode_t > m_mode
Definition: GSLFunAdapters.h:162
Genfun::GaudiMathImplementation::SimpleFunction
mandatory macro from CLHEP/GenericFunctions
Definition: FunAdapters.h:268
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:143
GaudiMath::Derivative
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:27
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:83
Genfun::GaudiMathImplementation::GSLFunctionWithError::m_result
std::unique_ptr< gsl_sf_result > m_result
Definition: GSLFunAdapters.h:78
Genfun::GaudiMathImplementation::GSLFunctionWithMode::m_mode
std::unique_ptr< gsl_mode_t > m_mode
Definition: GSLFunAdapters.h:118
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError::m_result
std::unique_ptr< gsl_sf_result > m_result
Definition: GSLFunAdapters.h:163
GaudiMath::GSLFunctionWithModeAndError
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError GSLFunctionWithModeAndError
Definition: Adapters.h:22
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:77
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError::m_function
Function m_function
Definition: GSLFunAdapters.h:161
Genfun::GaudiMathImplementation::GSLFunctionWithMode::dimensionality
unsigned int dimensionality() const override
Definition: GSLFunAdapters.h:103
Genfun
CLHEP.
Definition: IEqSolver.h:13
Genfun::GaudiMathImplementation::GSLFunctionWithError
Definition: GSLFunAdapters.h:40
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
Genfun::GaudiMathImplementation::GSLFunctionWithModeAndError
mandatory macro from CLHEP/GenericFunctions
Definition: GSLFunAdapters.h:123
Genfun::GaudiMathImplementation::GSLFunctionWithMode::m_function
Function m_function
Definition: GSLFunAdapters.h:117
Genfun::GaudiMathImplementation::GSLFunctionWithError::dimensionality
unsigned int dimensionality() const override
Definition: GSLFunAdapters.h:60