42cf5bc1 |
1 | // Created on: 2005-12-21 |
2 | // Created by: Sergey KHROMOV |
3 | // Copyright (c) 2005-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _BRepGProp_TFunction_HeaderFile |
17 | #define _BRepGProp_TFunction_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_DefineAlloc.hxx> |
21 | #include <Standard_Handle.hxx> |
22 | |
23 | #include <BRepGProp_Face.hxx> |
24 | #include <BRepGProp_UFunction.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <GProp_ValueType.hxx> |
27 | #include <Standard_Boolean.hxx> |
28 | #include <Standard_Integer.hxx> |
29 | #include <math_Function.hxx> |
30 | #include <Standard_Address.hxx> |
31 | class BRepGProp_Face; |
32 | class gp_Pnt; |
33 | |
34 | |
35 | //! This class represents the integrand function for the outer |
36 | //! integral computation. The returned value represents the |
37 | //! integral of UFunction. It depends on the value type and the |
38 | //! flag IsByPoint. |
39 | class BRepGProp_TFunction : public math_Function |
40 | { |
41 | public: |
42 | |
43 | DEFINE_STANDARD_ALLOC |
44 | |
45 | |
46 | //! Constructor. Initializes the function with the face, the |
47 | //! location point, the flag IsByPoint, the coefficients |
48 | //! theCoeff that have different meaning depending on the value |
49 | //! of IsByPoint. The last two parameters are theUMin - the |
50 | //! lower bound of the inner integral. This value is fixed for |
51 | //! any integral. And the value of tolerance of inner integral |
52 | //! computation. |
53 | //! If IsByPoint is equal to Standard_True, the number of the |
54 | //! coefficients is equal to 3 and they represent X, Y and Z |
55 | //! coordinates (theCoeff[0], theCoeff[1] and theCoeff[2] |
56 | //! correspondingly) of the shift if the inertia is computed |
57 | //! with respect to the point different then the location. |
58 | //! If IsByPoint is equal to Standard_False, the number of the |
59 | //! coefficients is 4 and they represent the compbination of |
60 | //! plane parameters and shift values. |
61 | Standard_EXPORT BRepGProp_TFunction(const BRepGProp_Face& theSurface, const gp_Pnt& theVertex, const Standard_Boolean IsByPoint, const Standard_Address theCoeffs, const Standard_Real theUMin, const Standard_Real theTolerance); |
62 | |
63 | Standard_EXPORT void Init(); |
64 | |
65 | //! Setting the expected number of Kronrod points for the outer |
66 | //! integral computation. This number is required for |
67 | //! computation of a value of tolerance for inner integral |
68 | //! computation. After GetStateNumber method call, this number |
69 | //! is recomputed by the same law as in |
70 | //! math_KronrodSingleIntegration, i.e. next number of points |
71 | //! is equal to the current number plus a square root of the |
72 | //! current number. If the law in math_KronrodSingleIntegration |
73 | //! is changed, the modification algo should be modified |
74 | //! accordingly. |
75 | void SetNbKronrodPoints (const Standard_Integer theNbPoints); |
76 | |
77 | //! Setting the type of the value to be returned. This |
78 | //! parameter is directly passed to the UFunction. |
79 | void SetValueType (const GProp_ValueType aType); |
80 | |
81 | //! Setting the tolerance for inner integration |
82 | void SetTolerance (const Standard_Real aTol); |
83 | |
84 | //! Returns the relative reached error of all values computation since |
85 | //! the last call of GetStateNumber method. |
86 | Standard_Real ErrorReached() const; |
87 | |
88 | //! Returns the absolut reached error of all values computation since |
89 | //! the last call of GetStateNumber method. |
90 | Standard_Real AbsolutError() const; |
91 | |
92 | //! Returns a value of the function. The value represents an |
93 | //! integral of UFunction. It is computed with the predefined |
94 | //! tolerance using the adaptive Gauss-Kronrod method. |
95 | Standard_EXPORT virtual Standard_Boolean Value (const Standard_Real X, Standard_Real& F) Standard_OVERRIDE; |
96 | |
97 | //! Redefined method. Remembers the error reached during |
98 | //! computation of integral values since the object creation |
99 | //! or the last call of GetStateNumber. It is invoked in each |
100 | //! algorithm from the package math. Particularly in the |
101 | //! algorithm math_KronrodSingleIntegration that is used to |
102 | //! compute the integral of TFunction. |
103 | Standard_EXPORT virtual Standard_Integer GetStateNumber() Standard_OVERRIDE; |
104 | |
105 | |
106 | |
107 | |
108 | protected: |
109 | |
110 | |
111 | |
112 | |
113 | |
114 | private: |
115 | |
116 | |
117 | |
118 | BRepGProp_Face mySurface; |
119 | BRepGProp_UFunction myUFunction; |
120 | Standard_Real myUMin; |
121 | Standard_Real myTolerance; |
122 | Standard_Real myTolReached; |
123 | Standard_Real myErrReached; |
124 | Standard_Real myAbsError; |
125 | GProp_ValueType myValueType; |
126 | Standard_Boolean myIsByPoint; |
127 | Standard_Integer myNbPntOuter; |
128 | |
129 | |
130 | }; |
131 | |
132 | |
133 | #include <BRepGProp_TFunction.lxx> |
134 | |
135 | |
136 | |
137 | |
138 | |
139 | #endif // _BRepGProp_TFunction_HeaderFile |