Integration of OCCT 6.5.0 from SVN
[occt.git] / src / AdvApp2Var / AdvApp2Var_ApproxAFunc2Var.cdl
CommitLineData
7fd59977 1-- File: AdvApp2Var_ApproxAFunc2Var.cdl
2-- Created: Wed Feb 14 13:41:28 1996
3-- Author: Joelle CHAUVET
4-- <jct@sgi38>
5-- Modified: Wed Jan 15 09:45:42 1997
6-- by: Joelle CHAUVET
7-- G1135 : Constructor with criterion
8-- G1135 : Private methods 'Init','InitGrid','Perform','ConvertBS',
9-- 'ComputePatches','ComputeConstraints',
10-- Compute3DErrors','ComputeCritError'
11-- G1135 : Fields 'myConditions','myResults','myConstraints',
12-- G1134 : Option 0 for myPrecisionCode
13---Copyright: Matra Davision 1996
14--
15
16class ApproxAFunc2Var from AdvApp2Var
17
18 ---Purpose: Perform the approximation of <Func> F(U,V)
19 -- Arguments are :
20 -- Num1DSS, Num2DSS, Num3DSS :The numbers of 1,2,3 dimensional subspaces
21 -- OneDTol, TwoDTol, ThreeDTol: The tolerance of approximation in each
22 -- subspaces
23 -- OneDTolFr, TwoDTolFr, ThreeDTolFr: The tolerance of approximation on
24 -- the boundarys in each subspaces
25 -- [FirstInU, LastInU]: The Bounds in U of the Approximation
26 -- [FirstInV, LastInV]: The Bounds in V of the Approximation
27 -- FavorIso : Give preference to extract u-iso or v-iso on F(U,V)
28 -- This can be usefull to optimize the <Func> methode
29 -- ContInU, ContInV : Continuity waiting in u and v
30 -- PrecisCode : Precision on approximation's error mesurement
31 -- 1 : Fast computation and average precision
32 -- 2 : Average computation and good precision
33 -- 3 : Slow computation and very good precision
34 -- MaxDegInU : Maximum u-degree waiting in U
35 -- MaxDegInV : Maximum u-degree waiting in V
36 -- Warning:
37 -- MaxDegInU (resp. MaxDegInV) must be >= 2*iu (resp. iv) + 1,
38 -- where iu (resp. iv) = 0 if ContInU (resp. ContInV) = GeomAbs_C0,
39 -- = 1 if = GeomAbs_C1,
40 -- = 2 if = GeomAbs_C2.
41 -- MaxPatch : Maximun number of Patch waiting
42 -- number of Patch is number of u span * number of v span
43 -- Func : The external method to evaluate F(U,V)
44 -- Crit : To (re)defined condition of convergence
45 -- UChoice, VChoice : To define the way in U (or V) Knot insertion
46 -- Warning:
47 -- for the moment, the result is a 3D Surface
48 -- so Num1DSS and Num2DSS must be equals to 0
49 -- and Num3DSS must be equal to 1.
50 -- Warning:
51 -- the Function of type EvaluatorFunc2Var from Approx
52 -- must be an extern "C" function
53 --
54 -- The evaluator Function has the following type :
55 -- typedef void (* AdvApp2Var_EvaluatorFunc2Var)
56 -- (Standard_Integer *, // Total Dimension
57 -- Standard_Real *, // StartEndInU[2]
58 -- Standard_Real *, // StartEndInV[2]
59 -- Standard_Integer *, // 1 for U = cte
60 -- // 2 for V = cte
61 -- Standard_Real *, // Value of cte
62 -- Standard_Integer *, // Number N of parameters
63 -- Standard_Real *, // Tab[N] of parameters at
64 -- // which evaluation
65 -- // should take place
66 -- Standard_Integer *, // U-Derivative Request
67 -- Standard_Integer *, // V-Derivative Request
68 -- Standard_Real *, // Result[Dimension,N]
69 -- Standard_Integer * // Error Code
70 -- ) ;
71 --
72 -- the result should be formatted in the following way :
73 -- <--Num1DSS--> <--2 * Num2DSS--> <--3 * Num3DSS-->
74 -- R[0,0] .... R[Num1DSS,0]..... R[Dimension-1,0] for the 1st parameter
75 -- R[0,i] .... R[Num1DSS,i]..... R[Dimension-1,i] for the ith parameter
76 -- R[0,N-1] .... R[Num1DSS,N-1].... R[Dimension-1,N-1] for the Nth parameter
77 --
78 -- the order in which each Subspace appears should be consistent
79 -- with the tolerances given in the create function and the
80 -- results will be given in that order as well that is :
81 -- Surface(n) will correspond to the nth entry described by Num3DSS
82
83uses Array1OfInteger from TColStd,
84 HArray1OfInteger from TColStd,
85 Array1OfReal from TColStd,
86 Array1OfPnt2d from TColgp,
87 Array1OfPnt from TColgp,
88 HArray1OfReal from TColStd,
89 HArray1OfPnt2d from TColgp,
90 HArray1OfPnt from TColgp,
91 HArray2OfInteger from TColStd,
92 HArray2OfReal from TColStd,
93 HArray2OfPnt2d from TColgp,
94 HArray2OfPnt from TColgp,
95 HArray1OfSurface from TColGeom,
96 BSplineSurface from Geom,
97 Pnt from gp,
98 Pnt2d from gp,
99 Shape from GeomAbs,
100 IsoType from GeomAbs,
101 EvaluatorFunc2Var from AdvApp2Var,
102 Criterion from AdvApp2Var,
103 Context from AdvApp2Var,
104 Network from AdvApp2Var,
105 Framework from AdvApp2Var,
106 Cutting from AdvApprox
107
108
109raises
110
111 OutOfRange from Standard,
112 ConstructionError from Standard
113
114is
115 Create(Num1DSS : Integer ;
116 Num2DSS : Integer ;
117 Num3DSS : Integer ;
118 OneDTol : HArray1OfReal from TColStd ;
119 TwoDTol : HArray1OfReal from TColStd ;
120 ThreeDTol : HArray1OfReal from TColStd ;
121 OneDTolFr : HArray2OfReal from TColStd ;
122 TwoDTolFr : HArray2OfReal from TColStd ;
123 ThreeDTolFr: HArray2OfReal from TColStd ;
124 FirstInU : Real ;
125 LastInU : Real ;
126 FirstInV : Real ;
127 LastInV : Real ;
128 FavorIso : IsoType from GeomAbs ;
129 ContInU : Shape from GeomAbs ;
130 ContInV : Shape from GeomAbs ;
131 PrecisCode : Integer ;
132 MaxDegInU : Integer ;
133 MaxDegInV : Integer ;
134 MaxPatch : Integer ;
135 Func : EvaluatorFunc2Var from AdvApp2Var;
136 UChoice : in out Cutting from AdvApprox;
137 VChoice : in out Cutting from AdvApprox)
138 returns ApproxAFunc2Var from AdvApp2Var
139 raises ConstructionError;
140
141 Create(Num1DSS : Integer ;
142 Num2DSS : Integer ;
143 Num3DSS : Integer ;
144 OneDTol : HArray1OfReal from TColStd ;
145 TwoDTol : HArray1OfReal from TColStd ;
146 ThreeDTol : HArray1OfReal from TColStd ;
147 OneDTolFr : HArray2OfReal from TColStd ;
148 TwoDTolFr : HArray2OfReal from TColStd ;
149 ThreeDTolFr: HArray2OfReal from TColStd ;
150 FirstInU : Real ;
151 LastInU : Real ;
152 FirstInV : Real ;
153 LastInV : Real ;
154 FavorIso : IsoType from GeomAbs ;
155 ContInU : Shape from GeomAbs ;
156 ContInV : Shape from GeomAbs ;
157 PrecisCode : Integer ;
158 MaxDegInU : Integer ;
159 MaxDegInV : Integer ;
160 MaxPatch : Integer ;
161 Func : EvaluatorFunc2Var from AdvApp2Var;
162 Crit : Criterion from AdvApp2Var;
163 UChoice : in out Cutting from AdvApprox;
164 VChoice : in out Cutting from AdvApprox)
165 returns ApproxAFunc2Var from AdvApp2Var
166 raises ConstructionError;
167
168
169
170 Init(me : in out)
171 is private;
172 ---Purpose: Initialisation of the approximation ; used by Create
173
174 InitGrid(me : in out; NbInt : Integer)
175 is private;
176 ---Purpose: Initialisation of the approximation with a grid of regular cuttings ;
177 -- used by Init and Perform
178
179 Perform(me : in out; UChoice, VChoice : Cutting from AdvApprox;
180 Func : EvaluatorFunc2Var from AdvApp2Var)
181 is private;
182 ---Purpose: Computation of the approximation result ; used by Create
183
184
185 Perform(me : in out; UChoice, VChoice : Cutting from AdvApprox;
186 Func : EvaluatorFunc2Var from AdvApp2Var;
187 Crit : Criterion from AdvApp2Var)
188 is private;
189 ---Purpose: Computation of the approximation result ; used by Create
190
191
192 ComputePatches(me : in out; UChoice, VChoice : Cutting from AdvApprox;
193 Func : EvaluatorFunc2Var from AdvApp2Var)
194 is private;
195 ---Purpose: Computation of the polynomial approximations ; used by Perform
196
197
198 ComputePatches(me : in out; UChoice, VChoice : Cutting from AdvApprox;
199 Func : EvaluatorFunc2Var from AdvApp2Var;
200 Crit : Criterion from AdvApp2Var)
201 is private;
202 ---Purpose: Computation of the polynomial approximations ; used by Perform
203
204
205 ComputeConstraints(me : in out; UChoice, VChoice : Cutting from AdvApprox;
206 Func : EvaluatorFunc2Var from AdvApp2Var)
207 is private;
208 ---Purpose: Approximation of the constraints ; used by ComputePatches
209
210 ComputeConstraints(me : in out; UChoice, VChoice : Cutting from AdvApprox;
211 Func : EvaluatorFunc2Var from AdvApp2Var;
212 Crit : Criterion from AdvApp2Var)
213 is private;
214 ---Purpose: Approximation of the constraints ; used by ComputePatches
215
216
217 Compute3DErrors(me : in out)
218 is private;
219 ---Purpose: Computation of the 3D errors on the approximation result ; used by Perform
220
221 ComputeCritError(me : in out)
222 is private;
223 ---Purpose: Computation of the max value of the criterion on the approximation result ;
224 -- used by Perform
225
226 ConvertBS(me : in out)
227 is private;
228 ---Purpose: Conversion of the approximation result in BSpline; used by Create
229
230
231 IsDone(me)
232 ---C++: inline
233 returns Boolean;
234 ---Purpose: True if the approximation succeeded within the imposed
235 -- tolerances and the wished continuities
236 --
237
238 HasResult(me)
239 ---C++: inline
240 returns Boolean;
241 ---Purpose: True if the approximation did come out with a result that
242 -- is not NECESSARELY within the required tolerance or a result
243 -- that is not recognized with the wished continuities
244 --
245
246 Surface (me; Index : Integer)
247 ---Purpose: returns the BSplineSurface of range Index
248 ---Warning:
249 -- Index must be equal to 1.
250 ---C++: inline
251 returns BSplineSurface from Geom;
252
253
254 UDegree(me) returns Integer ;
255 ---C++: inline
256
257 VDegree(me) returns Integer ;
258 ---C++: inline
259
260
261
262 NumSubSpaces(me; Dimension : Integer) returns Integer;
263 ---C++: inline
264 ---Warning:
265 -- Dimension must be equal to 1, 2 or 3.
266
267
268
269
270 MaxError (me; Dimension : Integer) returns HArray1OfReal from TColStd ;
271 ---Purpose: returns the errors max
272 ---Warning:
273 -- Dimension must be equal to 3.
274
275 AverageError(me; Dimension : Integer) returns HArray1OfReal from TColStd ;
276 ---Purpose: returns the average errors
277 ---Warning:
278 -- Dimension must be equal to 3.
279
280 UFrontError(me; Dimension : Integer) returns HArray1OfReal from TColStd ;
281 ---Purpose: returns the errors max on UFrontiers
282 -- Warning:
283 -- Dimension must be equal to 3.
284
285 VFrontError(me; Dimension : Integer) returns HArray1OfReal from TColStd ;
286 ---Purpose: returns the errors max on VFrontiers
287 -- Warning:
288 -- Dimension must be equal to 3.
289
290
291 MaxError (me; Dimension : Integer ; Index : Integer) returns Real ;
292 ---Purpose: returns the error max of the BSplineSurface of range Index
293 ---Warning:
294 -- Dimension must be equal to 3, Index must be equal to 1.
295
296 AverageError(me; Dimension : Integer; Index : Integer) returns Real ;
297 ---Purpose: returns the average error of the BSplineSurface of range Index
298 ---Warning:
299 -- Dimension must be equal to 3, Index must be equal to 1.
300
301 UFrontError(me; Dimension : Integer; Index : Integer) returns Real ;
302 ---Purpose: returns the error max of the BSplineSurface of range Index on a UFrontier
303 ---Warning:
304 -- Dimension must be equal to 3, Index must be equal to 1.
305
306 VFrontError(me; Dimension : Integer; Index : Integer) returns Real ;
307 ---Purpose: returns the error max of the BSplineSurface of range Index on a VFrontier
308 ---Warning:
309 -- Dimension must be equal to 3, Index must be equal to 1.
310
311 CritError(me; Dimension : Integer; Index : Integer) returns Real ;
312 -- Computation of the max value of the criterion on the BSplineSurface of range Index
313 ---Warning:
314 -- Dimension must be equal to 3, Index must be equal to 1.
315
316 Dump(me ; o : in out OStream);
317 ---Purpose: Prints on the stream o informations on the current state
318 -- of the object.
319 --
320
321fields
322 --
323 -- Input fields
324 --
325 myNumSubSpaces : Integer[3] ;
326 -- Number of subspaces [0] = number of 1 dimensional subspaces
327 -- [1] = number of 2 dimensional subspaces
328 -- [2] = number of 3 dimensional subspaces
329 ---Warning:
330 -- for the moment, the result is a 3D Surface so
331 -- myNumSubSpaces[0] = Num1DSS = 0,
332 -- myNumSubSpaces[1] = Num2DSS = 0,
333 -- myNumSubSpaces[2] = Num3DSS = 1.
334 --
335
336 my1DTolerances : HArray1OfReal from TColStd ;
337 -- unused for the moment
338 my2DTolerances : HArray1OfReal from TColStd ;
339 -- unused for the moment
340
341 my3DTolerances : HArray1OfReal from TColStd ;
342 -- one tolerance per subspace
343
344 my1DTolOnFront : HArray2OfReal from TColStd ;
345 -- unused for the moment
346 my2DTolOnFront : HArray2OfReal from TColStd ;
347 -- unused for the moment
348
349 my3DTolOnFront : HArray2OfReal from TColStd ;
350 -- 4 tolerances per subspace,
351 -- one for each frontier U=U0, U=U1, V=V0, V=V1
352
353 myFirstParInU : Real ;
354 -- U0 : first U parameter for the approximation
355 myLastParInU : Real ;
356 -- U1 : last U parameter for the approximation
357 myFirstParInV : Real ;
358 -- V0 : first V parameter for the approximation
359 myLastParInV : Real ;
360 -- V1 : last V parameter for the approximation
361 --
362 --
363 myFavoriteIso : IsoType from GeomAbs ;
364 myContInU : Shape from GeomAbs ;
365 myContInV : Shape from GeomAbs ;
366 -- continuity requested for the approximation
367 ---Warning:
368 -- The evaluator of the function to approximate must
369 -- provide the derivatives up to the requested order
370 --
371 myPrecisionCode : Integer ;
372 myMaxDegInU : Integer ;
373 -- maximum U-degree for the approximation
374 myMaxDegInV : Integer ;
375 -- maximum V-degree for the approximation
376 ---Warning:
377 -- Because of the unstable evaluation after degree 14
378 -- there are limited to 14
379 myMaxPatches : Integer ;
380 -- maximum of patches allowed
381 --
382 myEvaluator : EvaluatorFunc2Var from AdvApp2Var ;
383 -- external function
384 --
385 myConditions : Context from AdvApp2Var;
386 myResult : Network from AdvApp2Var;
387 myConstraints : Framework from AdvApp2Var;
388 --
389 --
390 -- Output fields
391 --
392 myDone : Boolean ;
393 -- tells if the approximation succeeded within the requested
394 -- tolerances and continuities.
395 --
396 myHasResult : Boolean ;
397 -- tells if the approximation returned a result although
398 -- it might not be within the requested tolerances or
399 -- the BSpline result surface has not the wished continuities.
400 -- In those cases myDone will be false.
401 --
402 --
403 mySurfaces : HArray1OfSurface from TColGeom;
404 -- one surface per subspace
405 --
406 myDegreeInU : Integer ;
407 myDegreeInV : Integer ;
408 --
409 -- The Errors
410 -- 1DErrors and 2DErrors are unused for the moment
411 --
412 my1DMaxError : HArray1OfReal from TColStd ;
413 my1DAverageError : HArray1OfReal from TColStd ;
414 my1DUFrontError : HArray1OfReal from TColStd ;
415 my1DVFrontError : HArray1OfReal from TColStd ;
416
417 my2DMaxError : HArray1OfReal from TColStd ;
418 my2DAverageError : HArray1OfReal from TColStd ;
419 my2DUFrontError : HArray1OfReal from TColStd ;
420 my2DVFrontError : HArray1OfReal from TColStd ;
421
422 -- each array contains one error
423 my3DMaxError : HArray1OfReal from TColStd ;
424 my3DAverageError : HArray1OfReal from TColStd ;
425 my3DUFrontError : HArray1OfReal from TColStd ;
426 my3DVFrontError : HArray1OfReal from TColStd ;
427
428 myCriterionError : Real from Standard ;
429
430end ApproxAFunc2Var ;
431
432
433
434
435
436