2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008-2013 enGits GmbH +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #ifndef optimisation_H
24 #define optimisation_H
34 private: // attributes
42 double m_AverageError
;
51 void set(QString settings_txt
);
52 void setName(QString name
) { m_Name
= name
; }
53 QString
name() { return m_Name
; }
54 double operator()(double x
);
55 double maxError() { return m_MaxErr
; }
56 void reset(bool reset_average
);
57 bool active() { return m_Active
&& (m_Err0
> 1e-10); }
58 double averageError();
60 void activate() { m_Active
= true; }
61 void deactivate() { m_Active
= false; }
69 protected: // attributes
77 QList
<ErrorFunction
*> m_ErrorFunctions
;
81 virtual double func(vec3_t x
) = 0;
82 virtual double func(double x
, double y
, double z
) { return func(vec3_t(x
,y
,z
)); };
83 virtual void computeDerivatives(vec3_t x
);
85 void getErrSet(QString group
, QString key
, double err0
, double xs
, ErrorFunction
* err_func
);
86 double angleX(const vec3_t
&v1
, const vec3_t
&v2
);
87 void resetErrorFunctions(bool reset_average
= false);
94 virtual vec3_t
optimise(vec3_t x
);
95 void setDeltas(double d
) { Dx
= d
; Dy
= d
; Dz
= d
; };
96 void setDx(double d
) { Dx
= d
; };
97 void setDy(double d
) { Dy
= d
; };
98 void setDz(double d
) { Dz
= d
; };