0024530: TKMesh - remove unused package IntPoly
[occt.git] / src / GProp / GProp_VGPropsGK.cdl
CommitLineData
b311480e 1-- Created on: 2005-12-21
2-- Created by: Sergey KHROMOV
973c2be1 3-- Copyright (c) 2005-2014 OPEN CASCADE SAS
b311480e 4--
973c2be1 5-- This file is part of Open CASCADE Technology software library.
b311480e 6--
973c2be1 7-- This library is free software; you can redistribute it and / or modify it
8-- under the terms of the GNU Lesser General Public 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.
b311480e 12--
973c2be1 13-- Alternatively, this file may be used under the terms of Open CASCADE
14-- commercial license or contractual agreement.
7fd59977 15
16generic class VGPropsGK from GProp (Arc as any;
17 Face as any; -- as FaceTool(Arc)
18 Domain as any -- as DomainTool(Arc)
19 )
20inherits GProps from GProp
21
22 ---Purpose: Computes the global properties of a geometric solid
23 -- (3D closed region of space) delimited with :
24 -- - a point and a surface
25 -- - a plane and a surface
26 --
27 -- The surface can be :
28 -- - a surface limited with its parametric values U-V,
29 -- (naturally restricted)
30 -- - a surface limited in U-V space with its boundary
31 -- curves.
32 --
33 -- The surface's requirements to evaluate the global
34 -- properties are defined in the template FaceTool class from
35 -- the package GProp.
36 --
37 -- The adaptive 2D algorithm of Gauss-Kronrod integration of
38 -- double integral is used.
39 --
40 -- The inner integral is computed along U parameter of
41 -- surface. The integrand function is encapsulated in the
42 -- support class UFunction that is defined below.
43 --
44 -- The outer integral is computed along T parameter of a
45 -- bounding curve. The integrand function is encapsulated in
46 -- the support class TFunction that is defined below.
47
48uses
49
50 Pnt from gp,
51 XYZ from gp,
52 Pln from gp,
53 Address from Standard,
54 Boolean from Standard,
55 Real from Standard
56
57
58-- Template class functions. Used for integration. Begin
59
60 class UFunction from GProp inherits Function from math
61 ---Purpose: This class represents the integrand function for
62 -- computation of an inner integral. The returned value
63 -- depends on the value type and the flag IsByPoint.
64 --
65 -- The type of returned value is the one of the following
66 -- values:
67 -- - GProp_Mass - volume computation.
68 -- - GProp_CenterMassX, GProp_CenterMassY,
69 -- GProp_CenterMassZ - X, Y and Z coordinates of center
70 -- of mass computation.
71 -- - GProp_InertiaXX, GProp_InertiaYY, GProp_InertiaZZ,
72 -- GProp_InertiaXY, GProp_InertiaXZ, GProp_InertiaYZ
73 -- - moments of inertia computation.
74 --
75 -- If the flag IsByPoint is set to Standard_True, the value is
76 -- returned for the region of space that is delimited by a
77 -- surface and a point. Otherwise all computations are
78 -- performed for the region of space delimited by a surface
79 -- and a plane.
80
81 uses
82
83 Pnt from gp,
84 XYZ from gp,
85 Address from Standard,
86 Boolean from Standard,
87 Real from Standard,
88 ValueType from GProp
89
90 is
91
92 Create(theSurface: Face;
93 theVertex : Pnt from gp;
94 IsByPoint : Boolean from Standard;
95 theCoeffs : Address from Standard)
96 ---Purpose: Constructor. Initializes the function with the face, the
97 -- location point, the flag IsByPoint and the coefficients
98 -- theCoeff that have different meaning depending on the value
99 -- of IsByPoint.
100 -- If IsByPoint is equal to Standard_True, the number of the
101 -- coefficients is equal to 3 and they represent X, Y and Z
102 -- coordinates (theCoeff[0], theCoeff[1] and theCoeff[2]
103 -- correspondingly) of the shift, if the inertia is computed
104 -- with respect to the point different then the location.
105 -- If IsByPoint is equal to Standard_False, the number of the
106 -- coefficients is 4 and they represent the combination of
107 -- plane parameters and shift values.
108 returns UFunction from GProp;
109
110 SetValueType(me: in out; theType: ValueType from GProp);
111 ---Purpose: Setting the type of the value to be returned.
112 ---C++: inline
113
114 SetVParam(me: in out; theVParam: Real from Standard);
115 ---Purpose: Setting the V parameter that is constant during the
116 -- integral computation.
117 ---C++: inline
118
119 Value(me: in out; X: Real from Standard;
120 F: out Real from Standard)
121 ---Purpose: Returns a value of the function.
122 returns Boolean from Standard
123 is redefined;
124
125 -----------------------
126 -- Private methods --
127 -----------------------
128
129 VolumeValue(me: in out; X : Real from Standard;
130 thePMP0: out XYZ from gp;
131 theS : out Real from Standard;
132 theD1 : out Real from Standard)
133 ---Purpose: Private method. Returns the value for volume computation.
134 -- Other returned values are:
135 -- - thePMP0 - PSurf(X,Y) minus Location.
136 -- - theS and theD1 coeffitients that are computed and used
137 -- for computation of center of mass and inertia values
138 -- by plane.
139 returns Real from Standard
140 is private;
141
142 CenterMassValue(me: in out; X: Real from Standard;
143 F: out Real from Standard)
144 ---Purpose: Private method. Returns a value for the center of mass
145 -- computation. If the value type other then GProp_CenterMassX,
146 -- GProp_CenterMassY or GProp_CenterMassZ this method returns
147 -- Standard_False. Returns Standard_True in case of successful
148 -- computation of a value.
149 returns Boolean from Standard
150 is private;
151
152 InertiaValue(me: in out; X: Real from Standard;
153 F: out Real from Standard)
154 ---Purpose: Private method. Computes the value of intertia. The type of
155 -- a value returned is defined by the value type. If it is
156 -- other then GProp_InertiaXX, GProp_InertiaYY,
157 -- GProp_InertiaZZ, GProp_InertiaXY, GProp_InertiaXZ or
158 -- GProp_InertiaYZ, the method returns Standard_False. Returns
159 -- Standard_True in case of successful computation of a value.
160 returns Boolean from Standard
161 is private;
162
163 fields
164
165 mySurface : Face;
166 myVertex : Pnt from gp;
167 myCoeffs : Address from Standard;
168 myVParam : Real from Standard;
169 myValueType: ValueType from GProp;
170 myIsByPoint: Boolean from Standard;
171
172 end UFunction;
173
174
175 -- Class TFunction.
176
177 class TFunction from GProp inherits Function from math
178 ---Purpose: This class represents the integrand function for the outer
179 -- integral computation. The returned value represents the
180 -- integral of UFunction. It depends on the value type and the
181 -- flag IsByPoint.
182
183 uses
184
185 Pnt from gp,
186 Address from Standard,
187 Boolean from Standard,
188 Integer from Standard,
189 Real from Standard,
190 ValueType from GProp
191
192 is
193
194 Create(theSurface : Face;
195 theVertex : Pnt from gp;
196 IsByPoint : Boolean from Standard;
197 theCoeffs : Address from Standard;
198 theUMin : Real from Standard;
199 theTolerance: Real from Standard)
200 ---Purpose: Constructor. Initializes the function with the face, the
201 -- location point, the flag IsByPoint, the coefficients
202 -- theCoeff that have different meaning depending on the value
203 -- of IsByPoint. The last two parameters are theUMin - the
204 -- lower bound of the inner integral. This value is fixed for
205 -- any integral. And the value of tolerance of inner integral
206 -- computation.
207 -- If IsByPoint is equal to Standard_True, the number of the
208 -- coefficients is equal to 3 and they represent X, Y and Z
209 -- coordinates (theCoeff[0], theCoeff[1] and theCoeff[2]
210 -- correspondingly) of the shift if the inertia is computed
211 -- with respect to the point different then the location.
212 -- If IsByPoint is equal to Standard_False, the number of the
213 -- coefficients is 4 and they represent the compbination of
214 -- plane parameters and shift values.
215 returns TFunction from GProp;
216
217 Init(me: in out);
218
219 SetNbKronrodPoints(me: in out; theNbPoints: Integer from Standard);
220 ---Purpose: Setting the expected number of Kronrod points for the outer
221 -- integral computation. This number is required for
222 -- computation of a value of tolerance for inner integral
223 -- computation. After GetStateNumber method call, this number
224 -- is recomputed by the same law as in
225 -- math_KronrodSingleIntegration, i.e. next number of points
226 -- is equal to the current number plus a square root of the
227 -- current number. If the law in math_KronrodSingleIntegration
228 -- is changed, the modification algo should be modified
229 -- accordingly.
230 ---C++: inline
231
232 SetValueType(me: in out; aType: ValueType from GProp);
233 ---Purpose: Setting the type of the value to be returned. This
234 -- parameter is directly passed to the UFunction.
235 ---C++: inline
236
237 SetTolerance(me: in out; aTol: Real from Standard);
238 ---Purpose: Setting the tolerance for inner integration
239 ---C++: inline
240
241 ErrorReached(me)
242 ---Purpose: Returns the relative reached error of all values computation since
243 -- the last call of GetStateNumber method.
244 ---C++: inline
245 returns Real from Standard;
246
247 AbsolutError(me)
248 ---Purpose: Returns the absolut reached error of all values computation since
249 -- the last call of GetStateNumber method.
250 ---C++: inline
251 returns Real from Standard;
252
253 Value(me: in out; X: Real from Standard;
254 F: out Real from Standard)
255 ---Purpose: Returns a value of the function. The value represents an
256 -- integral of UFunction. It is computed with the predefined
257 -- tolerance using the adaptive Gauss-Kronrod method.
258 returns Boolean from Standard
259 is redefined;
260
261 GetStateNumber(me: in out)
262 ---Purpose: Redefined method. Remembers the error reached during
263 -- computation of integral values since the object creation
264 -- or the last call of GetStateNumber. It is invoked in each
265 -- algorithm from the package math. Particularly in the
266 -- algorithm math_KronrodSingleIntegration that is used to
267 -- compute the integral of TFunction.
268 returns Integer
269 is redefined;
270
271 fields
272
273 mySurface : Face;
274 myUFunction : UFunction;
275 myUMin : Real from Standard;
276 myTolerance : Real from Standard;
277 myTolReached: Real from Standard;
278 myErrReached: Real from Standard;
279 myAbsError : Real from Standard;
280 myValueType : ValueType from GProp;
281 myIsByPoint : Boolean from Standard;
282 myNbPntOuter: Integer from Standard;
283
284 end TFunction;
285
286-- Template class functions. Used for integration. End
287
288is
289
290 Create
291 ---Purpose: Empty constructor.
292 ---C++: inline
293 returns VGPropsGK;
294
295 Create(theSurface : in out Face;
296 theLocation : Pnt from gp;
297 theTolerance: Real from Standard = 0.001;
298 theCGFlag: Boolean from Standard = Standard_False;
299 theIFlag: Boolean from Standard = Standard_False)
300 ---Purpose: Constructor. Computes the global properties of a region of
301 -- 3D space delimited with the naturally restricted surface
302 -- and the point VLocation.
303 returns VGPropsGK;
304
305 Create(theSurface : in out Face;
306 thePoint : Pnt from gp;
307 theLocation : Pnt from gp;
308 theTolerance: Real from Standard = 0.001;
309 theCGFlag: Boolean from Standard = Standard_False;
310 theIFlag: Boolean from Standard = Standard_False)
311
312 ---Purpose: Constructor. Computes the global properties of a region of
313 -- 3D space delimited with the naturally restricted surface
314 -- and the point VLocation. The inertia is computed with
315 -- respect to thePoint.
316 returns VGPropsGK;
317
318 Create(theSurface : in out Face;
319 theDomain : in out Domain;
320 theLocation : Pnt from gp;
321 theTolerance: Real from Standard = 0.001;
322 theCGFlag: Boolean from Standard = Standard_False;
323 theIFlag: Boolean from Standard = Standard_False)
324
325 ---Purpose: Constructor. Computes the global properties of a region of
326 -- 3D space delimited with the surface bounded by the domain
327 -- and the point VLocation.
328 returns VGPropsGK;
329
330 Create(theSurface : in out Face;
331 theDomain : in out Domain;
332 thePoint : Pnt from gp;
333 theLocation : Pnt from gp;
334 theTolerance: Real from Standard = 0.001;
335 theCGFlag: Boolean from Standard = Standard_False;
336 theIFlag: Boolean from Standard = Standard_False)
337 ---Purpose: Constructor. Computes the global properties of a region of
338 -- 3D space delimited with the surface bounded by the domain
339 -- and the point VLocation. The inertia is computed with
340 -- respect to thePoint.
341 returns VGPropsGK;
342
343 Create(theSurface : in out Face;
344 thePlane : Pln from gp;
345 theLocation : Pnt from gp;
346 theTolerance: Real from Standard = 0.001;
347 theCGFlag: Boolean from Standard = Standard_False;
348 theIFlag: Boolean from Standard = Standard_False)
349
350 ---Purpose: Constructor. Computes the global properties of a region of
351 -- 3D space delimited with the naturally restricted surface
352 -- and the plane.
353 returns VGPropsGK;
354
355 Create(theSurface : in out Face;
356 theDomain : in out Domain;
357 thePlane : Pln from gp;
358 theLocation : Pnt from gp;
359 theTolerance: Real from Standard = 0.001;
360 theCGFlag: Boolean from Standard = Standard_False;
361 theIFlag: Boolean from Standard = Standard_False)
362
363 ---Purpose: Constructor. Computes the global properties of a region of
364 -- 3D space delimited with the surface bounded by the domain
365 -- and the plane.
366 returns VGPropsGK;
367
368 SetLocation(me: in out; theLocation: Pnt from gp);
369 ---Purpose: Sets the vertex that delimit 3D closed region of space.
370 ---C++: inline
371
372 Perform(me: in out; theSurface : in out Face;
373 theTolerance: Real from Standard = 0.001;
374 theCGFlag: Boolean from Standard = Standard_False;
375 theIFlag: Boolean from Standard = Standard_False)
376
377 ---Purpose: Computes the global properties of a region of 3D space
378 -- delimited with the naturally restricted surface and the
379 -- point VLocation.
380 returns Real from Standard;
381
382 Perform(me: in out; theSurface : in out Face;
383 thePoint : Pnt from gp;
384 theTolerance: Real from Standard = 0.001;
385 theCGFlag: Boolean from Standard = Standard_False;
386 theIFlag: Boolean from Standard = Standard_False)
387
388 ---Purpose: Computes the global properties of a region of 3D space
389 -- delimited with the naturally restricted surface and the
390 -- point VLocation. The inertia is computed with respect to
391 -- thePoint.
392 returns Real from Standard;
393
394 Perform(me: in out; theSurface : in out Face;
395 theDomain : in out Domain;
396 theTolerance: Real from Standard = 0.001;
397 theCGFlag: Boolean from Standard = Standard_False;
398 theIFlag: Boolean from Standard = Standard_False)
399
400 ---Purpose: Computes the global properties of a region of 3D space
401 -- delimited with the surface bounded by the domain and the
402 -- point VLocation.
403 returns Real from Standard;
404
405 Perform(me: in out; theSurface : in out Face;
406 theDomain : in out Domain;
407 thePoint : Pnt from gp;
408 theTolerance: Real from Standard = 0.001;
409 theCGFlag: Boolean from Standard = Standard_False;
410 theIFlag: Boolean from Standard = Standard_False)
411 ---Purpose: Computes the global properties of a region of 3D space
412 -- delimited with the surface bounded by the domain and the
413 -- point VLocation. The inertia is computed with respect to
414 -- thePoint.
415 returns Real from Standard;
416
417 Perform(me: in out; theSurface : in out Face;
418 thePlane : Pln from gp;
419 theTolerance: Real from Standard = 0.001;
420 theCGFlag: Boolean from Standard = Standard_False;
421 theIFlag: Boolean from Standard = Standard_False)
422
423 ---Purpose: Computes the global properties of a region of 3D space
424 -- delimited with the naturally restricted surface and the
425 -- plane.
426 returns Real from Standard;
427
428 Perform(me: in out; theSurface : in out Face;
429 theDomain : in out Domain;
430 thePlane : Pln from gp;
431 theTolerance: Real from Standard = 0.001;
432 theCGFlag: Boolean from Standard = Standard_False;
433 theIFlag: Boolean from Standard = Standard_False)
434
435 ---Purpose: Computes the global properties of a region of 3D space
436 -- delimited with the surface bounded by the domain and the
437 -- plane.
438 returns Real from Standard;
439
440 GetErrorReached(me)
441 ---Purpose: Returns the relative reached computation error.
442 ---C++: inline
443 returns Real from Standard;
444
445 GetAbsolutError(me)
446 ---Purpose: Returns the absolut reached computation error.
447 ---C++: inline
448 returns Real from Standard;
449
450-----------------------
451-- Private methods --
452-----------------------
453
454 PrivatePerform(me: in out;
455 theSurface : in out Face;
456 thePtrDomain: Address from Standard; -- pointer to Domain.
457 IsByPoint : Boolean from Standard;
458 theCoeffs : Address from Standard;
459 theTolerance: Real from Standard;
460 theCGFlag : Boolean from Standard;
461 theIFlag : Boolean from Standard)
462
463 ---Purpose: Main method for computation of the global properties that
464 -- is invoked by each Perform method.
465 returns Real from Standard
466 is private;
467
468fields
469
470 myErrorReached: Real from Standard;
471 myAbsolutError: Real from Standard;
472
473end VGPropsGK;