Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-24 09:16:58

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 
0022 #include <NCollection_Array1.hxx>
0023 #include <Standard_Integer.hxx>
0024 #include <GeomAbs_Shape.hxx>
0025 #include <PLib_JacobiPolynomial.hxx>
0026 
0027 //! This class provides method to work with Jacobi Polynomials
0028 //! relatively to an order of constraint
0029 //! q = myWorkDegree-2*(myNivConstr+1)
0030 //! Jk(t) for k=0,q compose the Jacobi Polynomial base relatively to the weight W(t)
0031 //! iorder is the integer value for the constraints:
0032 //! iorder = 0 <=> ConstraintOrder = GeomAbs_C0
0033 //! iorder = 1 <=> ConstraintOrder = GeomAbs_C1
0034 //! iorder = 2 <=> ConstraintOrder = GeomAbs_C2
0035 //! P(t) = H(t) + W(t) * Q(t) Where W(t) = (1-t**2)**(2*iordre+2)
0036 //! the coefficients JacCoeff represents P(t) JacCoeff are stored as follow:
0037 //! @code
0038 //! c0(1)      c0(2) ....       c0(Dimension)
0039 //! c1(1)      c1(2) ....       c1(Dimension)
0040 //!
0041 //! cDegree(1) cDegree(2) ....  cDegree(Dimension)
0042 //! @endcode
0043 //! The coefficients
0044 //! @code
0045 //! c0(1)                  c0(2) ....            c0(Dimension)
0046 //! c2*ordre+1(1)                ...          c2*ordre+1(dimension)
0047 //! @endcode
0048 //! represents the part of the polynomial in the
0049 //! Hermit's base: H(t)
0050 //! @code
0051 //! H(t) = c0H00(t) + c1H01(t) + ...c(iordre)H(0 ;iorder)+ c(iordre+1)H10(t)+...
0052 //! @endcode
0053 //! The following coefficients represents the part of the
0054 //! polynomial in the Jacobi base ie Q(t)
0055 //! @code
0056 //! Q(t) = c2*iordre+2  J0(t) + ...+ cDegree JDegree-2*iordre-2
0057 //! @endcode
0058 class PLib_HermitJacobi
0059 {
0060 
0061 public:
0062   //! Initialize the polynomial class
0063   //! Degree has to be <= 30
0064   //! ConstraintOrder has to be GeomAbs_C0
0065   //! GeomAbs_C1
0066   //! GeomAbs_C2
0067   Standard_EXPORT PLib_HermitJacobi(const int WorkDegree, const GeomAbs_Shape ConstraintOrder);
0068 
0069   //! This method computes the maximum error on the polynomial
0070   //! W(t) Q(t) obtained by missing the coefficients of JacCoeff from
0071   //! NewDegree +1 to Degree
0072   Standard_EXPORT double MaxError(const int Dimension,
0073                                   double&   HermJacCoeff,
0074                                   const int NewDegree) const;
0075 
0076   //! Compute NewDegree <= MaxDegree so that MaxError is lower
0077   //! than Tol.
0078   //! MaxError can be greater than Tol if it is not possible
0079   //! to find a NewDegree <= MaxDegree.
0080   //! In this case NewDegree = MaxDegree
0081   Standard_EXPORT void ReduceDegree(const int    Dimension,
0082                                     const int    MaxDegree,
0083                                     const double Tol,
0084                                     double&      HermJacCoeff,
0085                                     int&         NewDegree,
0086                                     double&      MaxError) const;
0087 
0088   Standard_EXPORT double AverageError(const int Dimension,
0089                                       double&   HermJacCoeff,
0090                                       const int NewDegree) const;
0091 
0092   //! Convert the polynomial P(t) = H(t) + W(t) Q(t) in the canonical base.
0093   Standard_EXPORT void ToCoefficients(const int                         Dimension,
0094                                       const int                         Degree,
0095                                       const NCollection_Array1<double>& HermJacCoeff,
0096                                       NCollection_Array1<double>&       Coefficients) const;
0097 
0098   //! Compute the values of the basis functions in u
0099   Standard_EXPORT void D0(const double U, NCollection_Array1<double>& BasisValue) const;
0100 
0101   //! Compute the values and the derivatives values of
0102   //! the basis functions in u
0103   Standard_EXPORT void D1(const double                U,
0104                           NCollection_Array1<double>& BasisValue,
0105                           NCollection_Array1<double>& BasisD1) const;
0106 
0107   //! Compute the values and the derivatives values of
0108   //! the basis functions in u
0109   Standard_EXPORT void D2(const double                U,
0110                           NCollection_Array1<double>& BasisValue,
0111                           NCollection_Array1<double>& BasisD1,
0112                           NCollection_Array1<double>& BasisD2) const;
0113 
0114   //! Compute the values and the derivatives values of
0115   //! the basis functions in u
0116   Standard_EXPORT void D3(const double                U,
0117                           NCollection_Array1<double>& BasisValue,
0118                           NCollection_Array1<double>& BasisD1,
0119                           NCollection_Array1<double>& BasisD2,
0120                           NCollection_Array1<double>& BasisD3) const;
0121 
0122   //! returns WorkDegree
0123   int WorkDegree() const noexcept { return myJacobi.WorkDegree(); }
0124 
0125   //! returns NivConstr
0126   int NivConstr() const noexcept { return myJacobi.NivConstr(); }
0127 
0128 protected:
0129   //! Compute the values and the derivatives values of
0130   //! the basis functions in u
0131   Standard_EXPORT void D0123(const int                   NDerive,
0132                              const double                U,
0133                              NCollection_Array1<double>& BasisValue,
0134                              NCollection_Array1<double>& BasisD1,
0135                              NCollection_Array1<double>& BasisD2,
0136                              NCollection_Array1<double>& BasisD3) const;
0137 
0138 private:
0139   const PLib_JacobiPolynomial myJacobi;
0140 };
0141 
0142 #endif // _PLib_HermitJacobi_HeaderFile