1 -- Created on: 1996-10-08
2 -- Created by: Jeannine PANTIATICI
3 -- Copyright (c) 1996-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class JacobiPolynomial from PLib
19 inherits Base from PLib
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:
32 -- c0(1) c0(2) .... c0(Dimension)
33 -- c1(1) c1(2) .... c1(Dimension)
37 -- cDegree(1) cDegree(2) .... cDegree(Dimension)
40 -- c0(1) c0(2) .... c0(Dimension)
41 -- c2*ordre+1(1) ... c2*ordre+1(dimension)
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
52 Array2OfReal from TColStd,
53 Array1OfReal from TColStd,
54 HArray1OfReal from TColStd,
58 ConstructionError from Standard
62 -- Create returns JacobiPolynomial from PLib;
64 Create ( WorkDegree : Integer ;
65 ConstraintOrder : Shape from GeomAbs)
66 returns JacobiPolynomial from PLib
70 -- Initialize the polynomial class
71 -- Degree has to be <= 30
72 -- ConstraintOrder has to be GeomAbs_C0
76 raises ConstructionError from Standard;
77 -- if Degree or ConstraintOrder is non valid
80 -- Jacobi characteristics
82 Points ( me ; NbGaussPoints : Integer ;
83 TabPoints : out Array1OfReal from TColStd )
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
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
95 raises ConstructionError from Standard;
96 -- Invalid NbGaussPoints
98 Weights (me ; NbGaussPoints : Integer ;
99 TabWeights : out Array2OfReal from TColStd )
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
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
112 raises ConstructionError from Standard;
113 -- Invalid NbGaussPoints
115 MaxValue ( me ; TabMax : out Array1OfReal from TColStd );
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 );
123 -- Work in Jacobi base
125 MaxError ( me ; Dimension : Integer ;
126 JacCoeff : in out Real;
127 NewDegree : Integer )
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
135 ReduceDegree ( me ; Dimension , MaxDegree : Integer ; Tol : Real ;
136 JacCoeff : in out Real;
137 NewDegree : out Integer ;
138 MaxError : out Real);
141 -- Compute NewDegree <= MaxDegree so that MaxError is lower
143 -- MaxError can be greater than Tol if it is not possible
144 -- to find a NewDegree <= MaxDegree.
145 -- In this case NewDegree = MaxDegree
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
156 ToCoefficients ( me ; Dimension, Degree : Integer ;
157 JacCoeff : Array1OfReal from TColStd ;
158 Coefficients : out Array1OfReal from TColStd );
161 -- Convert the polynomial P(t) = R(t) + W(t) Q(t) in the canonical base.
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
173 D0 (me : mutable; U : Real;
174 BasisValue : out Array1OfReal from TColStd);
175 ---Purpose: Compute the values of the basis functions in u
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
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
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
200 ---Purpose: returns WorkDegree
205 ---Purpose: returns NivConstr
210 myWorkDegree : Integer;
211 myNivConstr : Integer;
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;