1 -- File: AdvApp2Var_ApproxAFunc2Var.cdl
2 -- Created: Wed Feb 14 13:41:28 1996
3 -- Author: Joelle CHAUVET
5 -- Modified: Wed Jan 15 09:45:42 1997
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
16 class ApproxAFunc2Var from AdvApp2Var
18 ---Purpose: Perform the approximation of <Func> F(U,V)
20 -- Num1DSS, Num2DSS, Num3DSS :The numbers of 1,2,3 dimensional subspaces
21 -- OneDTol, TwoDTol, ThreeDTol: The tolerance of approximation in each
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
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
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.
51 -- the Function of type EvaluatorFunc2Var from Approx
52 -- must be a subclass of AdvApp2Var_EvaluatorFunc2Var
54 -- the result should be formatted in the following way :
55 -- <--Num1DSS--> <--2 * Num2DSS--> <--3 * Num3DSS-->
56 -- R[0,0] .... R[Num1DSS,0]..... R[Dimension-1,0] for the 1st parameter
57 -- R[0,i] .... R[Num1DSS,i]..... R[Dimension-1,i] for the ith parameter
58 -- R[0,N-1] .... R[Num1DSS,N-1].... R[Dimension-1,N-1] for the Nth parameter
60 -- the order in which each Subspace appears should be consistent
61 -- with the tolerances given in the create function and the
62 -- results will be given in that order as well that is :
63 -- Surface(n) will correspond to the nth entry described by Num3DSS
65 uses Array1OfInteger from TColStd,
66 HArray1OfInteger from TColStd,
67 Array1OfReal from TColStd,
68 Array1OfPnt2d from TColgp,
69 Array1OfPnt from TColgp,
70 HArray1OfReal from TColStd,
71 HArray1OfPnt2d from TColgp,
72 HArray1OfPnt from TColgp,
73 HArray2OfInteger from TColStd,
74 HArray2OfReal from TColStd,
75 HArray2OfPnt2d from TColgp,
76 HArray2OfPnt from TColgp,
77 HArray1OfSurface from TColGeom,
78 BSplineSurface from Geom,
83 EvaluatorFunc2Var from AdvApp2Var,
84 Criterion from AdvApp2Var,
85 Context from AdvApp2Var,
86 Network from AdvApp2Var,
87 Framework from AdvApp2Var,
88 Cutting from AdvApprox
93 OutOfRange from Standard,
94 ConstructionError from Standard
97 Create(Num1DSS : Integer ;
100 OneDTol : HArray1OfReal from TColStd ;
101 TwoDTol : HArray1OfReal from TColStd ;
102 ThreeDTol : HArray1OfReal from TColStd ;
103 OneDTolFr : HArray2OfReal from TColStd ;
104 TwoDTolFr : HArray2OfReal from TColStd ;
105 ThreeDTolFr: HArray2OfReal from TColStd ;
110 FavorIso : IsoType from GeomAbs ;
111 ContInU : Shape from GeomAbs ;
112 ContInV : Shape from GeomAbs ;
113 PrecisCode : Integer ;
114 MaxDegInU : Integer ;
115 MaxDegInV : Integer ;
117 Func : EvaluatorFunc2Var from AdvApp2Var;
118 UChoice : in out Cutting from AdvApprox;
119 VChoice : in out Cutting from AdvApprox)
120 returns ApproxAFunc2Var from AdvApp2Var
121 raises ConstructionError;
123 Create(Num1DSS : Integer ;
126 OneDTol : HArray1OfReal from TColStd ;
127 TwoDTol : HArray1OfReal from TColStd ;
128 ThreeDTol : HArray1OfReal from TColStd ;
129 OneDTolFr : HArray2OfReal from TColStd ;
130 TwoDTolFr : HArray2OfReal from TColStd ;
131 ThreeDTolFr: HArray2OfReal from TColStd ;
136 FavorIso : IsoType from GeomAbs ;
137 ContInU : Shape from GeomAbs ;
138 ContInV : Shape from GeomAbs ;
139 PrecisCode : Integer ;
140 MaxDegInU : Integer ;
141 MaxDegInV : Integer ;
143 Func : EvaluatorFunc2Var from AdvApp2Var;
144 Crit : Criterion from AdvApp2Var;
145 UChoice : in out Cutting from AdvApprox;
146 VChoice : in out Cutting from AdvApprox)
147 returns ApproxAFunc2Var from AdvApp2Var
148 raises ConstructionError;
154 ---Purpose: Initialisation of the approximation ; used by Create
156 InitGrid(me : in out; NbInt : Integer)
158 ---Purpose: Initialisation of the approximation with a grid of regular cuttings ;
159 -- used by Init and Perform
161 Perform(me : in out; UChoice, VChoice : Cutting from AdvApprox;
162 Func : EvaluatorFunc2Var from AdvApp2Var)
164 ---Purpose: Computation of the approximation result ; used by Create
167 Perform(me : in out; UChoice, VChoice : Cutting from AdvApprox;
168 Func : EvaluatorFunc2Var from AdvApp2Var;
169 Crit : Criterion from AdvApp2Var)
171 ---Purpose: Computation of the approximation result ; used by Create
174 ComputePatches(me : in out; UChoice, VChoice : Cutting from AdvApprox;
175 Func : EvaluatorFunc2Var from AdvApp2Var)
177 ---Purpose: Computation of the polynomial approximations ; used by Perform
180 ComputePatches(me : in out; UChoice, VChoice : Cutting from AdvApprox;
181 Func : EvaluatorFunc2Var from AdvApp2Var;
182 Crit : Criterion from AdvApp2Var)
184 ---Purpose: Computation of the polynomial approximations ; used by Perform
187 ComputeConstraints(me : in out; UChoice, VChoice : Cutting from AdvApprox;
188 Func : EvaluatorFunc2Var from AdvApp2Var)
190 ---Purpose: Approximation of the constraints ; used by ComputePatches
192 ComputeConstraints(me : in out; UChoice, VChoice : Cutting from AdvApprox;
193 Func : EvaluatorFunc2Var from AdvApp2Var;
194 Crit : Criterion from AdvApp2Var)
196 ---Purpose: Approximation of the constraints ; used by ComputePatches
199 Compute3DErrors(me : in out)
201 ---Purpose: Computation of the 3D errors on the approximation result ; used by Perform
203 ComputeCritError(me : in out)
205 ---Purpose: Computation of the max value of the criterion on the approximation result ;
208 ConvertBS(me : in out)
210 ---Purpose: Conversion of the approximation result in BSpline; used by Create
216 ---Purpose: True if the approximation succeeded within the imposed
217 -- tolerances and the wished continuities
223 ---Purpose: True if the approximation did come out with a result that
224 -- is not NECESSARELY within the required tolerance or a result
225 -- that is not recognized with the wished continuities
228 Surface (me; Index : Integer)
229 ---Purpose: returns the BSplineSurface of range Index
231 -- Index must be equal to 1.
233 returns BSplineSurface from Geom;
236 UDegree(me) returns Integer ;
239 VDegree(me) returns Integer ;
244 NumSubSpaces(me; Dimension : Integer) returns Integer;
247 -- Dimension must be equal to 1, 2 or 3.
252 MaxError (me; Dimension : Integer) returns HArray1OfReal from TColStd ;
253 ---Purpose: returns the errors max
255 -- Dimension must be equal to 3.
257 AverageError(me; Dimension : Integer) returns HArray1OfReal from TColStd ;
258 ---Purpose: returns the average errors
260 -- Dimension must be equal to 3.
262 UFrontError(me; Dimension : Integer) returns HArray1OfReal from TColStd ;
263 ---Purpose: returns the errors max on UFrontiers
265 -- Dimension must be equal to 3.
267 VFrontError(me; Dimension : Integer) returns HArray1OfReal from TColStd ;
268 ---Purpose: returns the errors max on VFrontiers
270 -- Dimension must be equal to 3.
273 MaxError (me; Dimension : Integer ; Index : Integer) returns Real ;
274 ---Purpose: returns the error max of the BSplineSurface of range Index
276 -- Dimension must be equal to 3, Index must be equal to 1.
278 AverageError(me; Dimension : Integer; Index : Integer) returns Real ;
279 ---Purpose: returns the average error of the BSplineSurface of range Index
281 -- Dimension must be equal to 3, Index must be equal to 1.
283 UFrontError(me; Dimension : Integer; Index : Integer) returns Real ;
284 ---Purpose: returns the error max of the BSplineSurface of range Index on a UFrontier
286 -- Dimension must be equal to 3, Index must be equal to 1.
288 VFrontError(me; Dimension : Integer; Index : Integer) returns Real ;
289 ---Purpose: returns the error max of the BSplineSurface of range Index on a VFrontier
291 -- Dimension must be equal to 3, Index must be equal to 1.
293 CritError(me; Dimension : Integer; Index : Integer) returns Real ;
294 -- Computation of the max value of the criterion on the BSplineSurface of range Index
296 -- Dimension must be equal to 3, Index must be equal to 1.
298 Dump(me ; o : in out OStream);
299 ---Purpose: Prints on the stream o informations on the current state
307 myNumSubSpaces : Integer[3] ;
308 -- Number of subspaces [0] = number of 1 dimensional subspaces
309 -- [1] = number of 2 dimensional subspaces
310 -- [2] = number of 3 dimensional subspaces
312 -- for the moment, the result is a 3D Surface so
313 -- myNumSubSpaces[0] = Num1DSS = 0,
314 -- myNumSubSpaces[1] = Num2DSS = 0,
315 -- myNumSubSpaces[2] = Num3DSS = 1.
318 my1DTolerances : HArray1OfReal from TColStd ;
319 -- unused for the moment
320 my2DTolerances : HArray1OfReal from TColStd ;
321 -- unused for the moment
323 my3DTolerances : HArray1OfReal from TColStd ;
324 -- one tolerance per subspace
326 my1DTolOnFront : HArray2OfReal from TColStd ;
327 -- unused for the moment
328 my2DTolOnFront : HArray2OfReal from TColStd ;
329 -- unused for the moment
331 my3DTolOnFront : HArray2OfReal from TColStd ;
332 -- 4 tolerances per subspace,
333 -- one for each frontier U=U0, U=U1, V=V0, V=V1
335 myFirstParInU : Real ;
336 -- U0 : first U parameter for the approximation
337 myLastParInU : Real ;
338 -- U1 : last U parameter for the approximation
339 myFirstParInV : Real ;
340 -- V0 : first V parameter for the approximation
341 myLastParInV : Real ;
342 -- V1 : last V parameter for the approximation
345 myFavoriteIso : IsoType from GeomAbs ;
346 myContInU : Shape from GeomAbs ;
347 myContInV : Shape from GeomAbs ;
348 -- continuity requested for the approximation
350 -- The evaluator of the function to approximate must
351 -- provide the derivatives up to the requested order
353 myPrecisionCode : Integer ;
354 myMaxDegInU : Integer ;
355 -- maximum U-degree for the approximation
356 myMaxDegInV : Integer ;
357 -- maximum V-degree for the approximation
359 -- Because of the unstable evaluation after degree 14
360 -- there are limited to 14
361 myMaxPatches : Integer ;
362 -- maximum of patches allowed
365 myConditions : Context from AdvApp2Var;
366 myResult : Network from AdvApp2Var;
367 myConstraints : Framework from AdvApp2Var;
373 -- tells if the approximation succeeded within the requested
374 -- tolerances and continuities.
376 myHasResult : Boolean ;
377 -- tells if the approximation returned a result although
378 -- it might not be within the requested tolerances or
379 -- the BSpline result surface has not the wished continuities.
380 -- In those cases myDone will be false.
383 mySurfaces : HArray1OfSurface from TColGeom;
384 -- one surface per subspace
386 myDegreeInU : Integer ;
387 myDegreeInV : Integer ;
390 -- 1DErrors and 2DErrors are unused for the moment
392 my1DMaxError : HArray1OfReal from TColStd ;
393 my1DAverageError : HArray1OfReal from TColStd ;
394 my1DUFrontError : HArray1OfReal from TColStd ;
395 my1DVFrontError : HArray1OfReal from TColStd ;
397 my2DMaxError : HArray1OfReal from TColStd ;
398 my2DAverageError : HArray1OfReal from TColStd ;
399 my2DUFrontError : HArray1OfReal from TColStd ;
400 my2DVFrontError : HArray1OfReal from TColStd ;
402 -- each array contains one error
403 my3DMaxError : HArray1OfReal from TColStd ;
404 my3DAverageError : HArray1OfReal from TColStd ;
405 my3DUFrontError : HArray1OfReal from TColStd ;
406 my3DVFrontError : HArray1OfReal from TColStd ;
408 myCriterionError : Real from Standard ;
410 end ApproxAFunc2Var ;