0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / AppDef / AppDef_ParFunctionOfMyGradientOfCompute.hxx
CommitLineData
42cf5bc1 1// Created on: 1991-12-02
2// Created by: Laurent PAINNOT
3// Copyright (c) 1991-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _AppDef_ParFunctionOfMyGradientOfCompute_HeaderFile
18#define _AppDef_ParFunctionOfMyGradientOfCompute_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Boolean.hxx>
25#include <AppDef_MultiLine.hxx>
26#include <AppParCurves_MultiCurve.hxx>
27#include <Standard_Integer.hxx>
28#include <math_Vector.hxx>
29#include <Standard_Real.hxx>
30#include <math_Matrix.hxx>
31#include <AppDef_ParLeastSquareOfMyGradientOfCompute.hxx>
32#include <TColStd_HArray1OfInteger.hxx>
33#include <AppParCurves_HArray1OfConstraintCouple.hxx>
34#include <math_MultipleVarFunctionWithGradient.hxx>
35#include <AppParCurves_Constraint.hxx>
36class AppDef_MultiLine;
37class AppDef_MyLineTool;
38class AppDef_ParLeastSquareOfMyGradientOfCompute;
39class AppDef_ResConstraintOfMyGradientOfCompute;
40class AppParCurves_MultiCurve;
41
42
43
44class AppDef_ParFunctionOfMyGradientOfCompute : public math_MultipleVarFunctionWithGradient
45{
46public:
47
48 DEFINE_STANDARD_ALLOC
49
50
36b9ff75 51 //! initializes the fields of the function. The approximating
52 //! curve has the desired degree Deg.
42cf5bc1 53 Standard_EXPORT AppDef_ParFunctionOfMyGradientOfCompute(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);
54
36b9ff75 55 //! returns the number of variables of the function. It
56 //! corresponds to the number of MultiPoints.
42cf5bc1 57 Standard_EXPORT Standard_Integer NbVariables() const;
58
36b9ff75 59 //! this method computes the new approximation of the
60 //! MultiLine
61 //! SSP and calculates F = sum (||Pui - Bi*Pi||2) for each
62 //! point of the MultiLine.
42cf5bc1 63 Standard_EXPORT Standard_Boolean Value (const math_Vector& X, Standard_Real& F);
64
36b9ff75 65 //! returns the gradient G of the sum above for the
66 //! parameters Xi.
42cf5bc1 67 Standard_EXPORT Standard_Boolean Gradient (const math_Vector& X, math_Vector& G);
68
36b9ff75 69 //! returns the value F=sum(||Pui - Bi*Pi||)2.
70 //! returns the value G = grad(F) for the parameters Xi.
42cf5bc1 71 Standard_EXPORT Standard_Boolean Values (const math_Vector& X, Standard_Real& F, math_Vector& G);
72
36b9ff75 73 //! returns the new parameters of the MultiLine.
42cf5bc1 74 Standard_EXPORT const math_Vector& NewParameters() const;
75
36b9ff75 76 //! returns the MultiCurve approximating the set after
77 //! computing the value F or Grad(F).
42cf5bc1 78 Standard_EXPORT const AppParCurves_MultiCurve& CurveValue();
79
36b9ff75 80 //! returns the distance between the MultiPoint of range
81 //! IPoint and the curve CurveIndex.
42cf5bc1 82 Standard_EXPORT Standard_Real Error (const Standard_Integer IPoint, const Standard_Integer CurveIndex) const;
83
36b9ff75 84 //! returns the maximum distance between the points
85 //! and the MultiCurve.
42cf5bc1 86 Standard_EXPORT Standard_Real MaxError3d() const;
87
36b9ff75 88 //! returns the maximum distance between the points
89 //! and the MultiCurve.
42cf5bc1 90 Standard_EXPORT Standard_Real MaxError2d() const;
91
92 Standard_EXPORT AppParCurves_Constraint FirstConstraint (const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, const Standard_Integer FirstPoint) const;
93
94 Standard_EXPORT AppParCurves_Constraint LastConstraint (const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, const Standard_Integer LastPoint) const;
95
96
97
98
99protected:
100
101
36b9ff75 102 //! this method is used each time Value or Gradient is
103 //! needed.
42cf5bc1 104 Standard_EXPORT void Perform (const math_Vector& X);
105
106
107
108
109private:
110
111
112
113 Standard_Boolean Done;
114 AppDef_MultiLine MyMultiLine;
115 AppParCurves_MultiCurve MyMultiCurve;
116 Standard_Integer Degre;
117 math_Vector myParameters;
118 Standard_Real FVal;
119 math_Vector ValGrad_F;
120 math_Matrix MyF;
121 math_Matrix PTLX;
122 math_Matrix PTLY;
123 math_Matrix PTLZ;
124 math_Matrix A;
125 math_Matrix DA;
126 AppDef_ParLeastSquareOfMyGradientOfCompute MyLeastSquare;
127 Standard_Boolean Contraintes;
128 Standard_Integer NbP;
129 Standard_Integer NbCu;
130 Standard_Integer Adeb;
131 Standard_Integer Afin;
132 Handle(TColStd_HArray1OfInteger) tabdim;
133 Standard_Real ERR3d;
134 Standard_Real ERR2d;
135 Standard_Integer FirstP;
136 Standard_Integer LastP;
137 Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints;
138
139
140};
141
142
143
144
145
146
147
148#endif // _AppDef_ParFunctionOfMyGradientOfCompute_HeaderFile