b311480e |
1 | -- Created on: 1997-10-22 |
2 | -- Created by: Philippe MANGIN |
3 | -- Copyright (c) 1997-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 HermitJacobi from PLib |
23 | |
24 | inherits Base from PLib |
25 | |
26 | --- Purpose: This class provides method to work with Jacobi Polynomials |
27 | -- relativly to an order of constraint |
28 | -- q = myWorkDegree-2*(myNivConstr+1) |
29 | -- Jk(t) for k=0,q compose the Jacobi Polynomial base relativly to the weigth W(t) |
30 | -- iorder is the integer value for the constraints: |
31 | -- iorder = 0 <=> ConstraintOrder = GeomAbs_C0 |
32 | -- iorder = 1 <=> ConstraintOrder = GeomAbs_C1 |
33 | -- iorder = 2 <=> ConstraintOrder = GeomAbs_C2 |
34 | -- P(t) = H(t) + W(t) * Q(t) Where W(t) = (1-t**2)**(2*iordre+2) |
35 | -- the coefficients JacCoeff represents P(t) JacCoeff are stored as follow: |
36 | -- |
37 | -- c0(1) c0(2) .... c0(Dimension) |
38 | -- c1(1) c1(2) .... c1(Dimension) |
39 | -- |
40 | -- |
41 | -- |
42 | -- cDegree(1) cDegree(2) .... cDegree(Dimension) |
43 | -- |
44 | -- The coefficients |
45 | -- c0(1) c0(2) .... c0(Dimension) |
46 | -- c2*ordre+1(1) ... c2*ordre+1(dimension) |
47 | -- |
48 | -- represents the part of the polynomial in the |
49 | -- Hermit's base: H(t) |
50 | -- H(t) = c0H00(t) + c1H01(t) + ...c(iordre)H(0 ;iorder)+ c(iordre+1)H10(t)+... |
51 | -- The following coefficients represents the part of the |
52 | -- polynomial in the Jacobi base ie Q(t) |
53 | -- Q(t) = c2*iordre+2 J0(t) + ...+ cDegree JDegree-2*iordre-2 |
54 | |
55 | uses |
56 | Array2OfReal from TColStd, |
57 | Array1OfReal from TColStd, |
58 | Shape from GeomAbs, |
59 | Matrix from math, |
60 | JacobiPolynomial from PLib |
61 | |
62 | raises |
63 | ConstructionError from Standard |
64 | |
65 | is |
66 | |
67 | Create ( WorkDegree : Integer ; |
68 | ConstraintOrder : Shape from GeomAbs) |
69 | returns HermitJacobi from PLib |
70 | |
71 | |
72 | ---Purpose: |
73 | -- Initialize the polynomial class |
74 | -- Degree has to be <= 30 |
75 | -- ConstraintOrder has to be GeomAbs_C0 |
76 | -- GeomAbs_C1 |
77 | -- GeomAbs_C2 |
78 | |
79 | raises ConstructionError from Standard; |
80 | -- if Degree or ConstraintOrder is non valid |
81 | |
82 | |
83 | -- |
84 | -- Work in HermitJacobi base |
85 | |
86 | MaxError ( me ; Dimension : Integer ; |
87 | HermJacCoeff : in out Real; |
88 | NewDegree : Integer ) |
89 | returns Real; |
90 | |
91 | ---Purpose: |
92 | -- This method computes the maximum error on the polynomial |
93 | -- W(t) Q(t) obtained by missing the coefficients of JacCoeff from |
94 | -- NewDegree +1 to Degree |
95 | |
96 | ReduceDegree ( me ; Dimension , MaxDegree : Integer ; Tol : Real ; |
97 | HermJacCoeff : in out Real; |
98 | NewDegree : out Integer ; |
99 | MaxError : out Real); |
100 | |
101 | ---Purpose: |
102 | -- Compute NewDegree <= MaxDegree so that MaxError is lower |
103 | -- than Tol. |
104 | -- MaxError can be greater than Tol if it is not possible |
105 | -- to find a NewDegree <= MaxDegree. |
106 | -- In this case NewDegree = MaxDegree |
107 | -- |
108 | AverageError ( me ; Dimension : Integer ; |
109 | HermJacCoeff : in out Real; |
110 | NewDegree : Integer ) |
111 | -- This method computes the average error on the polynomial W(t)Q(t) |
112 | -- obtained by missing the |
113 | -- coefficients JacCoeff from NewDegree +1 to Degree |
114 | returns Real; |
115 | |
116 | |
117 | ToCoefficients ( me ; Dimension, Degree : Integer ; |
118 | HermJacCoeff : Array1OfReal from TColStd ; |
119 | Coefficients : out Array1OfReal from TColStd ); |
120 | |
121 | ---Purpose: |
122 | -- Convert the polynomial P(t) = H(t) + W(t) Q(t) in the canonical base. |
123 | -- |
124 | |
125 | D0123 (me : mutable; NDerive : Integer; U : Real; |
126 | BasisValue : out Array1OfReal from TColStd; |
127 | BasisD1 : out Array1OfReal from TColStd; |
128 | BasisD2 : out Array1OfReal from TColStd; |
129 | BasisD3 : out Array1OfReal from TColStd) |
130 | ---Purpose: Compute the values and the derivatives values of |
131 | -- the basis functions in u |
132 | is private; |
133 | |
134 | D0 (me : mutable; U : Real; |
135 | BasisValue : out Array1OfReal from TColStd); |
136 | ---Purpose: Compute the values of the basis functions in u |
137 | -- |
138 | |
139 | D1 (me : mutable; U : Real; |
140 | BasisValue : out Array1OfReal from TColStd; |
141 | BasisD1 : out Array1OfReal from TColStd); |
142 | ---Purpose: Compute the values and the derivatives values of |
143 | -- the basis functions in u |
144 | |
145 | D2 (me : mutable; U : Real; |
146 | BasisValue : out Array1OfReal from TColStd; |
147 | BasisD1 : out Array1OfReal from TColStd; |
148 | BasisD2 : out Array1OfReal from TColStd); |
149 | ---Purpose: Compute the values and the derivatives values of |
150 | -- the basis functions in u |
151 | |
152 | D3 (me : mutable; U : Real; |
153 | BasisValue : out Array1OfReal from TColStd; |
154 | BasisD1 : out Array1OfReal from TColStd; |
155 | BasisD2 : out Array1OfReal from TColStd; |
156 | BasisD3 : out Array1OfReal from TColStd); |
157 | ---Purpose: Compute the values and the derivatives values of |
158 | -- the basis functions in u |
159 | |
160 | WorkDegree (me) |
161 | --- Purpose: returns WorkDegree |
162 | ---C++: inline |
163 | returns Integer; |
164 | |
165 | NivConstr (me) |
166 | ---Purpose: returns NivConstr |
167 | ---C++: inline |
168 | returns Integer; |
169 | |
170 | fields |
171 | myH : Matrix from math; |
172 | myJacobi : JacobiPolynomial from PLib; |
173 | myWCoeff : Array1OfReal; -- The cannonical Coefficients of W(t). |
174 | |
175 | end HermitJacobi; |