0024043: Performance improvements: Modeling Algorithms
[occt.git] / src / Extrema / Extrema_FuncExtCC.cdl
1 -- Created on: 1991-07-24
2 -- Created by: Michel CHAUVAT
3 -- Copyright (c) 1991-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
21
22
23 private generic class FuncExtCC from Extrema 
24 (Curve1    as any;
25  Tool1     as any;-- as ToolCurve(Curve1);
26  Curve2    as any;
27  Tool2     as any;-- as ToolCurve(Curve2);
28  POnC      as any;
29  Pnt       as any;
30  Vec       as any )
31  
32  
33 inherits FunctionSetWithDerivatives from math
34     ---Purpose: Function allows finding extrema of the distance between 2 curves.
35
36 uses    Vector            from math,
37         Matrix            from math,
38         SequenceOfReal    from TColStd
39
40 raises  OutOfRange from Standard
41
42 private class SeqPOnC instantiates Sequence from TCollection(POnC);
43
44 is
45
46     Create (thetol: Real = 1.0e-10) returns FuncExtCC;
47     ---Purpose:
48
49     Create (C1: Curve1; C2: Curve2; thetol: Real = 1.0e-10) returns FuncExtCC;
50     ---Purpose:
51
52     SetCurve (me: in out; theRank: Integer; C1: Curve1);
53     ---Purpose:
54
55     SetTolerance (me: in out; theTol: Real);
56     ---C++: inline
57     ---Purpose:
58
59     NbVariables (me) returns Integer is redefined;
60     ---C++: inline
61
62     NbEquations (me) returns Integer is redefined;
63     ---C++: inline
64
65     Value (me: in out; UV: Vector; F: out Vector) returns Boolean is redefined;
66         ---Purpose: Calculate Fi(U,V).
67
68     Derivatives (me: in out; UV: Vector; DF: out Matrix)
69         returns Boolean;
70         ---Purpose: Calculate Fi'(U,V).
71
72     Values (me: in out; UV: Vector; F: out Vector; DF: out Matrix)
73         returns Boolean;
74         ---Purpose: Calculate Fi(U,V) and Fi'(U,V).
75
76     GetStateNumber (me: in out) returns Integer
77         ---Purpose: Save the found extremum.
78         is redefined;
79
80     NbExt (me) returns Integer;
81         ---C++: inline
82         ---Purpose: Return the number of found extrema.
83
84     SquareDistance (me; N: Integer) returns Real
85         ---C++: inline
86         ---Purpose: Return the value of the Nth distance.
87         raises  OutOfRange;
88                 -- if N < 1 or N > NbExt(me).
89
90     Points (me; N: Integer; P1,P2: out POnC)
91         ---Purpose: Return the points of the Nth extreme distance.
92         raises  OutOfRange;
93                 -- if N < 1 or N > NbExt(me).
94
95     CurvePtr (me; theRank: Integer) returns Address;
96         ---C++: inline
97         ---Purpose: Returns a pointer to the curve specified in the constructor
98         --          or in SetCurve() method.
99
100     Tolerance (me) returns Real;
101         ---C++: inline
102         ---Purpose: Returns a tolerance specified in the constructor
103         --          or in SetTolerance() method.
104
105     SubIntervalInitialize(me: in out; theUfirst, theUlast: Vector);
106         ---Purpose: Determines of boundaries of subinterval for find of root.
107     
108     SearchOfTolerance(me: in out; C: Address from Standard) returns Real from Standard;
109         ---Purpose: Computes a Tol value. If 1st derivative of curve
110         --          |D1|<Tol, it is considered D1=0.      
111
112
113 fields
114     myC1    : Address from Standard;
115     myC2    : Address from Standard;
116     myTol   : Real;
117     myU     : Real;        
118     myV     : Real;        
119     myP1    : Pnt;   -- current point C1(U)
120     myP2    : Pnt;   -- current point C2(U)
121     myDu    : Vec;   -- current D1 C1(U)
122     myDv    : Vec;   -- current D1 C2(V)
123
124     mySqDist: SequenceOfReal from TColStd;
125     myPoints: SeqPOnC;
126
127     myTolC1,myTolC2: Real from Standard;  -- toolerance for derivate
128
129 --Supremum of search 1st non-zero derivative    
130     myMaxDerivOrderC1, myMaxDerivOrderC2: Integer from Standard;
131     
132 --boundaries of subinterval for find of root
133     myUinfium, myUsupremum: Real from Standard; -- C1 curve
134     myVinfium, myVsupremum: Real from Standard; -- C2 curve
135
136
137 end FuncExtCC;