42cf5bc1 |
1 | // Created on: 1997-10-22 |
2 | // Created by: Philippe MANGIN |
3 | // Copyright (c) 1997-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_HermitJacobi_HeaderFile |
18 | #define _PLib_HermitJacobi_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <math_Matrix.hxx> |
24 | #include <TColStd_Array1OfReal.hxx> |
25 | #include <PLib_Base.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | #include <GeomAbs_Shape.hxx> |
28 | #include <Standard_Real.hxx> |
29 | class PLib_JacobiPolynomial; |
30 | class Standard_ConstructionError; |
31 | |
32 | |
33 | class PLib_HermitJacobi; |
34 | DEFINE_STANDARD_HANDLE(PLib_HermitJacobi, 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) = H(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 | //! Hermit's base: H(t) |
58 | //! H(t) = c0H00(t) + c1H01(t) + ...c(iordre)H(0 ;iorder)+ c(iordre+1)H10(t)+... |
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_HermitJacobi : 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_HermitJacobi(const Standard_Integer WorkDegree, const GeomAbs_Shape ConstraintOrder); |
75 | |
76 | |
77 | //! This method computes the maximum error on the polynomial |
78 | //! W(t) Q(t) obtained by missing the coefficients of JacCoeff from |
79 | //! NewDegree +1 to Degree |
80 | Standard_EXPORT Standard_Real MaxError (const Standard_Integer Dimension, Standard_Real& HermJacCoeff, const Standard_Integer NewDegree) const; |
81 | |
82 | |
83 | //! Compute NewDegree <= MaxDegree so that MaxError is lower |
84 | //! than Tol. |
85 | //! MaxError can be greater than Tol if it is not possible |
86 | //! to find a NewDegree <= MaxDegree. |
87 | //! In this case NewDegree = MaxDegree |
79104795 |
88 | Standard_EXPORT void ReduceDegree (const Standard_Integer Dimension, const Standard_Integer MaxDegree, const Standard_Real Tol, Standard_Real& HermJacCoeff, Standard_Integer& NewDegree, Standard_Real& MaxError) const Standard_OVERRIDE; |
42cf5bc1 |
89 | |
90 | Standard_EXPORT Standard_Real AverageError (const Standard_Integer Dimension, Standard_Real& HermJacCoeff, const Standard_Integer NewDegree) const; |
91 | |
92 | |
93 | //! Convert the polynomial P(t) = H(t) + W(t) Q(t) in the canonical base. |
79104795 |
94 | Standard_EXPORT void ToCoefficients (const Standard_Integer Dimension, const Standard_Integer Degree, const TColStd_Array1OfReal& HermJacCoeff, TColStd_Array1OfReal& Coefficients) const Standard_OVERRIDE; |
42cf5bc1 |
95 | |
96 | //! Compute the values of the basis functions in u |
79104795 |
97 | Standard_EXPORT void D0 (const Standard_Real U, TColStd_Array1OfReal& BasisValue) Standard_OVERRIDE; |
42cf5bc1 |
98 | |
99 | //! Compute the values and the derivatives values of |
100 | //! the basis functions in u |
79104795 |
101 | Standard_EXPORT void D1 (const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1) Standard_OVERRIDE; |
42cf5bc1 |
102 | |
103 | //! Compute the values and the derivatives values of |
104 | //! the basis functions in u |
79104795 |
105 | Standard_EXPORT void D2 (const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1, TColStd_Array1OfReal& BasisD2) Standard_OVERRIDE; |
42cf5bc1 |
106 | |
107 | //! Compute the values and the derivatives values of |
108 | //! the basis functions in u |
79104795 |
109 | Standard_EXPORT void D3 (const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1, TColStd_Array1OfReal& BasisD2, TColStd_Array1OfReal& BasisD3) Standard_OVERRIDE; |
42cf5bc1 |
110 | |
111 | //! returns WorkDegree |
79104795 |
112 | Standard_Integer WorkDegree() const Standard_OVERRIDE; |
42cf5bc1 |
113 | |
114 | //! returns NivConstr |
79104795 |
115 | Standard_Integer NivConstr() const; |
42cf5bc1 |
116 | |
117 | |
118 | |
119 | |
92efcf78 |
120 | DEFINE_STANDARD_RTTIEXT(PLib_HermitJacobi,PLib_Base) |
42cf5bc1 |
121 | |
122 | protected: |
123 | |
124 | |
125 | |
126 | |
127 | private: |
128 | |
129 | |
130 | //! Compute the values and the derivatives values of |
131 | //! the basis functions in u |
132 | Standard_EXPORT void D0123 (const Standard_Integer NDerive, const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1, TColStd_Array1OfReal& BasisD2, TColStd_Array1OfReal& BasisD3); |
133 | |
134 | math_Matrix myH; |
135 | Handle(PLib_JacobiPolynomial) myJacobi; |
136 | TColStd_Array1OfReal myWCoeff; |
137 | |
138 | |
139 | }; |
140 | |
141 | |
142 | #include <PLib_HermitJacobi.lxx> |
143 | |
144 | |
145 | |
146 | |
147 | |
148 | #endif // _PLib_HermitJacobi_HeaderFile |