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