BornAgain  1.19.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 reflection and scattering
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_SAMPLE_RT_SIMULATIONOPTIONS_H
16 #define BORNAGAIN_SAMPLE_RT_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 public:
30 
31  bool isIntegrate() const;
32  size_t getMcPoints() const { return m_mc_points; }
33 
34  //! @brief Enables/disables MonetCarlo integration
35  //! @param flag If true, MonteCarlo integration will be used, otherwise analytical calculations
36  //! @param mc_points Number of points for MonteCarlo integrator
37  void setMonteCarloIntegration(bool flag = true, size_t mc_points = 50);
38 
39  //! @brief Sets number of threads to use during the simulation (0 - take the default value from
40  //! the hardware)
41  void setNumberOfThreads(int nthreads);
42 
43  unsigned getNumberOfThreads() const;
44 
45  //! @brief Sets number of batches to split
46  void setNumberOfBatches(int nbatches);
47 
48  unsigned getNumberOfBatches() const;
49 
50  unsigned getCurrentBatch() const;
51 
52  //! @brief Sets the batch and thread information to be used
53  void setThreadInfo(const ThreadInfo& thread_info) { m_thread_info = thread_info; }
54 
55  unsigned getHardwareConcurrency() const;
56 
57  void setIncludeSpecular(bool include_specular) { m_include_specular = include_specular; }
58 
59  bool includeSpecular() const { return m_include_specular; }
60 
61  void setUseAvgMaterials(bool use_avg_materials) { m_use_avg_materials = use_avg_materials; }
62 
63  bool useAvgMaterials() const { return m_use_avg_materials; }
64 
65 private:
69  size_t m_mc_points;
71 };
72 
73 #endif // BORNAGAIN_SAMPLE_RT_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