Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:38

0001 // Created on: 1996-10-08
0002 // Created by: Jeannine PANTIATICI
0003 // Copyright (c) 1996-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _PLib_JacobiPolynomial_HeaderFile
0018 #define _PLib_JacobiPolynomial_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <TColStd_HArray1OfReal.hxx>
0025 #include <PLib_Base.hxx>
0026 #include <GeomAbs_Shape.hxx>
0027 #include <TColStd_Array1OfReal.hxx>
0028 #include <TColStd_Array2OfReal.hxx>
0029 
0030 
0031 class PLib_JacobiPolynomial;
0032 DEFINE_STANDARD_HANDLE(PLib_JacobiPolynomial, PLib_Base)
0033 
0034 //! This class provides method  to work with Jacobi  Polynomials
0035 //! relatively to   an order of constraint
0036 //! q  = myWorkDegree-2*(myNivConstr+1)
0037 //! Jk(t)  for k=0,q compose  the   Jacobi Polynomial  base relatively  to  the weigth W(t)
0038 //! iorder is the integer  value for the constraints:
0039 //! iorder = 0 <=> ConstraintOrder  = GeomAbs_C0
0040 //! iorder = 1 <=>  ConstraintOrder = GeomAbs_C1
0041 //! iorder = 2 <=> ConstraintOrder = GeomAbs_C2
0042 //! P(t) = R(t) + W(t) * Q(t) Where W(t) = (1-t**2)**(2*iordre+2)
0043 //! the coefficients JacCoeff represents P(t) JacCoeff are stored as follow:
0044 //!
0045 //! c0(1)      c0(2) ....       c0(Dimension)
0046 //! c1(1)      c1(2) ....       c1(Dimension)
0047 //!
0048 //! cDegree(1) cDegree(2) ....  cDegree(Dimension)
0049 //!
0050 //! The coefficients
0051 //! c0(1)                  c0(2) ....            c0(Dimension)
0052 //! c2*ordre+1(1)                ...          c2*ordre+1(dimension)
0053 //!
0054 //! represents the  part  of the polynomial in  the
0055 //! canonical base: R(t)
0056 //! R(t) = c0 + c1   t + ...+ c2*iordre+1 t**2*iordre+1
0057 //! The following coefficients represents the part of the
0058 //! polynomial in the Jacobi base ie Q(t)
0059 //! Q(t) = c2*iordre+2  J0(t) + ...+ cDegree JDegree-2*iordre-2
0060 class PLib_JacobiPolynomial : public PLib_Base
0061 {
0062 
0063 public:
0064 
0065   
0066 
0067   //! Initialize the polynomial class
0068   //! Degree has to be <= 30
0069   //! ConstraintOrder has to be GeomAbs_C0
0070   //! GeomAbs_C1
0071   //! GeomAbs_C2
0072   Standard_EXPORT PLib_JacobiPolynomial(const Standard_Integer WorkDegree, const GeomAbs_Shape ConstraintOrder);
0073   
0074 
0075   //! returns  the  Jacobi  Points   for  Gauss  integration ie
0076   //! the positive values of the Legendre roots by increasing values
0077   //! NbGaussPoints is the number of   points chosen for the  integral
0078   //! computation.
0079   //! TabPoints (0,NbGaussPoints/2)
0080   //! TabPoints (0) is loaded only for the odd values of NbGaussPoints
0081   //! The possible values for NbGaussPoints are : 8, 10,
0082   //! 15, 20, 25, 30, 35, 40, 50, 61
0083   //! NbGaussPoints must be greater than Degree
0084   Standard_EXPORT void Points (const Standard_Integer NbGaussPoints, TColStd_Array1OfReal& TabPoints) const;
0085   
0086 
0087   //! returns the Jacobi weigths for Gauss integration only for
0088   //! the positive    values of the  Legendre roots   in the order they
0089   //! are given by the method Points
0090   //! NbGaussPoints   is the number of points chosen   for  the integral
0091   //! computation.
0092   //! TabWeights  (0,NbGaussPoints/2,0,Degree)
0093   //! TabWeights (0,.) are only loaded for the odd values of NbGaussPoints
0094   //! The possible values for NbGaussPoints are : 8 , 10 , 15 ,20 ,25 , 30,
0095   //! 35 , 40 , 50 , 61 NbGaussPoints must be greater than Degree
0096   Standard_EXPORT void Weights (const Standard_Integer NbGaussPoints, TColStd_Array2OfReal& TabWeights) const;
0097   
0098 
0099   //! this method loads for k=0,q the maximum value of
0100   //! abs ( W(t)*Jk(t) )for t bellonging to [-1,1]
0101   //! This values are loaded is the array TabMax(0,myWorkDegree-2*(myNivConst+1))
0102   //! MaxValue ( me ; TabMaxPointer : in  out  Real );
0103   Standard_EXPORT void MaxValue (TColStd_Array1OfReal& TabMax) const;
0104   
0105 
0106   //! This  method computes the  maximum  error on the polynomial
0107   //! W(t) Q(t)  obtained  by   missing  the   coefficients of  JacCoeff   from
0108   //! NewDegree +1 to Degree
0109   Standard_EXPORT Standard_Real MaxError (const Standard_Integer Dimension, Standard_Real& JacCoeff, const Standard_Integer NewDegree) const;
0110   
0111 
0112   //! Compute NewDegree <= MaxDegree  so that MaxError is lower
0113   //! than Tol.
0114   //! MaxError can be greater than Tol  if it is not possible
0115   //! to find a NewDegree <= MaxDegree.
0116   //! In this case NewDegree = MaxDegree
0117   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;
0118   
0119   Standard_EXPORT Standard_Real AverageError (const Standard_Integer Dimension, Standard_Real& JacCoeff, const Standard_Integer NewDegree) const;
0120   
0121 
0122   //! Convert the polynomial P(t) = R(t) + W(t) Q(t) in the canonical base.
0123   Standard_EXPORT void ToCoefficients (const Standard_Integer Dimension, const Standard_Integer Degree, const TColStd_Array1OfReal& JacCoeff, TColStd_Array1OfReal& Coefficients) const Standard_OVERRIDE;
0124   
0125   //! Compute the values of the basis functions in u
0126   Standard_EXPORT void D0 (const Standard_Real U, TColStd_Array1OfReal& BasisValue) Standard_OVERRIDE;
0127   
0128   //! Compute the values and the derivatives values of
0129   //! the basis functions in u
0130   Standard_EXPORT void D1 (const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1) Standard_OVERRIDE;
0131   
0132   //! Compute the values and the derivatives values of
0133   //! the basis functions in u
0134   Standard_EXPORT void D2 (const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1, TColStd_Array1OfReal& BasisD2) Standard_OVERRIDE;
0135   
0136   //! Compute the values and the derivatives values of
0137   //! the basis functions in u
0138   Standard_EXPORT void D3 (const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1, TColStd_Array1OfReal& BasisD2, TColStd_Array1OfReal& BasisD3) Standard_OVERRIDE;
0139   
0140   //! returns WorkDegree
0141   Standard_Integer WorkDegree() const Standard_OVERRIDE;
0142   
0143   //! returns NivConstr
0144   Standard_Integer NivConstr() const;
0145 
0146 
0147 
0148 
0149   DEFINE_STANDARD_RTTIEXT(PLib_JacobiPolynomial,PLib_Base)
0150 
0151 protected:
0152 
0153 
0154 
0155 
0156 private:
0157 
0158   
0159   //! Compute the values and the derivatives values of
0160   //! the basis functions in u
0161   Standard_EXPORT void D0123 (const Standard_Integer NDerive, const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1, TColStd_Array1OfReal& BasisD2, TColStd_Array1OfReal& BasisD3);
0162 
0163   Standard_Integer myWorkDegree;
0164   Standard_Integer myNivConstr;
0165   Standard_Integer myDegree;
0166   Handle(TColStd_HArray1OfReal) myTNorm;
0167   Handle(TColStd_HArray1OfReal) myCofA;
0168   Handle(TColStd_HArray1OfReal) myCofB;
0169   Handle(TColStd_HArray1OfReal) myDenom;
0170 
0171 
0172 };
0173 
0174 
0175 #include <PLib_JacobiPolynomial.lxx>
0176 
0177 
0178 
0179 
0180 
0181 #endif // _PLib_JacobiPolynomial_HeaderFile