Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-06 08:35:26

0001 // Created on: 1995-05-29
0002 // Created by: Xavier BENVENISTE
0003 // Copyright (c) 1995-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_ApproxAFunction_HeaderFile
0018 #define _AdvApprox_ApproxAFunction_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 <Standard_Real.hxx>
0027 #include <GeomAbs_Shape.hxx>
0028 #include <Standard_Boolean.hxx>
0029 #include <TColStd_HArray2OfReal.hxx>
0030 #include <TColgp_HArray2OfPnt2d.hxx>
0031 #include <TColgp_HArray2OfPnt.hxx>
0032 #include <TColStd_HArray1OfInteger.hxx>
0033 #include <AdvApprox_EvaluatorFunction.hxx>
0034 #include <TColStd_Array1OfInteger.hxx>
0035 #include <TColStd_Array1OfReal.hxx>
0036 #include <TColgp_Array1OfPnt2d.hxx>
0037 #include <TColgp_Array1OfPnt.hxx>
0038 #include <Standard_OStream.hxx>
0039 class AdvApprox_Cutting;
0040 
0041 //! this approximate a given function
0042 class AdvApprox_ApproxAFunction
0043 {
0044 public:
0045   DEFINE_STANDARD_ALLOC
0046 
0047   //! Constructs approximator tool.
0048   //!
0049   //! Warning:
0050   //! the Func should be valid reference to object of type
0051   //! inherited from class EvaluatorFunction from Approx
0052   //! with life time longer than that of the approximator tool;
0053   //!
0054   //! the result should be formatted in the following way :
0055   //! <--Num1DSS--> <--2 * Num2DSS--> <--3 * Num3DSS-->
0056   //! R[0] ....     R[Num1DSS].....                   R[Dimension-1]
0057   //!
0058   //! the order in which each Subspace appears should be consistent
0059   //! with the tolerances given in the create function and the
0060   //! results will be given in that order as well that is :
0061   //! Curve2d(n)  will correspond to the nth entry
0062   //! described by Num2DSS, Curve(n) will correspond to
0063   //! the nth entry described by Num3DSS
0064   //! The same type of schema applies to the Poles1d, Poles2d and
0065   //! Poles.
0066   Standard_EXPORT AdvApprox_ApproxAFunction(const Standard_Integer               Num1DSS,
0067                                             const Standard_Integer               Num2DSS,
0068                                             const Standard_Integer               Num3DSS,
0069                                             const Handle(TColStd_HArray1OfReal)& OneDTol,
0070                                             const Handle(TColStd_HArray1OfReal)& TwoDTol,
0071                                             const Handle(TColStd_HArray1OfReal)& ThreeDTol,
0072                                             const Standard_Real                  First,
0073                                             const Standard_Real                  Last,
0074                                             const GeomAbs_Shape                  Continuity,
0075                                             const Standard_Integer               MaxDeg,
0076                                             const Standard_Integer               MaxSeg,
0077                                             const AdvApprox_EvaluatorFunction&   Func);
0078 
0079   //! Approximation with user methode of cutting
0080   Standard_EXPORT AdvApprox_ApproxAFunction(const Standard_Integer               Num1DSS,
0081                                             const Standard_Integer               Num2DSS,
0082                                             const Standard_Integer               Num3DSS,
0083                                             const Handle(TColStd_HArray1OfReal)& OneDTol,
0084                                             const Handle(TColStd_HArray1OfReal)& TwoDTol,
0085                                             const Handle(TColStd_HArray1OfReal)& ThreeDTol,
0086                                             const Standard_Real                  First,
0087                                             const Standard_Real                  Last,
0088                                             const GeomAbs_Shape                  Continuity,
0089                                             const Standard_Integer               MaxDeg,
0090                                             const Standard_Integer               MaxSeg,
0091                                             const AdvApprox_EvaluatorFunction&   Func,
0092                                             const AdvApprox_Cutting&             CutTool);
0093 
0094   Standard_EXPORT static void Approximation(const Standard_Integer         TotalDimension,
0095                                             const Standard_Integer         TotalNumSS,
0096                                             const TColStd_Array1OfInteger& LocalDimension,
0097                                             const Standard_Real            First,
0098                                             const Standard_Real            Last,
0099                                             AdvApprox_EvaluatorFunction&   Evaluator,
0100                                             const AdvApprox_Cutting&       CutTool,
0101                                             const Standard_Integer         ContinuityOrder,
0102                                             const Standard_Integer         NumMaxCoeffs,
0103                                             const Standard_Integer         MaxSegments,
0104                                             const TColStd_Array1OfReal&    TolerancesArray,
0105                                             const Standard_Integer         code_precis,
0106                                             Standard_Integer&              NumCurves,
0107                                             TColStd_Array1OfInteger&       NumCoeffPerCurveArray,
0108                                             TColStd_Array1OfReal&          LocalCoefficientArray,
0109                                             TColStd_Array1OfReal&          IntervalsArray,
0110                                             TColStd_Array1OfReal&          ErrorMaxArray,
0111                                             TColStd_Array1OfReal&          AverageErrorArray,
0112                                             Standard_Integer&              ErrorCode);
0113 
0114   Standard_Boolean IsDone() const;
0115 
0116   Standard_Boolean HasResult() const;
0117 
0118   //! returns the poles from the algorithms as is
0119   Handle(TColStd_HArray2OfReal) Poles1d() const;
0120 
0121   //! returns the poles from the algorithms as is
0122   Handle(TColgp_HArray2OfPnt2d) Poles2d() const;
0123 
0124   //! -- returns the poles from the algorithms as is
0125   Handle(TColgp_HArray2OfPnt) Poles() const;
0126 
0127   //! as the name says
0128   Standard_EXPORT Standard_Integer NbPoles() const;
0129 
0130   //! returns the poles at Index from the 1d subspace
0131   Standard_EXPORT void Poles1d(const Standard_Integer Index, TColStd_Array1OfReal& P) const;
0132 
0133   //! returns the poles at Index from the 2d subspace
0134   Standard_EXPORT void Poles2d(const Standard_Integer Index, TColgp_Array1OfPnt2d& P) const;
0135 
0136   //! returns the poles at Index from the 3d subspace
0137   Standard_EXPORT void Poles(const Standard_Integer Index, TColgp_Array1OfPnt& P) const;
0138 
0139   Standard_Integer Degree() const;
0140 
0141   Standard_Integer NbKnots() const;
0142 
0143   Standard_Integer NumSubSpaces(const Standard_Integer Dimension) const;
0144 
0145   Handle(TColStd_HArray1OfReal) Knots() const;
0146 
0147   Handle(TColStd_HArray1OfInteger) Multiplicities() const;
0148 
0149   //! returns the error as is in the algorithms
0150   Standard_EXPORT Handle(TColStd_HArray1OfReal) MaxError(const Standard_Integer Dimension) const;
0151 
0152   //! returns the error as is in the algorithms
0153   Standard_EXPORT Handle(TColStd_HArray1OfReal) AverageError(
0154     const Standard_Integer Dimension) const;
0155 
0156   Standard_EXPORT Standard_Real MaxError(const Standard_Integer Dimension,
0157                                          const Standard_Integer Index) const;
0158 
0159   Standard_EXPORT Standard_Real AverageError(const Standard_Integer Dimension,
0160                                              const Standard_Integer Index) const;
0161 
0162   //! display information on approximation.
0163   Standard_EXPORT void Dump(Standard_OStream& o) const;
0164 
0165 protected:
0166 private:
0167   Standard_EXPORT void Perform(const Standard_Integer   Num1DSS,
0168                                const Standard_Integer   Num2DSS,
0169                                const Standard_Integer   Num3DSS,
0170                                const AdvApprox_Cutting& CutTool);
0171 
0172   Standard_Integer                 myNumSubSpaces[3];
0173   Handle(TColStd_HArray1OfReal)    my1DTolerances;
0174   Handle(TColStd_HArray1OfReal)    my2DTolerances;
0175   Handle(TColStd_HArray1OfReal)    my3DTolerances;
0176   Standard_Real                    myFirst;
0177   Standard_Real                    myLast;
0178   GeomAbs_Shape                    myContinuity;
0179   Standard_Integer                 myMaxDegree;
0180   Standard_Integer                 myMaxSegments;
0181   Standard_Boolean                 myDone;
0182   Standard_Boolean                 myHasResult;
0183   Handle(TColStd_HArray2OfReal)    my1DPoles;
0184   Handle(TColgp_HArray2OfPnt2d)    my2DPoles;
0185   Handle(TColgp_HArray2OfPnt)      my3DPoles;
0186   Handle(TColStd_HArray1OfReal)    myKnots;
0187   Handle(TColStd_HArray1OfInteger) myMults;
0188   Standard_Integer                 myDegree;
0189   Standard_Address                 myEvaluator;
0190   Handle(TColStd_HArray1OfReal)    my1DMaxError;
0191   Handle(TColStd_HArray1OfReal)    my1DAverageError;
0192   Handle(TColStd_HArray1OfReal)    my2DMaxError;
0193   Handle(TColStd_HArray1OfReal)    my2DAverageError;
0194   Handle(TColStd_HArray1OfReal)    my3DMaxError;
0195   Handle(TColStd_HArray1OfReal)    my3DAverageError;
0196 };
0197 
0198 #include <AdvApprox_ApproxAFunction.lxx>
0199 
0200 #endif // _AdvApprox_ApproxAFunction_HeaderFile