summaryrefslogtreecommitdiff
path: root/inc/math_KronrodSingleIntegration.hxx
blob: 9b58f48f7b6323553d87d3241ccdd11d646930f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _math_KronrodSingleIntegration_HeaderFile
#define _math_KronrodSingleIntegration_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
class StdFail_NotDone;
class math_Function;
class math_Vector;


//! This class implements the Gauss-Kronrod method of <br>
//!          integral computation. <br>
class math_KronrodSingleIntegration  {
public:

  void* operator new(size_t,void* anAddress) 
  {
    return anAddress;
  }
  void* operator new(size_t size) 
  {
    return Standard::Allocate(size); 
  }
  void  operator delete(void *anAddress) 
  {
    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
  }

  //! An empty constructor. <br>
  Standard_EXPORT   math_KronrodSingleIntegration();
  //! Constructor. Takes the function, the lower and upper bound <br>
//!          values, the initial number of Kronrod points <br>
  Standard_EXPORT   math_KronrodSingleIntegration(math_Function& theFunction,const Standard_Real theLower,const Standard_Real theUpper,const Standard_Integer theNbPnts);
  //! Constructor. Takes the function, the lower and upper bound <br>
//!          values, the initial number of Kronrod points, the <br>
//!          tolerance value and the maximal number of iterations as <br>
//!          parameters. <br>
  Standard_EXPORT   math_KronrodSingleIntegration(math_Function& theFunction,const Standard_Real theLower,const Standard_Real theUpper,const Standard_Integer theNbPnts,const Standard_Real theTolerance,const Standard_Integer theMaxNbIter);
  //! Computation of the integral. Takes the function, <br>
//!          the lower and upper bound values, the initial number <br>
//!          of Kronrod points, the relative tolerance value and the <br>
//!          maximal number of iterations as parameters. <br>
//!          theNbPnts should be odd and greater then or equal to 3. <br>
  Standard_EXPORT     void Perform(math_Function& theFunction,const Standard_Real theLower,const Standard_Real theUpper,const Standard_Integer theNbPnts) ;
  //! Computation of the integral. Takes the function, <br>
//!          the lower and upper bound values, the initial number <br>
//!          of Kronrod points, the relative tolerance value and the <br>
//!          maximal number of iterations as parameters. <br>
//!          theNbPnts should be odd and greater then or equal to 3. <br>
//!          Note that theTolerance is relative, i.e. the criterion of <br>
//!          solution reaching is: <br>
//!          Abs(Kronrod - Gauss)/Abs(Kronrod) < theTolerance. <br>
//!          theTolerance should be positive. <br>
  Standard_EXPORT     void Perform(math_Function& theFunction,const Standard_Real theLower,const Standard_Real theUpper,const Standard_Integer theNbPnts,const Standard_Real theTolerance,const Standard_Integer theMaxNbIter) ;
  //! Returns Standard_True if computation is performed <br>
//!          successfully. <br>
        Standard_Boolean IsDone() const;
  //! Returns the value of the integral. <br>
        Standard_Real Value() const;
  //! Returns the value of the relative error reached. <br>
        Standard_Real ErrorReached() const;
  //! Returns the value of the relative error reached. <br>
        Standard_Real AbsolutError() const;
  //! Returns the number of Kronrod points <br>
//!          for which the result is computed. <br>
        Standard_Integer OrderReached() const;
  //! Returns the number of iterations <br>
//!          that were made to compute result. <br>
        Standard_Integer NbIterReached() const;
  
  Standard_EXPORT   static  Standard_Boolean GKRule(math_Function& theFunction,const Standard_Real theLower,const Standard_Real theUpper,const math_Vector& theGaussP,const math_Vector& theGaussW,const math_Vector& theKronrodP,const math_Vector& theKronrodW,Standard_Real& theValue,Standard_Real& theError) ;





protected:





private:



Standard_Boolean myIsDone;
Standard_Real myValue;
Standard_Real myErrorReached;
Standard_Real myAbsolutError;
Standard_Integer myNbPntsReached;
Standard_Integer myNbIterReached;


};


#include <math_KronrodSingleIntegration.lxx>



// other Inline functions and methods (like "C++: function call" methods)


#endif