BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
quicksimcontroller.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file gui2/quicksimeditor/quicksimcontroller.h
6 //! @brief Defines class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI2_QUICKSIMEDITOR_QUICKSIMCONTROLLER_H
16 #define BORNAGAIN_GUI2_QUICKSIMEDITOR_QUICKSIMCONTROLLER_H
17 
18 #include "darefl_export.h"
20 #include <QObject>
21 #include <memory>
22 
23 namespace ModelView {
24 class ModelHasChangedController;
25 }
26 
27 namespace gui2 {
28 
29 class ApplicationModels;
30 class JobManager;
31 class JobModel;
32 class InstrumentModel;
33 
34 //! Provides quick reflectometry simulations on any change of SampleModel and MaterialModel.
35 //! Listens for any change in SampleModel and MaterialModel, extracts the data needed for
36 //! the simulation, and then submit simulation request to JobManager. As soon as JobManager reports
37 //! about completed simulations, extract results from there and put them into JobModel.
38 
39 class DAREFLCORE_EXPORT QuickSimController : public QObject {
40  Q_OBJECT
41 
42 public:
43  QuickSimController(QObject* parent = nullptr);
45 
46  void setModels(ApplicationModels* models);
47 
48 signals:
49  void progressChanged(int value);
50 
51 public slots:
52  void onInterruptRequest();
53  void onRealTimeRequest(bool status);
54  void onRunSimulationRequest();
55 
56 private slots:
57  void onMultiLayerChange();
58  void onSimulationCompleted();
59 
60 private:
61  void process_multilayer(bool submit_simulation = false);
62  void update_sld_profile(const multislice_t& multilayer);
63  void submit_specular_simulation(const multislice_t& multislice);
64  void setup_jobmanager_connections();
65 
66  JobModel* jobModel() const;
67  InstrumentModel* instrumentModel() const;
68 
69  ApplicationModels* m_models{nullptr};
70  JobManager* m_jobManager{nullptr};
71 
72  bool m_isRealTimeMode; //! Run simulation on every parameter change.
73 
74  std::unique_ptr<ModelView::ModelHasChangedController> m_materialChangedController;
75  std::unique_ptr<ModelView::ModelHasChangedController> m_sampleChangedController;
76  std::unique_ptr<ModelView::ModelHasChangedController> m_instrumentChangedController;
77 };
78 
79 } // namespace gui2
80 
81 #endif // BORNAGAIN_GUI2_QUICKSIMEDITOR_QUICKSIMCONTROLLER_H
Main class to holds all models of GUI session.
Model to store specular instruments settings.
Handles all thread activity for running job simulation in the background.
Definition: jobmanager.h:27
The model to store results of (possibly) multiple reflectometry simulation, and all viewports,...
Definition: jobmodel.h:36
Provides quick reflectometry simulations on any change of SampleModel and MaterialModel.
std::unique_ptr< ModelView::ModelHasChangedController > m_sampleChangedController
std::unique_ptr< ModelView::ModelHasChangedController > m_instrumentChangedController
std::unique_ptr< ModelView::ModelHasChangedController > m_materialChangedController
Run simulation on every parameter change.
void progressChanged(int value)
materialitems.h Collection of materials to populate MaterialModel.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition: app_constants.h:20
std::vector< SliceData > multislice_t
Defines class CLASS?