BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
FitSuiteItem.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Job/FitSuiteItem.cpp
6 //! @brief Implements class FitSuiteItem
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
19 #include "GUI/Util/Error.h"
20 
22  : SessionItem(M_TYPE)
23 {
26  addProperty(P_CHI2, 0.0);
27 
30 }
31 
33 {
35  throw Error("FitSuiteItem::createFitParametersContainer() -> Error. Attempt to create "
36  "a second FitParameterContainer.");
37 
39 }
40 
42 {
43  return item<FitParameterContainerItem>(T_FIT_PARAMETERS_CONTAINER);
44 }
45 
47 {
48  if (getItem(T_MINIMIZER))
49  throw Error("FitSuiteItem::createMinimizerContainer() -> Error. Attempt to create "
50  "a second MinimizerContainer.");
51 
52  return model()->insertItem<MinimizerContainerItem>(this, -1, T_MINIMIZER);
53 }
54 
56 {
57  return item<MinimizerContainerItem>(T_MINIMIZER);
58 }
59 
61 {
62  return getItemValue(P_UPDATE_INTERVAL).toInt();
63 }
64 
65 void FitSuiteItem::setUpdateInterval(const int interval)
66 {
68 }
69 
71 {
72  return name == P_UPDATE_INTERVAL;
73 }
74 
76 {
77  return getItemValue(P_ITERATION_COUNT).toInt();
78 }
79 
80 void FitSuiteItem::setIterationCount(const int count)
81 {
83 }
84 
86 {
87  return name == P_ITERATION_COUNT;
88 }
89 
90 double FitSuiteItem::chi2() const
91 {
92  return getItemValue(P_CHI2).toDouble();
93 }
94 
95 void FitSuiteItem::setChi2(const double chi2)
96 {
98 }
Defines error class.
Defines class FitParameterContainerItem.
Defines class FitSuiteItem.
Defines MinimizerItem class.
Defines class SessionModel.
The FitParameterContainerItem class is a collection of all defined fit parameters in JobItem.
MinimizerContainerItem * minimizerContainerItem()
static constexpr auto P_ITERATION_COUNT
Definition: FitSuiteItem.h:26
static constexpr auto P_CHI2
Definition: FitSuiteItem.h:27
double chi2() const
int iterationCount() const
void setChi2(double chi2)
static constexpr auto P_UPDATE_INTERVAL
Definition: FitSuiteItem.h:25
static bool isIterationCountPropertyName(const QString &name)
FitParameterContainerItem * createFitParametersContainer()
int updateInterval() const
void setIterationCount(int count)
MinimizerContainerItem * createMinimizerContainer()
static constexpr auto T_FIT_PARAMETERS_CONTAINER
Definition: FitSuiteItem.h:28
FitParameterContainerItem * fitParameterContainerItem()
static constexpr auto T_MINIMIZER
Definition: FitSuiteItem.h:29
static bool isUpdateIntervalPropertyName(const QString &name)
void setUpdateInterval(int interval)
The MinimizerContainerItem class holds collection of minimizers.
Definition: MinimizerItem.h:44
static constexpr auto M_TYPE
Definition: MinimizerItem.h:51
Base class for a GUI data item.
Definition: SessionItem.h:204
SessionItem * addProperty(const QString &name, const QVariant &variant)
Add new property item and register new tag. name is the tag name and the display name....
bool registerTag(const QString &name, int min=0, int max=-1, QStringList modelTypes={})
Add new tag to this item with given name, min, max and types. max = -1 -> unlimited,...
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
void setItemValue(const QString &tag, const QVariant &variant) const
Directly set value of item under given tag.
SessionModel * model() const
Returns model of this item.
Definition: SessionItem.cpp:60
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.
T * insertItem(SessionItem *parent=nullptr, int row=-1, QString tag="")
Definition: SessionModel.h:137
QString const & name(EShape k)
Definition: particles.cpp:20