19 SimulationOptions::SimulationOptions()
20 : m_mc_integration(false), m_include_specular(false), m_use_avg_materials(false), m_mc_points(1)
22 m_thread_info.n_threads = getHardwareConcurrency();
25 bool SimulationOptions::isIntegrate()
const
27 return m_mc_integration && m_mc_points > 1;
32 m_mc_integration = flag;
33 m_mc_points = mc_points;
39 m_thread_info.n_threads = getHardwareConcurrency();
40 else if (nthreads > 0)
41 m_thread_info.n_threads = nthreads;
43 m_thread_info.n_threads = 1;
46 unsigned SimulationOptions::getNumberOfThreads()
const
48 if (m_thread_info.n_threads < 1)
49 throw std::runtime_error(
"Error in SimulationOptions::getNumberOfThreads: Number of "
50 "threads must be positive");
51 return m_thread_info.n_threads;
57 throw std::runtime_error(
"Error in SimulationOptions::setNumberOfBatches: Number of "
58 "batches must be positive");
59 m_thread_info.n_batches = nbatches;
62 unsigned SimulationOptions::getNumberOfBatches()
const
64 if (m_thread_info.n_batches < 1)
65 throw std::runtime_error(
"Error in SimulationOptions::getNumberOfBatches: Number of "
66 "batches must be positive");
67 return m_thread_info.n_batches;
70 unsigned SimulationOptions::getCurrentBatch()
const
72 if (m_thread_info.current_batch >= getNumberOfBatches())
73 throw std::runtime_error(
74 "Error in SimulationOptions::getCurrentBatch: current batch is out of range");
75 return m_thread_info.current_batch;
78 unsigned SimulationOptions::getHardwareConcurrency()
const
80 return std::thread::hardware_concurrency();
Defines class SimulationOptions.
void setNumberOfBatches(int nbatches)
Sets number of batches to split.
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.