b311480e |
1 | -- Created on: 1996-10-08 |
2 | -- Created by: Jeannine PANTIATICI |
3 | -- Copyright (c) 1996-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class JacobiPolynomial from PLib |
18 | |
19 | inherits Base from PLib |
20 | |
21 | --- Purpose: This class provides method to work with Jacobi Polynomials |
22 | -- relativly to an order of constraint |
23 | -- q = myWorkDegree-2*(myNivConstr+1) |
24 | -- Jk(t) for k=0,q compose the Jacobi Polynomial base relativly to the weigth W(t) |
25 | -- iorder is the integer value for the constraints: |
26 | -- iorder = 0 <=> ConstraintOrder = GeomAbs_C0 |
27 | -- iorder = 1 <=> ConstraintOrder = GeomAbs_C1 |
28 | -- iorder = 2 <=> ConstraintOrder = GeomAbs_C2 |
29 | -- P(t) = R(t) + W(t) * Q(t) Where W(t) = (1-t**2)**(2*iordre+2) |
30 | -- the coefficients JacCoeff represents P(t) JacCoeff are stored as follow: |
31 | -- |
32 | -- c0(1) c0(2) .... c0(Dimension) |
33 | -- c1(1) c1(2) .... c1(Dimension) |
34 | -- |
35 | -- |
36 | -- |
37 | -- cDegree(1) cDegree(2) .... cDegree(Dimension) |
38 | -- |
39 | -- The coefficients |
40 | -- c0(1) c0(2) .... c0(Dimension) |
41 | -- c2*ordre+1(1) ... c2*ordre+1(dimension) |
42 | -- |
43 | -- represents the part of the polynomial in the |
44 | -- canonical base: R(t) |
45 | -- R(t) = c0 + c1 t + ...+ c2*iordre+1 t**2*iordre+1 |
46 | -- The following coefficients represents the part of the |
47 | -- polynomial in the Jacobi base ie Q(t) |
48 | -- Q(t) = c2*iordre+2 J0(t) + ...+ cDegree JDegree-2*iordre-2 |
49 | |
50 | uses |
51 | |
52 | Array2OfReal from TColStd, |
53 | Array1OfReal from TColStd, |
54 | HArray1OfReal from TColStd, |
55 | Shape from GeomAbs |
56 | |
57 | raises |
58 | ConstructionError from Standard |
59 | |
60 | is |
61 | |
62 | -- Create returns JacobiPolynomial from PLib; |
63 | |
64 | Create ( WorkDegree : Integer ; |
65 | ConstraintOrder : Shape from GeomAbs) |
66 | returns JacobiPolynomial from PLib |
67 | |
68 | |
69 | ---Purpose: |
70 | -- Initialize the polynomial class |
71 | -- Degree has to be <= 30 |
72 | -- ConstraintOrder has to be GeomAbs_C0 |
73 | -- GeomAbs_C1 |
74 | -- GeomAbs_C2 |
75 | |
76 | raises ConstructionError from Standard; |
77 | -- if Degree or ConstraintOrder is non valid |
78 | |
79 | -- |
80 | -- Jacobi characteristics |
81 | -- |
82 | Points ( me ; NbGaussPoints : Integer ; |
83 | TabPoints : out Array1OfReal from TColStd ) |
84 | ---Purpose: |
85 | -- returns the Jacobi Points for Gauss integration ie |
86 | -- the positive values of the Legendre roots by increasing values |
87 | -- NbGaussPoints is the number of points choosen for the integral |
88 | -- computation. |
89 | -- TabPoints (0,NbGaussPoints/2) |
90 | -- TabPoints (0) is loaded only for the odd values of NbGaussPoints |
91 | -- The possible values for NbGaussPoints are : 8, 10, |
92 | -- 15, 20, 25, 30, 35, 40, 50, 61 |
93 | -- NbGaussPoints must be greater than Degree |
94 | |
95 | raises ConstructionError from Standard; |
96 | -- Invalid NbGaussPoints |
97 | |
98 | Weights (me ; NbGaussPoints : Integer ; |
99 | TabWeights : out Array2OfReal from TColStd ) |
100 | |
101 | --- Purpose: |
102 | -- returns the Jacobi weigths for Gauss integration only for |
103 | -- the positive values of the Legendre roots in the order they |
104 | --- are given by the method Points |
105 | -- NbGaussPoints is the number of points choosen for the integral |
106 | -- computation. |
107 | -- TabWeights (0,NbGaussPoints/2,0,Degree) |
108 | -- TabWeights (0,.) are only loaded for the odd values of NbGaussPoints |
109 | -- The possible values for NbGaussPoints are : 8 , 10 , 15 ,20 ,25 , 30, |
110 | -- 35 , 40 , 50 , 61 NbGaussPoints must be greater than Degree |
111 | |
112 | raises ConstructionError from Standard; |
113 | -- Invalid NbGaussPoints |
114 | |
115 | MaxValue ( me ; TabMax : out Array1OfReal from TColStd ); |
116 | ---Purpose: |
117 | -- this method loads for k=0,q the maximum value of |
118 | -- abs ( W(t)*Jk(t) )for t bellonging to [-1,1] |
119 | -- This values are loaded is the array TabMax(0,myWorkDegree-2*(myNivConst+1)) |
120 | -- MaxValue ( me ; TabMaxPointer : in out Real ); |
121 | |
122 | -- |
123 | -- Work in Jacobi base |
124 | |
125 | MaxError ( me ; Dimension : Integer ; |
126 | JacCoeff : in out Real; |
127 | NewDegree : Integer ) |
128 | returns Real; |
129 | |
130 | ---Purpose: |
131 | -- This method computes the maximum error on the polynomial |
132 | -- W(t) Q(t) obtained by missing the coefficients of JacCoeff from |
133 | -- NewDegree +1 to Degree |
134 | |
135 | ReduceDegree ( me ; Dimension , MaxDegree : Integer ; Tol : Real ; |
136 | JacCoeff : in out Real; |
137 | NewDegree : out Integer ; |
138 | MaxError : out Real); |
139 | |
140 | ---Purpose: |
141 | -- Compute NewDegree <= MaxDegree so that MaxError is lower |
142 | -- than Tol. |
143 | -- MaxError can be greater than Tol if it is not possible |
144 | -- to find a NewDegree <= MaxDegree. |
145 | -- In this case NewDegree = MaxDegree |
146 | -- |
147 | AverageError ( me ; Dimension : Integer ; |
148 | JacCoeff : in out Real; |
149 | NewDegree : Integer ) |
150 | -- This method computes the average error on the polynomial W(t)Q(t) |
151 | -- obtained by missing the |
152 | -- coefficients JacCoeff from NewDegree +1 to Degree |
153 | returns Real; |
154 | |
155 | |
156 | ToCoefficients ( me ; Dimension, Degree : Integer ; |
157 | JacCoeff : Array1OfReal from TColStd ; |
158 | Coefficients : out Array1OfReal from TColStd ); |
159 | |
160 | ---Purpose: |
161 | -- Convert the polynomial P(t) = R(t) + W(t) Q(t) in the canonical base. |
162 | -- |
163 | |
164 | D0123 (me : mutable; NDerive : Integer; U : Real; |
165 | BasisValue : out Array1OfReal from TColStd; |
166 | BasisD1 : out Array1OfReal from TColStd; |
167 | BasisD2 : out Array1OfReal from TColStd; |
168 | BasisD3 : out Array1OfReal from TColStd) |
169 | ---Purpose: Compute the values and the derivatives values of |
170 | -- the basis functions in u |
171 | is private; |
172 | |
173 | D0 (me : mutable; U : Real; |
174 | BasisValue : out Array1OfReal from TColStd); |
175 | ---Purpose: Compute the values of the basis functions in u |
176 | -- |
177 | |
178 | D1 (me : mutable; U : Real; |
179 | BasisValue : out Array1OfReal from TColStd; |
180 | BasisD1 : out Array1OfReal from TColStd); |
181 | ---Purpose: Compute the values and the derivatives values of |
182 | -- the basis functions in u |
183 | |
184 | D2 (me : mutable; U : Real; |
185 | BasisValue : out Array1OfReal from TColStd; |
186 | BasisD1 : out Array1OfReal from TColStd; |
187 | BasisD2 : out Array1OfReal from TColStd); |
188 | ---Purpose: Compute the values and the derivatives values of |
189 | -- the basis functions in u |
190 | |
191 | D3 (me : mutable; U : Real; |
192 | BasisValue : out Array1OfReal from TColStd; |
193 | BasisD1 : out Array1OfReal from TColStd; |
194 | BasisD2 : out Array1OfReal from TColStd; |
195 | BasisD3 : out Array1OfReal from TColStd); |
196 | ---Purpose: Compute the values and the derivatives values of |
197 | -- the basis functions in u |
198 | |
199 | WorkDegree (me) |
200 | ---Purpose: returns WorkDegree |
201 | ---C++: inline |
202 | returns Integer; |
203 | |
204 | NivConstr (me) |
205 | ---Purpose: returns NivConstr |
206 | ---C++: inline |
207 | returns Integer; |
208 | |
209 | fields |
210 | myWorkDegree : Integer; |
211 | myNivConstr : Integer; |
212 | myDegree : Integer; |
213 | |
214 | -- the following arrays are used for an optimization of computation in D0-D3 |
215 | myTNorm : HArray1OfReal from TColStd; |
216 | myCofA : HArray1OfReal from TColStd; |
217 | myCofB : HArray1OfReal from TColStd; |
218 | myDenom : HArray1OfReal from TColStd; |
219 | |
220 | end; |
221 | |
222 | |