1 // Created on: 2005-12-21
2 // Created by: Sergey KHROMOV
3 // Copyright (c) 2005-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _BRepGProp_TFunction_HeaderFile
17 #define _BRepGProp_TFunction_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
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>
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
39 class BRepGProp_TFunction : public math_Function
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
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);
63 Standard_EXPORT void Init();
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
75 void SetNbKronrodPoints (const Standard_Integer theNbPoints);
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);
81 //! Setting the tolerance for inner integration
82 void SetTolerance (const Standard_Real aTol);
84 //! Returns the relative reached error of all values computation since
85 //! the last call of GetStateNumber method.
86 Standard_Real ErrorReached() const;
88 //! Returns the absolut reached error of all values computation since
89 //! the last call of GetStateNumber method.
90 Standard_Real AbsolutError() const;
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;
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;
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;
133 #include <BRepGProp_TFunction.lxx>
139 #endif // _BRepGProp_TFunction_HeaderFile