CommitLineData
42cf5bc1 1// Created on: 1996-10-14
2// Created by: Jeannine PANTIATICI
3// Copyright (c) 1996-1999 Matra Datavision
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Integer.hxx>
25#include <TColStd_HArray1OfReal.hxx>
26#include <TColStd_HArray2OfReal.hxx>
28#include <Standard_Boolean.hxx>
29#include <GeomAbs_Shape.hxx>
31#include <TColStd_Array1OfInteger.hxx>
32#include <TColStd_Array1OfReal.hxx>
33#include <Standard_Real.hxx>
34#include <Standard_OStream.hxx>
35class PLib_JacobiPolynomial;
36class Standard_OutOfRange;
37class Standard_ConstructionError;
38
39
40//! Approximate a function on an intervall [First,Last]
41//! The result is a simple polynomial whose degree is as low as
42//! possible to satisfy the required tolerance and the
43//! maximum degree. The maximum error and the averrage error
44//! resulting from approximating the function by the polynomial are computed
46{
47public:
48
49 DEFINE_STANDARD_ALLOC
50
51
52 Standard_EXPORT AdvApprox_SimpleApprox(const Standard_Integer TotalDimension, const Standard_Integer TotalNumSS, const GeomAbs_Shape Continuity, const Standard_Integer WorkDegree, const Standard_Integer NbGaussPoints, const Handle(PLib_JacobiPolynomial)& JacobiBase, const AdvApprox_EvaluatorFunction& Func);
53
54 //! Constructs approximator tool.
55 //!
56 //! Warning:
57 //! the Func should be valid reference to object of type
58 //! inherited from class EvaluatorFunction from Approx
59 //! with life time longer than that of the approximator tool;
60 Standard_EXPORT void Perform (const TColStd_Array1OfInteger& LocalDimension, const TColStd_Array1OfReal& LocalTolerancesArray, const Standard_Real First, const Standard_Real Last, const Standard_Integer MaxDegree);
61
62 Standard_EXPORT Standard_Boolean IsDone() const;
63
64 Standard_EXPORT Standard_Integer Degree() const;
65
66 //! returns the coefficients in the Jacobi Base
67 Standard_EXPORT Handle(TColStd_HArray1OfReal) Coefficients() const;
68
69 //! returns the constraints at First
70 Standard_EXPORT Handle(TColStd_HArray2OfReal) FirstConstr() const;
71
72 //! returns the constraints at Last
73 Standard_EXPORT Handle(TColStd_HArray2OfReal) LastConstr() const;
74
75 Standard_EXPORT Handle(TColStd_HArray1OfReal) SomTab() const;
76
77 Standard_EXPORT Handle(TColStd_HArray1OfReal) DifTab() const;
78
79 Standard_EXPORT Standard_Real MaxError (const Standard_Integer Index) const;
80
81 Standard_EXPORT Standard_Real AverageError (const Standard_Integer Index) const;
82
83 //! display information on approximation
84 Standard_EXPORT void Dump (Standard_OStream& o) const;
85
86
87
88
89protected:
90
91
92
93
94
95private:
96
97
98
99 Standard_Integer myTotalNumSS;
100 Standard_Integer myTotalDimension;
101 Standard_Integer myNbGaussPoints;
102 Standard_Integer myWorkDegree;
103 Standard_Integer myNivConstr;
104 Handle(PLib_JacobiPolynomial) myJacPol;
105 Handle(TColStd_HArray1OfReal) myTabPoints;
106 Handle(TColStd_HArray2OfReal) myTabWeights;
108 Standard_Integer myDegree;
109 Handle(TColStd_HArray1OfReal) myCoeff;
110 Handle(TColStd_HArray2OfReal) myFirstConstr;
111 Handle(TColStd_HArray2OfReal) myLastConstr;
112 Handle(TColStd_HArray1OfReal) mySomTab;
113 Handle(TColStd_HArray1OfReal) myDifTab;
114 Handle(TColStd_HArray1OfReal) myMaxError;
115 Handle(TColStd_HArray1OfReal) myAverageError;
116 Standard_Boolean done;
117
118
119};
120
121
122
123
124
125
126