0031939: Coding - correction of spelling errors in comments
[occt.git] / src / FairCurve / FairCurve_Energy.hxx
CommitLineData
42cf5bc1 1// Created on: 1996-03-06
2// Created by: Philippe MANGIN
3// Copyright (c) 1996-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 _FairCurve_Energy_HeaderFile
18#define _FairCurve_Energy_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <TColgp_HArray1OfPnt2d.hxx>
25#include <Standard_Integer.hxx>
26#include <Standard_Boolean.hxx>
27#include <TColgp_Array1OfXY.hxx>
28#include <math_Vector.hxx>
29#include <math_MultipleVarFunctionWithHessian.hxx>
30#include <Standard_Real.hxx>
31class math_Matrix;
32class gp_Pnt2d;
33
34
35//! necessary methodes to compute the energy of an FairCurve.
36class FairCurve_Energy : public math_MultipleVarFunctionWithHessian
37{
38public:
39
40 DEFINE_STANDARD_ALLOC
41
42
43 //! returns the number of variables of the energy.
44 virtual Standard_Integer NbVariables() const Standard_OVERRIDE;
45
46 //! computes the values of the Energys E for the
47 //! variable <X>.
48 //! Returns True if the computation was done successfully,
49 //! False otherwise.
50 Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& X, Standard_Real& E) Standard_OVERRIDE;
51
52 //! computes the gradient <G> of the energys for the
53 //! variable <X>.
54 //! Returns True if the computation was done successfully,
55 //! False otherwise.
56 Standard_EXPORT virtual Standard_Boolean Gradient (const math_Vector& X, math_Vector& G) Standard_OVERRIDE;
57
58 //! computes the Energy <E> and the gradient <G> of the
59 //! energy for the variable <X>.
60 //! Returns True if the computation was done successfully,
61 //! False otherwise.
62 Standard_EXPORT virtual Standard_Boolean Values (const math_Vector& X, Standard_Real& E, math_Vector& G) Standard_OVERRIDE;
63
64 //! computes the Energy <E>, the gradient <G> and the
65 //! Hessian <H> of the energy for the variable <X>.
66 //! Returns True if the computation was done
67 //! successfully, False otherwise.
68 Standard_EXPORT virtual Standard_Boolean Values (const math_Vector& X, Standard_Real& E, math_Vector& G, math_Matrix& H) Standard_OVERRIDE;
69
21c7c457 70 //! compute the variables <X> which correspond with the field <MyPoles>
42cf5bc1 71 Standard_EXPORT virtual Standard_Boolean Variable (math_Vector& X) const;
72
73 //! return the poles
74 const Handle(TColgp_HArray1OfPnt2d)& Poles() const;
75
76
77
78
79protected:
80
81
82 //! Angles corresspond to the Ox axis
83 //! ConstrOrder1(2) can be equal to 0, 1 or 2
84 Standard_EXPORT FairCurve_Energy(const Handle(TColgp_HArray1OfPnt2d)& Poles, const Standard_Integer ConstrOrder1, const Standard_Integer ConstrOrder2, const Standard_Boolean WithAuxValue = Standard_False, const Standard_Real Angle1 = 0, const Standard_Real Angle2 = 0, const Standard_Integer Degree = 2, const Standard_Real Curvature1 = 0, const Standard_Real Curvature2 = 0);
85
21c7c457 86 //! It is use internally to make the Gradient Vector <G>
42cf5bc1 87 Standard_EXPORT void Gradient1 (const math_Vector& TheVector, math_Vector& G);
88
21c7c457 89 //! It is use internally to make the Hessian Matrix <H>
42cf5bc1 90 Standard_EXPORT void Hessian1 (const math_Vector& TheVector, math_Matrix& H);
91
21c7c457 92 //! compute the poles which correspond with the variable X
42cf5bc1 93 Standard_EXPORT virtual void ComputePoles (const math_Vector& X);
94
95 Standard_Integer Indice (const Standard_Integer i, const Standard_Integer j) const;
96
21c7c457 97 //! compute the pole which depend of variables and G1 constraint
42cf5bc1 98 Standard_EXPORT void ComputePolesG1 (const Standard_Integer Side, const Standard_Real Lambda, const gp_Pnt2d& P1, gp_Pnt2d& P2) const;
99
21c7c457 100 //! compute the pole which depend of variables and G2 constraint
42cf5bc1 101 Standard_EXPORT void ComputePolesG2 (const Standard_Integer Side, const Standard_Real Lambda, const Standard_Real Rho, const gp_Pnt2d& P1, gp_Pnt2d& P2) const;
102
103 //! compute the energy (and derivatives) in intermediat format
104 Standard_EXPORT virtual Standard_Boolean Compute (const Standard_Integer DerivativeOrder, math_Vector& Result) = 0;
105
106
107 Handle(TColgp_HArray1OfPnt2d) MyPoles;
108 Standard_Integer MyContrOrder1;
109 Standard_Integer MyContrOrder2;
110 Standard_Boolean MyWithAuxValue;
111 Standard_Integer MyNbVar;
112
113
114private:
115
116
117
118 Standard_Integer MyNbValues;
119 TColgp_Array1OfXY MyLinearForm;
120 TColgp_Array1OfXY MyQuadForm;
121 math_Vector MyGradient;
122 math_Vector MyHessian;
123
124
125};
126
127
128#include <FairCurve_Energy.lxx>
129
130
131
132
133
134#endif // _FairCurve_Energy_HeaderFile