Back to home page

EIC code displayed by LXR

 
 

    


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

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