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