summaryrefslogtreecommitdiff
path: root/inc/math_FunctionAllRoots.hxx
blob: 119be3576894cbd28f96c1869d6a511b6a5f9335 (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
125
126
127
128
129
130
131
132
133
// 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_FunctionAllRoots_HeaderFile
#define _math_FunctionAllRoots_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 _TColStd_SequenceOfReal_HeaderFile
#include <TColStd_SequenceOfReal.hxx>
#endif
#ifndef _TColStd_SequenceOfInteger_HeaderFile
#include <TColStd_SequenceOfInteger.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Standard_OStream_HeaderFile
#include <Standard_OStream.hxx>
#endif
class Standard_OutOfRange;
class StdFail_NotDone;
class Standard_NumericError;
class math_FunctionWithDerivative;
class math_FunctionSample;


//! This algorithm uses a sample of the function to find <br>
//!          all intervals on which the function is null, and afterwards <br>
//!          uses the FunctionRoots algorithm to find the points <br>
//!          where the function is null outside the "null intervals". <br>
//! Knowledge of the derivative is required. <br>
class math_FunctionAllRoots  {
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); 
  }

  //! The algorithm uses the sample to find intervals on which <br>
//!          the function is null. An interval is found if, for at least <br>
//!          two consecutive points of the sample, Ui and Ui+1, we get <br>
//!          |F(Ui)|<=EpsNul and |F(Ui+1)|<=EpsNul. The real bounds of <br>
//!          an interval are computed with the FunctionRoots. <br>
//!          algorithm. <br>
//!          Between two intervals, the roots of the function F are <br>
//!          calculated using the FunctionRoots algorithm. <br>
  Standard_EXPORT   math_FunctionAllRoots(math_FunctionWithDerivative& F,const math_FunctionSample& S,const Standard_Real EpsX,const Standard_Real EpsF,const Standard_Real EpsNul);
  //! Returns True if the computation has been done successfully. <br>
        Standard_Boolean IsDone() const;
  //! Returns the number of intervals on which the function <br>
//!          is Null. <br>
//!          An exception is raised if IsDone returns False. <br>
        Standard_Integer NbIntervals() const;
  //! Returns the interval of parameter of range Index. <br>
//!          An exception is raised if IsDone returns False; <br>
//!          An exception is raised if Index<=0 or Index >Nbintervals. <br>
        void GetInterval(const Standard_Integer Index,Standard_Real& A,Standard_Real& B) const;
  //! returns the State Number associated to the interval Index. <br>
//!          An exception is raised if IsDone returns False; <br>
//!          An exception is raised if Index<=0 or Index >Nbintervals. <br>
        void GetIntervalState(const Standard_Integer Index,Standard_Integer& IFirst,Standard_Integer& ILast) const;
  //! returns the number of points where the function is Null. <br>
//!          An exception is raised if IsDone returns False. <br>
        Standard_Integer NbPoints() const;
  //! Returns the parameter of the point of range Index. <br>
//!          An exception is raised if IsDone returns False; <br>
//!          An exception is raised if Index<=0 or Index >NbPoints. <br>
        Standard_Real GetPoint(const Standard_Integer Index) const;
  //! returns the State Number associated to the point Index. <br>
//!          An exception is raised if IsDone returns False; <br>
//!          An exception is raised if Index<=0 or Index >Nbintervals. <br>
        Standard_Integer GetPointState(const Standard_Integer Index) const;
  //! Prints on the stream o information on the current state <br>
//!          of the object. <br>
  Standard_EXPORT     void Dump(Standard_OStream& o) const;





protected:





private:



Standard_Boolean done;
TColStd_SequenceOfReal pdeb;
TColStd_SequenceOfReal pfin;
TColStd_SequenceOfReal piso;
TColStd_SequenceOfInteger ideb;
TColStd_SequenceOfInteger ifin;
TColStd_SequenceOfInteger iiso;


};


#include <math_FunctionAllRoots.lxx>



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


#endif