BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
FitObjectiveBuilder.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Fit/FitObjectiveBuilder.h
6 //! @brief Defines class FitObjectiveBuilder
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_FITOBJECTIVEBUILDER_H
16 #define BORNAGAIN_GUI_VIEW_FIT_FITOBJECTIVEBUILDER_H
17 
18 #include <memory>
19 
20 class JobItem;
21 class FitObjective;
22 class ISimulation;
23 namespace mumufit {
24 
25 class Parameters;
26 }
27 class Datafield;
28 class IMinimizer;
29 class GUIFitObserver;
30 class IChiSquaredModule;
31 
33 public:
34  FitObjectiveBuilder(JobItem* jobItem);
36 
37  void runFit();
38 
39  std::unique_ptr<FitObjective> createFitObjective() const;
40  std::unique_ptr<IMinimizer> createMinimizer() const;
41  std::unique_ptr<IChiSquaredModule> createChiSquaredModule() const;
42 
43  mumufit::Parameters createParameters() const;
44 
45  void attachObserver(std::shared_ptr<GUIFitObserver> observer);
46 
47  void interruptFitting();
48 
49 private:
51 
52  std::unique_ptr<ISimulation> buildSimulation(const mumufit::Parameters& params) const;
53 
54  void update_fit_parameters(const mumufit::Parameters& params) const;
55 
56  std::shared_ptr<GUIFitObserver> m_observer;
57  std::unique_ptr<FitObjective> m_fit_objective;
58 };
59 
60 #endif // BORNAGAIN_GUI_VIEW_FIT_FITOBJECTIVEBUILDER_H
std::unique_ptr< IChiSquaredModule > createChiSquaredModule() const
void attachObserver(std::shared_ptr< GUIFitObserver > observer)
std::unique_ptr< ISimulation > buildSimulation(const mumufit::Parameters &params) const
std::unique_ptr< IMinimizer > createMinimizer() const
FitObjectiveBuilder(JobItem *jobItem)
std::shared_ptr< GUIFitObserver > m_observer
std::unique_ptr< FitObjective > createFitObjective() const
mumufit::Parameters createParameters() const
std::unique_ptr< FitObjective > m_fit_objective
void update_fit_parameters(const mumufit::Parameters &params) const
Serves as observer for FitObjective and saves fit iteration data for later display in GUI widgets.