Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-29 09:14:21

0001 // Created on: 1996-10-14
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 _AdvApprox_SimpleApprox_HeaderFile
0018 #define _AdvApprox_SimpleApprox_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <TColStd_HArray1OfReal.hxx>
0026 #include <TColStd_HArray2OfReal.hxx>
0027 #include <GeomAbs_Shape.hxx>
0028 #include <AdvApprox_EvaluatorFunction.hxx>
0029 #include <TColStd_Array1OfInteger.hxx>
0030 #include <TColStd_Array1OfReal.hxx>
0031 #include <Standard_OStream.hxx>
0032 class PLib_JacobiPolynomial;
0033 
0034 //! Approximate  a function on   an interval [First,Last]
0035 //! The result  is  a simple  polynomial  whose  degree is  as low as
0036 //! possible  to   satisfy  the required  tolerance  and  the
0037 //! maximum degree.  The maximum  error and the averrage error
0038 //! resulting from  approximating the function by the polynomial are computed
0039 class AdvApprox_SimpleApprox
0040 {
0041 public:
0042   DEFINE_STANDARD_ALLOC
0043 
0044   Standard_EXPORT AdvApprox_SimpleApprox(const Standard_Integer               TotalDimension,
0045                                          const Standard_Integer               TotalNumSS,
0046                                          const GeomAbs_Shape                  Continuity,
0047                                          const Standard_Integer               WorkDegree,
0048                                          const Standard_Integer               NbGaussPoints,
0049                                          const Handle(PLib_JacobiPolynomial)& JacobiBase,
0050                                          const AdvApprox_EvaluatorFunction&   Func);
0051 
0052   //! Constructs approximator tool.
0053   //!
0054   //! Warning:
0055   //! the Func should be valid reference to object of type
0056   //! inherited from class EvaluatorFunction from Approx
0057   //! with life time longer than that of the approximator tool;
0058   Standard_EXPORT void Perform(const TColStd_Array1OfInteger& LocalDimension,
0059                                const TColStd_Array1OfReal&    LocalTolerancesArray,
0060                                const Standard_Real            First,
0061                                const Standard_Real            Last,
0062                                const Standard_Integer         MaxDegree);
0063 
0064   Standard_EXPORT Standard_Boolean IsDone() const;
0065 
0066   Standard_EXPORT Standard_Integer Degree() const;
0067 
0068   //! returns the coefficients in the Jacobi Base
0069   Standard_EXPORT Handle(TColStd_HArray1OfReal) Coefficients() const;
0070 
0071   //! returns the constraints at First
0072   Standard_EXPORT Handle(TColStd_HArray2OfReal) FirstConstr() const;
0073 
0074   //! returns the constraints at Last
0075   Standard_EXPORT Handle(TColStd_HArray2OfReal) LastConstr() const;
0076 
0077   Standard_EXPORT Handle(TColStd_HArray1OfReal) SomTab() const;
0078 
0079   Standard_EXPORT Handle(TColStd_HArray1OfReal) DifTab() const;
0080 
0081   Standard_EXPORT Standard_Real MaxError(const Standard_Integer Index) const;
0082 
0083   Standard_EXPORT Standard_Real AverageError(const Standard_Integer Index) const;
0084 
0085   //! display information on approximation
0086   Standard_EXPORT void Dump(Standard_OStream& o) const;
0087 
0088 protected:
0089 private:
0090   Standard_Integer              myTotalNumSS;
0091   Standard_Integer              myTotalDimension;
0092   Standard_Integer              myNbGaussPoints;
0093   Standard_Integer              myWorkDegree;
0094   Standard_Integer              myNivConstr;
0095   Handle(PLib_JacobiPolynomial) myJacPol;
0096   Handle(TColStd_HArray1OfReal) myTabPoints;
0097   Handle(TColStd_HArray2OfReal) myTabWeights;
0098   Standard_Address              myEvaluator;
0099   Standard_Integer              myDegree;
0100   Handle(TColStd_HArray1OfReal) myCoeff;
0101   Handle(TColStd_HArray2OfReal) myFirstConstr;
0102   Handle(TColStd_HArray2OfReal) myLastConstr;
0103   Handle(TColStd_HArray1OfReal) mySomTab;
0104   Handle(TColStd_HArray1OfReal) myDifTab;
0105   Handle(TColStd_HArray1OfReal) myMaxError;
0106   Handle(TColStd_HArray1OfReal) myAverageError;
0107   Standard_Boolean              done;
0108 };
0109 
0110 #endif // _AdvApprox_SimpleApprox_HeaderFile