BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IComputation.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Core/Computation/IComputation.cpp
6 //! @brief Implements interface IComputation.
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 
20 
21 IComputation::IComputation(const MultiLayer& sample, const SimulationOptions& options,
22  ProgressHandler& progress)
23  : m_sim_options(options), mp_progress(&progress),
24  mP_processed_sample(std::make_unique<ProcessedSample>(sample, options))
25 {
26 }
27 
28 IComputation::~IComputation() = default;
29 
30 void IComputation::run()
31 {
32  m_status.setRunning();
33  try {
34  runProtected();
35  m_status.setCompleted();
36  } catch (const std::exception& ex) {
37  m_status.setErrorMessage(std::string(ex.what()));
38  m_status.setFailed();
39  }
40 }
Defines interface IComputation.
Defines class MultiLayer.
Defines class ProcessedSample.
Defines class ProgressHandler.
Defines class SimulationElement.
Our sample model: a stack of layers one below the other.
Definition: MultiLayer.h:42
Data structure that contains all the necessary data for scattering calculations.
Maintains information about progress of a computation.
Collect the different options for simulation.