1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
-- File: Approx_AFunction.cdl
-- Created: Mon May 29 13:16:08 1995
-- Author: Xavier BENVENISTE
-- <xab@nonox>
---Copyright: Matra Datavision 1995
class ApproxAFunction from AdvApprox
uses Array1OfInteger from TColStd,
Vector from math,
HArray1OfInteger from TColStd,
Array1OfReal from TColStd,
Array1OfPnt2d from TColgp,
Array1OfPnt from TColgp,
HArray1OfReal from TColStd,
HArray1OfPnt2d from TColgp,
HArray1OfPnt from TColgp,
HArray2OfReal from TColStd,
HArray2OfPnt2d from TColgp,
HArray2OfPnt from TColgp,
Pnt from gp,
Pnt2d from gp,
Shape from GeomAbs,
EvaluatorFunction from AdvApprox,
Cutting from AdvApprox
raises
OutOfRange from Standard,
ConstructionError from Standard
is
Create(Num1DSS : Integer ;
Num2DSS : Integer ;
Num3DSS : Integer ;
OneDTol : HArray1OfReal from TColStd ;
TwoDTol : HArray1OfReal from TColStd ;
ThreeDTol : HArray1OfReal from TColStd ;
First : Real ;
Last : Real ;
Continuity : Shape from GeomAbs ;
MaxDeg : Integer ;
MaxSeg : Integer ;
Func : EvaluatorFunction from AdvApprox)
returns ApproxAFunction from AdvApprox
raises ConstructionError;
---Purpose: Constructs approximator tool.
--
-- Warning:
-- the Func should be valid reference to object of type
-- inherited from class EvaluatorFunction from Approx
-- with life time longer than that of the approximator tool;
--
-- the result should be formatted in the following way :
-- <--Num1DSS--> <--2 * Num2DSS--> <--3 * Num3DSS-->
-- R[0] .... R[Num1DSS]..... R[Dimension-1]
--
-- the order in which each Subspace appears should be consistent
-- with the tolerances given in the create function and the
-- results will be given in that order as well that is :
-- Curve2d(n) will correspond to the nth entry
-- described by Num2DSS, Curve(n) will correspond to
-- the nth entry described by Num3DSS
-- The same type of schema applies to the Poles1d, Poles2d and
-- Poles.
Create(Num1DSS : Integer ;
Num2DSS : Integer ;
Num3DSS : Integer ;
OneDTol : HArray1OfReal from TColStd ;
TwoDTol : HArray1OfReal from TColStd ;
ThreeDTol : HArray1OfReal from TColStd ;
First : Real ;
Last : Real ;
Continuity : Shape from GeomAbs ;
MaxDeg : Integer ;
MaxSeg : Integer ;
Func : EvaluatorFunction from AdvApprox;
CutTool : Cutting from AdvApprox)
---Purpose: Approximation with user methode of cutting
returns ApproxAFunction from AdvApprox
raises ConstructionError;
Perform(me:in out;
Num1DSS : Integer ;
Num2DSS : Integer ;
Num3DSS : Integer ;
CutTool : Cutting from AdvApprox)
is private;
Approximation(myclass;
TotalDimension : Integer;
TotalNumSS : Integer;
LocalDimension : Array1OfInteger;
First : Real;
Last : Real;
Evaluator : in out EvaluatorFunction;
CutTool : Cutting from AdvApprox;
ContinuityOrder : Integer;
NumMaxCoeffs : Integer;
MaxSegments : Integer;
TolerancesArray : Array1OfReal;
code_precis : Integer;
NumCurves : in out Integer;
NumCoeffPerCurveArray : in out Array1OfInteger;
LocalCoefficientArray : in out Array1OfReal;
IntervalsArray : in out Array1OfReal;
ErrorMaxArray : in out Array1OfReal;
AverageErrorArray : in out Array1OfReal;
ErrorCode : in out Integer);
IsDone(me) returns Boolean
---C++: inline
;
-- True if the approximation succeeded within the imposed
-- tolerances
HasResult(me) returns Boolean
---C++: inline
;
-- True if the approximation did come out with a result that
-- is not NECESSARELY within the required tolerance
--
Poles1d (me)
---C++: inline
---Purpose: returns the poles from the algorithms as is
returns HArray2OfReal from TColStd ;
Poles2d (me)
---Purpose: returns the poles from the algorithms as is
---C++: inline
returns HArray2OfPnt2d from TColgp ;
Poles (me)
---Purpose: -- returns the poles from the algorithms as is
---C++: inline
returns HArray2OfPnt from TColgp ;
NbPoles(me) returns Integer
---Purpose: as the name says
;
Poles1d (me; Index : Integer ;
P : in out Array1OfReal from TColStd)
---Purpose: returns the poles at Index from the 1d subspace
raises OutOfRange ;
Poles2d (me; Index : Integer ;
P : in out Array1OfPnt2d from TColgp)
---Purpose: returns the poles at Index from the 2d subspace
raises OutOfRange ;
Poles (me; Index : Integer ;
P : in out Array1OfPnt from TColgp)
---Purpose: returns the poles at Index from the 3d subspace
raises OutOfRange ;
Degree(me) returns Integer
---C++: inline
;
NbKnots(me) returns Integer
---C++: inline
;
NumSubSpaces(me; Dimension : Integer) returns Integer
---C++: inline
;
Knots(me)
---C++: inline
returns HArray1OfReal from TColStd ;
Multiplicities(me)
---C++: inline
returns HArray1OfInteger from TColStd ;
MaxError (me; Dimension : Integer)
---Purpose: returns the error as is in the algorithms
returns HArray1OfReal from TColStd ;
AverageError(me; Dimension : Integer)
---Purpose: returns the error as is in the algorithms
returns HArray1OfReal from TColStd ;
MaxError (me; Dimension : Integer ;
Index : Integer) returns Real
;
AverageError(me; Dimension : Integer;
Index : Integer) returns Real
;
Dump(me; o: in out OStream);
---Purpose: diplay information on approximation.
fields
-- Input fields
--
myNumSubSpaces : Integer[3] ;
-- Number of subspaces [0] = number of 1 dimensional subspaces
-- [1] = number of 2 dimensional subspaces
-- [2] = number of 3 dimensional subspaces
my1DTolerances : HArray1OfReal from TColStd ;
my2DTolerances : HArray1OfReal from TColStd ;
my3DTolerances : HArray1OfReal from TColStd ;
-- -- self explanatory : one tolerance per subspace
myFirst : Real ;
-- first parameter for the approximation
myLast : Real ;
-- last parameter for the approximation
myContinuity : Shape from GeomAbs ;
-- continuity requested for the approximation
---Warning:
-- The evaluator of the function to approximate
-- must provide the derivatives up to the requested
-- order otherwise this will NOT WORK
myMaxDegree : Integer ;
-- maximum degree for the approximation
---Warning:
-- Because of the unstable evaluation after degree 14
-- this is limited to 14
myMaxSegments : Integer ;
-- maximum of segment allowed
-- Output fields
--
myDone : Boolean ;
-- tells if the approximation succeeded within the requested
-- tolerance
myHasResult : Boolean ;
-- tells if the approximation returned a result although
-- it might not be within the requested tolerance. In
-- that case myDone will be false
--
my1DPoles : HArray2OfReal from TColStd ;
-- 1D poles if myNumSubSpaces[0] > 0
my2DPoles : HArray2OfPnt2d from TColgp ;
-- 2D poles if myNumSubSpaces[1] > 0
my3DPoles : HArray2OfPnt from TColgp ;
-- 3D poles if myNumSubSpaces[2] > 0
myKnots : HArray1OfReal from TColStd ;
myMults : HArray1OfInteger from TColStd ;
myDegree : Integer ;
myEvaluator : Address from Standard;
--
-- The Errors
--
my1DMaxError : HArray1OfReal from TColStd ;
my1DAverageError : HArray1OfReal from TColStd ;
my2DMaxError : HArray1OfReal from TColStd ;
my2DAverageError : HArray1OfReal from TColStd ;
my3DMaxError : HArray1OfReal from TColStd ;
my3DAverageError : HArray1OfReal from TColStd ;
end ApproxAFunction ;
|