Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:53

0001 // Created on: 1996-02-14
0002 // Created by: Joelle CHAUVET
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 _AdvApp2Var_ApproxAFunc2Var_HeaderFile
0018 #define _AdvApp2Var_ApproxAFunc2Var_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 <AdvApp2Var_Context.hxx>
0028 #include <AdvApp2Var_Network.hxx>
0029 #include <AdvApp2Var_Framework.hxx>
0030 #include <Standard_Boolean.hxx>
0031 #include <TColGeom_HArray1OfSurface.hxx>
0032 #include <AdvApp2Var_EvaluatorFunc2Var.hxx>
0033 #include <Standard_OStream.hxx>
0034 class AdvApprox_Cutting;
0035 class AdvApp2Var_Criterion;
0036 class Geom_BSplineSurface;
0037 
0038 
0039 //! Perform   the  approximation of  <Func>     F(U,V)
0040 //! Arguments are :
0041 //! Num1DSS, Num2DSS, Num3DSS :The numbers of 1,2,3 dimensional subspaces
0042 //! OneDTol, TwoDTol, ThreeDTol: The tolerance of approximation in each
0043 //! subspaces
0044 //! OneDTolFr, TwoDTolFr, ThreeDTolFr: The tolerance of approximation on
0045 //! the boundarys in each subspaces
0046 //! [FirstInU, LastInU]: The Bounds in U of the Approximation
0047 //! [FirstInV, LastInV]: The Bounds in V of the Approximation
0048 //! FavorIso : Give preference to extract u-iso or v-iso on F(U,V)
0049 //! This can be useful to optimize the <Func> method
0050 //! ContInU, ContInV : Continuity waiting in u and v
0051 //! PrecisCode : Precision on approximation's error mesurement
0052 //! 1 : Fast computation and average precision
0053 //! 2 : Average computation and good precision
0054 //! 3 : Slow computation and very good precision
0055 //! MaxDegInU : Maximum u-degree waiting in U
0056 //! MaxDegInV : Maximum u-degree waiting in V
0057 //! Warning:
0058 //! MaxDegInU (resp. MaxDegInV) must be >= 2*iu (resp. iv) + 1,
0059 //! where iu (resp. iv) = 0 if ContInU (resp. ContInV)  = GeomAbs_C0,
0060 //! = 1 if                          = GeomAbs_C1,
0061 //! = 2 if                          = GeomAbs_C2.
0062 //! MaxPatch  : Maximum number of Patch waiting
0063 //! number of Patch is number of u span * number of v span
0064 //! Func      : The external method to evaluate F(U,V)
0065 //! Crit      : To (re)defined condition of convergence
0066 //! UChoice, VChoice : To define the way in U (or V) Knot insertion
0067 //! Warning:
0068 //! for the moment, the result is a 3D Surface
0069 //! so Num1DSS and Num2DSS must be equals to 0
0070 //! and Num3DSS must be equal to 1.
0071 //! Warning:
0072 //! the Function of type EvaluatorFunc2Var from Approx
0073 //! must be a subclass of AdvApp2Var_EvaluatorFunc2Var
0074 //!
0075 //! the result should be formatted in the following way :
0076 //! <--Num1DSS--> <--2 * Num2DSS--> <--3 * Num3DSS-->
0077 //! R[0,0] ....   R[Num1DSS,0].....  R[Dimension-1,0] for the 1st parameter
0078 //! R[0,i] ....   R[Num1DSS,i].....  R[Dimension-1,i] for the ith parameter
0079 //! R[0,N-1] .... R[Num1DSS,N-1].... R[Dimension-1,N-1] for the Nth parameter
0080 //!
0081 //! the order in which each Subspace appears should be consistent
0082 //! with the tolerances given in the create function and the
0083 //! results will be given in that order as well that is :
0084 //! Surface(n) will correspond to the nth entry described by Num3DSS
0085 class AdvApp2Var_ApproxAFunc2Var 
0086 {
0087 public:
0088 
0089   DEFINE_STANDARD_ALLOC
0090 
0091   
0092   Standard_EXPORT AdvApp2Var_ApproxAFunc2Var(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 Handle(TColStd_HArray2OfReal)& OneDTolFr, const Handle(TColStd_HArray2OfReal)& TwoDTolFr, const Handle(TColStd_HArray2OfReal)& ThreeDTolFr, const Standard_Real FirstInU, const Standard_Real LastInU, const Standard_Real FirstInV, const Standard_Real LastInV, const GeomAbs_IsoType FavorIso, const GeomAbs_Shape ContInU, const GeomAbs_Shape ContInV, const Standard_Integer PrecisCode, const Standard_Integer MaxDegInU, const Standard_Integer MaxDegInV, const Standard_Integer MaxPatch, const AdvApp2Var_EvaluatorFunc2Var& Func, AdvApprox_Cutting& UChoice, AdvApprox_Cutting& VChoice);
0093   
0094   Standard_EXPORT AdvApp2Var_ApproxAFunc2Var(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 Handle(TColStd_HArray2OfReal)& OneDTolFr, const Handle(TColStd_HArray2OfReal)& TwoDTolFr, const Handle(TColStd_HArray2OfReal)& ThreeDTolFr, const Standard_Real FirstInU, const Standard_Real LastInU, const Standard_Real FirstInV, const Standard_Real LastInV, const GeomAbs_IsoType FavorIso, const GeomAbs_Shape ContInU, const GeomAbs_Shape ContInV, const Standard_Integer PrecisCode, const Standard_Integer MaxDegInU, const Standard_Integer MaxDegInV, const Standard_Integer MaxPatch, const AdvApp2Var_EvaluatorFunc2Var& Func, const AdvApp2Var_Criterion& Crit, AdvApprox_Cutting& UChoice, AdvApprox_Cutting& VChoice);
0095   
0096   //! True if the approximation succeeded within the imposed
0097   //! tolerances and the wished continuities
0098     Standard_Boolean IsDone() const;
0099   
0100   //! True if the approximation did come out with a result that
0101   //! is not NECESSARELY within the required tolerance or a result
0102   //! that is not recognized with the wished continuities
0103     Standard_Boolean HasResult() const;
0104   
0105   //! returns the BSplineSurface of range Index
0106     Handle(Geom_BSplineSurface) Surface (const Standard_Integer Index) const;
0107   
0108     Standard_Integer UDegree() const;
0109   
0110     Standard_Integer VDegree() const;
0111   
0112     Standard_Integer NumSubSpaces (const Standard_Integer Dimension) const;
0113   
0114   //! returns the errors max
0115   Standard_EXPORT Handle(TColStd_HArray1OfReal) MaxError (const Standard_Integer Dimension) const;
0116   
0117   //! returns the average errors
0118   Standard_EXPORT Handle(TColStd_HArray1OfReal) AverageError (const Standard_Integer Dimension) const;
0119   
0120   //! returns the errors max on UFrontiers
0121   //! Warning:
0122   //! Dimension must be equal to 3.
0123   Standard_EXPORT Handle(TColStd_HArray1OfReal) UFrontError (const Standard_Integer Dimension) const;
0124   
0125   //! returns the errors max on VFrontiers
0126   //! Warning:
0127   //! Dimension must be equal to 3.
0128   Standard_EXPORT Handle(TColStd_HArray1OfReal) VFrontError (const Standard_Integer Dimension) const;
0129   
0130   //! returns the error max of the BSplineSurface of range Index
0131   Standard_EXPORT Standard_Real MaxError (const Standard_Integer Dimension, const Standard_Integer Index) const;
0132   
0133   //! returns the average error of the BSplineSurface of range Index
0134   Standard_EXPORT Standard_Real AverageError (const Standard_Integer Dimension, const Standard_Integer Index) const;
0135   
0136   //! returns the error max of the BSplineSurface of range Index on a UFrontier
0137   Standard_EXPORT Standard_Real UFrontError (const Standard_Integer Dimension, const Standard_Integer Index) const;
0138   
0139   //! returns the error max of the BSplineSurface of range Index on a VFrontier
0140   Standard_EXPORT Standard_Real VFrontError (const Standard_Integer Dimension, const Standard_Integer Index) const;
0141   
0142   Standard_EXPORT Standard_Real CritError (const Standard_Integer Dimension, const Standard_Integer Index) const;
0143   
0144   //! Prints on the stream 'o' information on the current state
0145   //! of the object.
0146   Standard_EXPORT void Dump (Standard_OStream& o) const;
0147 
0148 
0149 
0150 
0151 protected:
0152 
0153 
0154 
0155 
0156 
0157 private:
0158 
0159   
0160   //! Initialisation of the approximation ; used by Create
0161   Standard_EXPORT void Init();
0162   
0163   //! Initialisation of the approximation with a grid of regular cuttings ;
0164   //! used by Init and Perform
0165   Standard_EXPORT void InitGrid (const Standard_Integer NbInt);
0166   
0167   //! Computation of the approximation result ; used by Create
0168   Standard_EXPORT void Perform (const AdvApprox_Cutting& UChoice, const AdvApprox_Cutting& VChoice, const AdvApp2Var_EvaluatorFunc2Var& Func);
0169   
0170   //! Computation of the approximation result ; used by Create
0171   Standard_EXPORT void Perform (const AdvApprox_Cutting& UChoice, const AdvApprox_Cutting& VChoice, const AdvApp2Var_EvaluatorFunc2Var& Func, const AdvApp2Var_Criterion& Crit);
0172   
0173   //! Computation of the polynomial approximations ; used by Perform
0174   Standard_EXPORT void ComputePatches (const AdvApprox_Cutting& UChoice, const AdvApprox_Cutting& VChoice, const AdvApp2Var_EvaluatorFunc2Var& Func);
0175   
0176   //! Computation of the polynomial approximations ; used by Perform
0177   Standard_EXPORT void ComputePatches (const AdvApprox_Cutting& UChoice, const AdvApprox_Cutting& VChoice, const AdvApp2Var_EvaluatorFunc2Var& Func, const AdvApp2Var_Criterion& Crit);
0178   
0179   //! Approximation of the constraints ; used by ComputePatches
0180   Standard_EXPORT void ComputeConstraints (const AdvApprox_Cutting& UChoice, const AdvApprox_Cutting& VChoice, const AdvApp2Var_EvaluatorFunc2Var& Func);
0181   
0182   //! Approximation of the constraints ; used by ComputePatches
0183   Standard_EXPORT void ComputeConstraints (const AdvApprox_Cutting& UChoice, const AdvApprox_Cutting& VChoice, const AdvApp2Var_EvaluatorFunc2Var& Func, const AdvApp2Var_Criterion& Crit);
0184   
0185   //! Computation of the 3D errors on the approximation result ; used by Perform
0186   Standard_EXPORT void Compute3DErrors();
0187   
0188   //! Computation of the max value of the criterion on the approximation result ;
0189   //! used by Perform
0190   Standard_EXPORT void ComputeCritError();
0191   
0192   //! Conversion of the approximation result in BSpline; used by Create
0193   Standard_EXPORT void ConvertBS();
0194 
0195 
0196   Standard_Integer myNumSubSpaces[3];
0197   Handle(TColStd_HArray1OfReal) my1DTolerances;
0198   Handle(TColStd_HArray1OfReal) my2DTolerances;
0199   Handle(TColStd_HArray1OfReal) my3DTolerances;
0200   Handle(TColStd_HArray2OfReal) my1DTolOnFront;
0201   Handle(TColStd_HArray2OfReal) my2DTolOnFront;
0202   Handle(TColStd_HArray2OfReal) my3DTolOnFront;
0203   Standard_Real myFirstParInU;
0204   Standard_Real myLastParInU;
0205   Standard_Real myFirstParInV;
0206   Standard_Real myLastParInV;
0207   GeomAbs_IsoType myFavoriteIso;
0208   GeomAbs_Shape myContInU;
0209   GeomAbs_Shape myContInV;
0210   Standard_Integer myPrecisionCode;
0211   Standard_Integer myMaxDegInU;
0212   Standard_Integer myMaxDegInV;
0213   Standard_Integer myMaxPatches;
0214   AdvApp2Var_Context myConditions;
0215   AdvApp2Var_Network myResult;
0216   AdvApp2Var_Framework myConstraints;
0217   Standard_Boolean myDone;
0218   Standard_Boolean myHasResult;
0219   Handle(TColGeom_HArray1OfSurface) mySurfaces;
0220   Standard_Integer myDegreeInU;
0221   Standard_Integer myDegreeInV;
0222   Handle(TColStd_HArray1OfReal) my1DMaxError;
0223   Handle(TColStd_HArray1OfReal) my1DAverageError;
0224   Handle(TColStd_HArray1OfReal) my1DUFrontError;
0225   Handle(TColStd_HArray1OfReal) my1DVFrontError;
0226   Handle(TColStd_HArray1OfReal) my2DMaxError;
0227   Handle(TColStd_HArray1OfReal) my2DAverageError;
0228   Handle(TColStd_HArray1OfReal) my2DUFrontError;
0229   Handle(TColStd_HArray1OfReal) my2DVFrontError;
0230   Handle(TColStd_HArray1OfReal) my3DMaxError;
0231   Handle(TColStd_HArray1OfReal) my3DAverageError;
0232   Handle(TColStd_HArray1OfReal) my3DUFrontError;
0233   Handle(TColStd_HArray1OfReal) my3DVFrontError;
0234   Standard_Real myCriterionError;
0235 
0236 
0237 };
0238 
0239 
0240 #include <AdvApp2Var_ApproxAFunc2Var.lxx>
0241 
0242 
0243 
0244 
0245 
0246 #endif // _AdvApp2Var_ApproxAFunc2Var_HeaderFile