BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SimulationOptions.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/RT/SimulationOptions.h
6 //! @brief Defines class SimulationOptions.
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_CORE_PARAMETRIZATION_SIMULATIONOPTIONS_H
16 #define BORNAGAIN_CORE_PARAMETRIZATION_SIMULATIONOPTIONS_H
17 
18 #include "Base/Utils/ThreadInfo.h"
19 #include <cstddef>
20 
21 using std::size_t;
22 
23 //! Collect the different options for simulation.
24 //! @ingroup simulation
25 //! @ref SimulationOptions
26 
28 {
29 public:
31 
32  bool isIntegrate() const;
33  size_t getMcPoints() const { return m_mc_points; }
34 
35  //! @brief Enables/disables MonetCarlo integration
36  //! @param flag If true, MonteCarlo integration will be used, otherwise analytical calculations
37  //! @param mc_points Number of points for MonteCarlo integrator
38  void setMonteCarloIntegration(bool flag = true, size_t mc_points = 50);
39 
40  //! @brief Sets number of threads to use during the simulation (0 - take the default value from
41  //! the hardware)
42  void setNumberOfThreads(int nthreads);
43 
44  unsigned getNumberOfThreads() const;
45 
46  //! @brief Sets number of batches to split
47  void setNumberOfBatches(int nbatches);
48 
49  unsigned getNumberOfBatches() const;
50 
51  unsigned getCurrentBatch() const;
52 
53  //! @brief Sets the batch and thread information to be used
54  void setThreadInfo(const ThreadInfo& thread_info) { m_thread_info = thread_info; }
55 
56  unsigned getHardwareConcurrency() const;
57 
58  void setIncludeSpecular(bool include_specular) { m_include_specular = include_specular; }
59 
60  bool includeSpecular() const { return m_include_specular; }
61 
62  void setUseAvgMaterials(bool use_avg_materials) { m_use_avg_materials = use_avg_materials; }
63 
64  bool useAvgMaterials() const { return m_use_avg_materials; }
65 
66 private:
70  size_t m_mc_points;
72 };
73 
74 #endif // BORNAGAIN_CORE_PARAMETRIZATION_SIMULATIONOPTIONS_H
Defines struct ThreadInfo.
Collect the different options for simulation.
ThreadInfo m_thread_info
void setNumberOfBatches(int nbatches)
Sets number of batches to split.
size_t getMcPoints() const
void setUseAvgMaterials(bool use_avg_materials)
unsigned getNumberOfBatches() const
unsigned getCurrentBatch() const
bool includeSpecular() const
unsigned getHardwareConcurrency() const
unsigned getNumberOfThreads() const
void setThreadInfo(const ThreadInfo &thread_info)
Sets the batch and thread information to be used.
bool isIntegrate() const
bool useAvgMaterials() const
void setIncludeSpecular(bool include_specular)
void setNumberOfThreads(int nthreads)
Sets number of threads to use during the simulation (0 - take the default value from the hardware)
void setMonteCarloIntegration(bool flag=true, size_t mc_points=50)
Enables/disables MonetCarlo integration.
Information to run simulation with dedicated number of threads.
Definition: ThreadInfo.h:21