Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:45:44

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