Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1997-10-22
0002 // Created by: Philippe MANGIN
0003 // Copyright (c) 1997-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_HermitJacobi_HeaderFile
0018 #define _PLib_HermitJacobi_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <math_Matrix.hxx>
0024 #include <TColStd_Array1OfReal.hxx>
0025 #include <PLib_Base.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <GeomAbs_Shape.hxx>
0028 class PLib_JacobiPolynomial;
0029 
0030 
0031 class PLib_HermitJacobi;
0032 DEFINE_STANDARD_HANDLE(PLib_HermitJacobi, 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) = H(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 //! @code
0045 //! c0(1)      c0(2) ....       c0(Dimension)
0046 //! c1(1)      c1(2) ....       c1(Dimension)
0047 //!
0048 //! cDegree(1) cDegree(2) ....  cDegree(Dimension)
0049 //! @endcode
0050 //! The coefficients
0051 //! @code
0052 //! c0(1)                  c0(2) ....            c0(Dimension)
0053 //! c2*ordre+1(1)                ...          c2*ordre+1(dimension)
0054 //! @endcode
0055 //! represents the  part  of the polynomial in  the
0056 //! Hermit's base: H(t)
0057 //! @code
0058 //! H(t) = c0H00(t) + c1H01(t) + ...c(iordre)H(0 ;iorder)+ c(iordre+1)H10(t)+...
0059 //! @endcode
0060 //! The following coefficients represents the part of the
0061 //! polynomial in the Jacobi base ie Q(t)
0062 //! @code
0063 //! Q(t) = c2*iordre+2  J0(t) + ...+ cDegree JDegree-2*iordre-2
0064 //! @endcode
0065 class PLib_HermitJacobi : public PLib_Base
0066 {
0067 
0068 public:
0069 
0070   
0071 
0072   //! Initialize the polynomial class
0073   //! Degree has to be <= 30
0074   //! ConstraintOrder has to be GeomAbs_C0
0075   //! GeomAbs_C1
0076   //! GeomAbs_C2
0077   Standard_EXPORT PLib_HermitJacobi(const Standard_Integer WorkDegree, const GeomAbs_Shape ConstraintOrder);
0078   
0079 
0080   //! This  method computes the  maximum  error on the polynomial
0081   //! W(t) Q(t) obtained by missing the coefficients of JacCoeff from
0082   //! NewDegree +1 to Degree
0083   Standard_EXPORT Standard_Real MaxError (const Standard_Integer Dimension, Standard_Real& HermJacCoeff, const Standard_Integer NewDegree) const;
0084   
0085 
0086   //! Compute NewDegree <= MaxDegree so that MaxError is lower
0087   //! than Tol.
0088   //! MaxError can be greater than Tol if it is not possible
0089   //! to find a NewDegree <= MaxDegree.
0090   //! In this case NewDegree = MaxDegree
0091   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;
0092   
0093   Standard_EXPORT Standard_Real AverageError (const Standard_Integer Dimension, Standard_Real& HermJacCoeff, const Standard_Integer NewDegree) const;
0094   
0095 
0096   //! Convert the polynomial P(t) = H(t) + W(t) Q(t) in the canonical base.
0097   Standard_EXPORT void ToCoefficients (const Standard_Integer Dimension, const Standard_Integer Degree, const TColStd_Array1OfReal& HermJacCoeff, TColStd_Array1OfReal& Coefficients) const Standard_OVERRIDE;
0098   
0099   //! Compute the values of the basis functions in u
0100   Standard_EXPORT void D0 (const Standard_Real U, TColStd_Array1OfReal& BasisValue) Standard_OVERRIDE;
0101   
0102   //! Compute the values and the derivatives values of
0103   //! the basis functions in u
0104   Standard_EXPORT void D1 (const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1) Standard_OVERRIDE;
0105   
0106   //! Compute the values and the derivatives values of
0107   //! the basis functions in u
0108   Standard_EXPORT void D2 (const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1, TColStd_Array1OfReal& BasisD2) Standard_OVERRIDE;
0109   
0110   //! Compute the values and the derivatives values of
0111   //! the basis functions in u
0112   Standard_EXPORT void D3 (const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1, TColStd_Array1OfReal& BasisD2, TColStd_Array1OfReal& BasisD3) Standard_OVERRIDE;
0113   
0114   //! returns WorkDegree
0115   Standard_Integer WorkDegree() const Standard_OVERRIDE;
0116   
0117   //! returns NivConstr
0118   Standard_Integer NivConstr() const;
0119 
0120 
0121 
0122 
0123   DEFINE_STANDARD_RTTIEXT(PLib_HermitJacobi,PLib_Base)
0124 
0125 protected:
0126 
0127 
0128 
0129 
0130 private:
0131 
0132   
0133   //! Compute the values and the derivatives values of
0134   //! the basis functions in u
0135   Standard_EXPORT void D0123 (const Standard_Integer NDerive, const Standard_Real U, TColStd_Array1OfReal& BasisValue, TColStd_Array1OfReal& BasisD1, TColStd_Array1OfReal& BasisD2, TColStd_Array1OfReal& BasisD3);
0136 
0137   math_Matrix myH;
0138   Handle(PLib_JacobiPolynomial) myJacobi;
0139   TColStd_Array1OfReal myWCoeff;
0140 
0141 
0142 };
0143 
0144 
0145 #include <PLib_HermitJacobi.lxx>
0146 
0147 
0148 
0149 
0150 
0151 #endif // _PLib_HermitJacobi_HeaderFile