0026912: CLang 3.6.2 compiler warning [-Winconsistent-missing-override]
[occt.git] / src / PLib / PLib_JacobiPolynomial.hxx
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
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 #ifndef _PLib_JacobiPolynomial_HeaderFile
18 #define _PLib_JacobiPolynomial_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Integer.hxx>
24 #include <TColStd_HArray1OfReal.hxx>
25 #include <PLib_Base.hxx>
26 #include <GeomAbs_Shape.hxx>
27 #include <TColStd_Array1OfReal.hxx>
28 #include <TColStd_Array2OfReal.hxx>
29 #include <Standard_Real.hxx>
30 class Standard_ConstructionError;
31
32
33 class PLib_JacobiPolynomial;
34 DEFINE_STANDARD_HANDLE(PLib_JacobiPolynomial, PLib_Base)
35
36 //! This class provides method  to work with Jacobi  Polynomials
37 //! relativly to   an order of constraint
38 //! q  = myWorkDegree-2*(myNivConstr+1)
39 //! Jk(t)  for k=0,q compose  the   Jacobi Polynomial  base relativly  to  the weigth W(t)
40 //! iorder is the integer  value for the constraints:
41 //! iorder = 0 <=> ConstraintOrder  = GeomAbs_C0
42 //! iorder = 1 <=>  ConstraintOrder = GeomAbs_C1
43 //! iorder = 2 <=> ConstraintOrder = GeomAbs_C2
44 //! P(t) = R(t) + W(t) * Q(t) Where W(t) = (1-t**2)**(2*iordre+2)
45 //! the coefficients JacCoeff represents P(t) JacCoeff are stored as follow:
46 //!
47 //! c0(1)      c0(2) ....       c0(Dimension)
48 //! c1(1)      c1(2) ....       c1(Dimension)
49 //!
50 //! cDegree(1) cDegree(2) ....  cDegree(Dimension)
51 //!
52 //! The coefficients
53 //! c0(1)                  c0(2) ....            c0(Dimension)
54 //! c2*ordre+1(1)                ...          c2*ordre+1(dimension)
55 //!
56 //! represents the  part  of the polynomial in  the
57 //! canonical base: R(t)
58 //! R(t) = c0 + c1   t + ...+ c2*iordre+1 t**2*iordre+1
59 //! The following coefficients represents the part of the
60 //! polynomial in the Jacobi base ie Q(t)
61 //! Q(t) = c2*iordre+2  J0(t) + ...+ cDegree JDegree-2*iordre-2
62 class PLib_JacobiPolynomial : public PLib_Base
63 {
64
65 public:
66
67   
68
69   //! Initialize the polynomial class
70   //! Degree has to be <= 30
71   //! ConstraintOrder has to be GeomAbs_C0
72   //! GeomAbs_C1
73   //! GeomAbs_C2
74   Standard_EXPORT PLib_JacobiPolynomial(const Standard_Integer WorkDegree, const GeomAbs_Shape ConstraintOrder);
75   
76
77   //! returns  the  Jacobi  Points   for  Gauss  integration ie
78   //! the positive values of the Legendre roots by increasing values
79   //! NbGaussPoints is the number of   points choosen for the  integral
80   //! computation.
81   //! TabPoints (0,NbGaussPoints/2)
82   //! TabPoints (0) is loaded only for the odd values of NbGaussPoints
83   //! The possible values for NbGaussPoints are : 8, 10,
84   //! 15, 20, 25, 30, 35, 40, 50, 61
85   //! NbGaussPoints must be greater than Degree
86   Standard_EXPORT void Points (const Standard_Integer NbGaussPoints, TColStd_Array1OfReal& TabPoints) const;
87   
88
89   //! returns the Jacobi weigths for Gauss integration only for
90   //! the positive    values of the  Legendre roots   in the order they
91   //! are given by the method Points
92   //! NbGaussPoints   is the number of points choosen   for  the integral
93   //! computation.
94   //! TabWeights  (0,NbGaussPoints/2,0,Degree)
95   //! TabWeights (0,.) are only loaded for the odd values of NbGaussPoints
96   //! The possible values for NbGaussPoints are : 8 , 10 , 15 ,20 ,25 , 30,
97   //! 35 , 40 , 50 , 61 NbGaussPoints must be greater than Degree
98   Standard_EXPORT void Weights (const Standard_Integer NbGaussPoints, TColStd_Array2OfReal& TabWeights) const;
99   
100
101   //! this method loads for k=0,q the maximum value of
102   //! abs ( W(t)*Jk(t) )for t bellonging to [-1,1]
103   //! This values are loaded is the array TabMax(0,myWorkDegree-2*(myNivConst+1))
104   //! MaxValue ( me ; TabMaxPointer : in  out  Real );
105   Standard_EXPORT void MaxValue (TColStd_Array1OfReal& TabMax) const;
106   
107
108   //! This  method computes the  maximum  error on the polynomial
109   //! W(t) Q(t)  obtained  by   missing  the   coefficients of  JacCoeff   from
110   //! NewDegree +1 to Degree
111   Standard_EXPORT Standard_Real MaxError (const Standard_Integer Dimension, Standard_Real& JacCoeff, const Standard_Integer NewDegree) const;
112   
113
114   //! Compute NewDegree <= MaxDegree  so that MaxError is lower
115   //! than Tol.
116   //! MaxError can be greater than Tol  if it is not possible
117   //! to find a NewDegree <= MaxDegree.
118   //! In this case NewDegree = MaxDegree
119   Standard_EXPORT void ReduceDegree (const Standard_Integer Dimension, const Standard_Integer MaxDegree, const Standard_Real Tol, Standard_Real& JacCoeff, Standard_Integer& NewDegree, Standard_Real& MaxError) const Standard_OVERRIDE;
120   
121   Standard_EXPORT Standard_Real AverageError (const Standard_Integer Dimension, Standard_Real& JacCoeff, const Standard_Integer NewDegree) const;
122   
123
124   //! Convert the polynomial P(t) = R(t) + W(t) Q(t) in the canonical base.
125   Standard_EXPORT void ToCoefficients (const Standard_Integer Dimension, const Standard_Integer Degree, const TColStd_Array1OfReal& JacCoeff, TColStd_Array1OfReal& Coefficients) const Standard_OVERRIDE;
126   
127   //! Compute the values of the basis functions in u
128   Standard_EXPORT void D0 (const Standard_Real U, TColStd_Array1OfReal& BasisValue) Standard_OVERRIDE;
129   
130   //! Compute the values and the derivatives values of
131   //! the basis functions in u
132   Standard_EXPORT void D1 (const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1) Standard_OVERRIDE;
133   
134   //! Compute the values and the derivatives values of
135   //! the basis functions in u
136   Standard_EXPORT void D2 (const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1, TColStd_Array1OfReal& BasisD2) Standard_OVERRIDE;
137   
138   //! Compute the values and the derivatives values of
139   //! the basis functions in u
140   Standard_EXPORT void D3 (const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1, TColStd_Array1OfReal& BasisD2, TColStd_Array1OfReal& BasisD3) Standard_OVERRIDE;
141   
142   //! returns WorkDegree
143   Standard_Integer WorkDegree() const Standard_OVERRIDE;
144   
145   //! returns NivConstr
146   Standard_Integer NivConstr() const;
147
148
149
150
151   DEFINE_STANDARD_RTTI(PLib_JacobiPolynomial,PLib_Base)
152
153 protected:
154
155
156
157
158 private:
159
160   
161   //! Compute the values and the derivatives values of
162   //! the basis functions in u
163   Standard_EXPORT void D0123 (const Standard_Integer NDerive, const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1, TColStd_Array1OfReal& BasisD2, TColStd_Array1OfReal& BasisD3);
164
165   Standard_Integer myWorkDegree;
166   Standard_Integer myNivConstr;
167   Standard_Integer myDegree;
168   Handle(TColStd_HArray1OfReal) myTNorm;
169   Handle(TColStd_HArray1OfReal) myCofA;
170   Handle(TColStd_HArray1OfReal) myCofB;
171   Handle(TColStd_HArray1OfReal) myDenom;
172
173
174 };
175
176
177 #include <PLib_JacobiPolynomial.lxx>
178
179
180
181
182
183 #endif // _PLib_JacobiPolynomial_HeaderFile