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