2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008,2009 Oliver Gloth +
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
45 void set(QString settings_txt
);
46 double operator()(double x
);
47 double maxError() { return m_MaxErr
; }
48 void reset() { m_MaxErr
= 0; }
49 bool active() { return (m_Weighting1
> 1e-10) || (m_Weighting2
> 1e-10); }
57 protected: // attributes
68 virtual double func(vec3_t x
) = 0;
69 virtual double func(double x
, double y
, double z
) { return func(vec3_t(x
,y
,z
)); };
70 virtual void computeDerivatives(vec3_t x
);
72 void getErrSet(QString group
, QString key
, double w1
, double w2
, double e
, double s
, ErrorFunction
&err_func
);
73 double angleX(const vec3_t
&v1
, const vec3_t
&v2
);
79 vec3_t
optimise(vec3_t x
);
80 void setDeltas(double d
) { Dx
= d
; Dy
= d
; Dz
= d
; };
81 void setDx(double d
) { Dx
= d
; };
82 void setDy(double d
) { Dy
= d
; };
83 void setDz(double d
) { Dz
= d
; };