Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 09:14:46

0001 // Created on: 1991-12-02
0002 // Created by: Laurent PAINNOT
0003 // Copyright (c) 1991-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 _AppDef_ParFunctionOfTheGradient_HeaderFile
0018 #define _AppDef_ParFunctionOfTheGradient_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <AppDef_MultiLine.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <Standard_Real.hxx>
0027 #include <AppDef_ParLeastSquareOfTheGradient.hxx>
0028 #include <TColStd_HArray1OfInteger.hxx>
0029 #include <AppParCurves_HArray1OfConstraintCouple.hxx>
0030 #include <math_MultipleVarFunctionWithGradient.hxx>
0031 #include <AppParCurves_Constraint.hxx>
0032 class AppDef_MultiLine;
0033 class AppDef_MyLineTool;
0034 class AppDef_ParLeastSquareOfTheGradient;
0035 class AppDef_ResConstraintOfTheGradient;
0036 class AppParCurves_MultiCurve;
0037 
0038 class AppDef_ParFunctionOfTheGradient : public math_MultipleVarFunctionWithGradient
0039 {
0040 public:
0041   DEFINE_STANDARD_ALLOC
0042 
0043   //! initializes the fields of the function. The approximating
0044   //! curve has the desired degree Deg.
0045   Standard_EXPORT AppDef_ParFunctionOfTheGradient(
0046     const AppDef_MultiLine&                               SSP,
0047     const Standard_Integer                                FirstPoint,
0048     const Standard_Integer                                LastPoint,
0049     const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints,
0050     const math_Vector&                                    Parameters,
0051     const Standard_Integer                                Deg);
0052 
0053   //! returns the number of variables of the function. It
0054   //! corresponds to the number of MultiPoints.
0055   Standard_EXPORT Standard_Integer NbVariables() const;
0056 
0057   //! this method computes the new approximation of the
0058   //! MultiLine
0059   //! SSP and calculates F = sum (||Pui - Bi*Pi||2) for each
0060   //! point of the MultiLine.
0061   Standard_EXPORT Standard_Boolean Value(const math_Vector& X, Standard_Real& F);
0062 
0063   //! returns the gradient G of the sum above for the
0064   //! parameters Xi.
0065   Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X, math_Vector& G);
0066 
0067   //! returns the value F=sum(||Pui - Bi*Pi||)2.
0068   //! returns the value G = grad(F) for the parameters Xi.
0069   Standard_EXPORT Standard_Boolean Values(const math_Vector& X, Standard_Real& F, math_Vector& G);
0070 
0071   //! returns the new parameters of the MultiLine.
0072   Standard_EXPORT const math_Vector& NewParameters() const;
0073 
0074   //! returns the MultiCurve approximating the set after
0075   //! computing the value F or Grad(F).
0076   Standard_EXPORT const AppParCurves_MultiCurve& CurveValue();
0077 
0078   //! returns the distance between the MultiPoint of range
0079   //! IPoint and the curve CurveIndex.
0080   Standard_EXPORT Standard_Real Error(const Standard_Integer IPoint,
0081                                       const Standard_Integer CurveIndex) const;
0082 
0083   //! returns the maximum distance between the points
0084   //! and the MultiCurve.
0085   Standard_EXPORT Standard_Real MaxError3d() const;
0086 
0087   //! returns the maximum distance between the points
0088   //! and the MultiCurve.
0089   Standard_EXPORT Standard_Real MaxError2d() const;
0090 
0091   Standard_EXPORT AppParCurves_Constraint
0092     FirstConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints,
0093                     const Standard_Integer                                FirstPoint) const;
0094 
0095   Standard_EXPORT AppParCurves_Constraint
0096     LastConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints,
0097                    const Standard_Integer                                LastPoint) const;
0098 
0099 protected:
0100   //! this method is used each time Value or Gradient is
0101   //! needed.
0102   Standard_EXPORT void Perform(const math_Vector& X);
0103 
0104 private:
0105   Standard_Boolean                               Done;
0106   AppDef_MultiLine                               MyMultiLine;
0107   AppParCurves_MultiCurve                        MyMultiCurve;
0108   Standard_Integer                               Degre;
0109   math_Vector                                    myParameters;
0110   Standard_Real                                  FVal;
0111   math_Vector                                    ValGrad_F;
0112   math_Matrix                                    MyF;
0113   math_Matrix                                    PTLX;
0114   math_Matrix                                    PTLY;
0115   math_Matrix                                    PTLZ;
0116   math_Matrix                                    A;
0117   math_Matrix                                    DA;
0118   AppDef_ParLeastSquareOfTheGradient             MyLeastSquare;
0119   Standard_Boolean                               Contraintes;
0120   Standard_Integer                               NbP;
0121   Standard_Integer                               NbCu;
0122   Standard_Integer                               Adeb;
0123   Standard_Integer                               Afin;
0124   Handle(TColStd_HArray1OfInteger)               tabdim;
0125   Standard_Real                                  ERR3d;
0126   Standard_Real                                  ERR2d;
0127   Standard_Integer                               FirstP;
0128   Standard_Integer                               LastP;
0129   Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints;
0130 };
0131 
0132 #endif // _AppDef_ParFunctionOfTheGradient_HeaderFile