BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
GUIFitObserver.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Fit/GUIFitObserver.h
6 //! @brief Implements class GUIFitObserver
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 
15 #ifndef BORNAGAIN_GUI_VIEW_FIT_GUIFITOBSERVER_H
16 #define BORNAGAIN_GUI_VIEW_FIT_GUIFITOBSERVER_H
17 
19 #include <QObject>
20 #include <condition_variable>
21 #include <mutex>
22 
23 class Datafield;
24 class IntensityDataItem;
25 class FitObjective;
26 
27 //! Serves as observer for FitObjective and saves fit iteration data for later display
28 //! in GUI widgets.
29 
30 class GUIFitObserver : public QObject {
31  Q_OBJECT
32 
33 public:
34  GUIFitObserver(QObject* parent = nullptr);
35  ~GUIFitObserver() override;
36 
37  void update(const FitObjective* subject);
38 
39  void finishedPlotting();
40 
42 
43 public slots:
44  void setInterval(int val);
45 
46 signals:
47  void updateReady();
48 
49 private:
50  bool is_suitable_iteration(const FitObjective* fitSuite) const;
51  bool is_obligatory_iteration(const FitObjective* fitSuite) const;
52 
54  std::mutex m_update_plot_mutex;
55  std::condition_variable m_on_finish_notifier;
58 };
59 
60 #endif // BORNAGAIN_GUI_VIEW_FIT_GUIFITOBSERVER_H
Defines class FitProgressInfo.
The FitProgressInfo class contains all essential information about fit progress. It is send from GUIF...
Serves as observer for FitObjective and saves fit iteration data for later display in GUI widgets.
std::condition_variable m_on_finish_notifier
void setInterval(int val)
void finishedPlotting()
Informs observer that FitSuiteWidget has finished plotting and is ready for next plot.
bool is_suitable_iteration(const FitObjective *fitSuite) const
Returns true if data could be plotted, when there are resources for it.
bool is_obligatory_iteration(const FitObjective *fitSuite) const
Returns true if given iteration should be obligary plotted.
void updateReady()
FitProgressInfo m_iteration_info
FitProgressInfo progressInfo()
GUIFitObserver(QObject *parent=nullptr)
bool m_block_update_plots
void update(const FitObjective *subject)
~GUIFitObserver() override
std::mutex m_update_plot_mutex