Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-27 09:36:53

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 <NCollection_Array1.hxx>
0026 #include <NCollection_HArray1.hxx>
0027 #include <NCollection_Array2.hxx>
0028 #include <NCollection_HArray2.hxx>
0029 #include <GeomAbs_Shape.hxx>
0030 #include <AdvApprox_EvaluatorFunction.hxx>
0031 #include <Standard_OStream.hxx>
0032 #include <PLib_JacobiPolynomial.hxx>
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 average 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 int                          TotalDimension,
0045                                          const int                          TotalNumSS,
0046                                          const GeomAbs_Shape                Continuity,
0047                                          const int                          WorkDegree,
0048                                          const int                          NbGaussPoints,
0049                                          const 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 NCollection_Array1<int>&    LocalDimension,
0059                                const NCollection_Array1<double>& LocalTolerancesArray,
0060                                const double                      First,
0061                                const double                      Last,
0062                                const int                         MaxDegree);
0063 
0064   Standard_EXPORT bool IsDone() const;
0065 
0066   Standard_EXPORT int Degree() const;
0067 
0068   //! returns the coefficients in the Jacobi Base
0069   Standard_EXPORT occ::handle<NCollection_HArray1<double>> Coefficients() const;
0070 
0071   //! returns the constraints at First
0072   Standard_EXPORT occ::handle<NCollection_HArray2<double>> FirstConstr() const;
0073 
0074   //! returns the constraints at Last
0075   Standard_EXPORT occ::handle<NCollection_HArray2<double>> LastConstr() const;
0076 
0077   Standard_EXPORT occ::handle<NCollection_HArray1<double>> SomTab() const;
0078 
0079   Standard_EXPORT occ::handle<NCollection_HArray1<double>> DifTab() const;
0080 
0081   Standard_EXPORT double MaxError(const int Index) const;
0082 
0083   Standard_EXPORT double AverageError(const int Index) const;
0084 
0085   //! display information on approximation
0086   Standard_EXPORT void Dump(Standard_OStream& o) const;
0087 
0088 private:
0089   int                                      myTotalNumSS;
0090   int                                      myTotalDimension;
0091   int                                      myNbGaussPoints;
0092   int                                      myWorkDegree;
0093   int                                      myNivConstr;
0094   PLib_JacobiPolynomial                    myJacPol;
0095   occ::handle<NCollection_HArray1<double>> myTabPoints;
0096   occ::handle<NCollection_HArray2<double>> myTabWeights;
0097   void*                                    myEvaluator;
0098   int                                      myDegree;
0099   occ::handle<NCollection_HArray1<double>> myCoeff;
0100   occ::handle<NCollection_HArray2<double>> myFirstConstr;
0101   occ::handle<NCollection_HArray2<double>> myLastConstr;
0102   occ::handle<NCollection_HArray1<double>> mySomTab;
0103   occ::handle<NCollection_HArray1<double>> myDifTab;
0104   occ::handle<NCollection_HArray1<double>> myMaxError;
0105   occ::handle<NCollection_HArray1<double>> myAverageError;
0106   bool                                     done;
0107 };
0108 
0109 #endif // _AdvApprox_SimpleApprox_HeaderFile