|
18 | 18 | #include "MantidAlgorithms/CreateMonteCarloWorkspace.h"
|
19 | 19 | #include "MantidKernel/BoundedValidator.h"
|
20 | 20 | #include "MantidKernel/Logger.h"
|
| 21 | +#include "MantidAPI/Progress.h" |
21 | 22 |
|
22 | 23 | namespace {
|
23 | 24 | Mantid::Kernel::Logger g_log("CreateMonteCarloWorkspace");
|
@@ -100,24 +101,43 @@ int CreateMonteCarloWorkspace::computeNumberOfIterations(const Mantid::Histogram
|
100 | 101 |
|
101 | 102 | // Using Cumulative Distribution Function
|
102 | 103 | void CreateMonteCarloWorkspace::exec() {
|
| 104 | + // Progress Bar set up |
| 105 | + int numSteps = 7; |
| 106 | + API::Progress progress(this, 0.0, 1.0, numSteps); |
| 107 | + |
| 108 | + |
103 | 109 | MatrixWorkspace_sptr instWs = getProperty("InputWorkspace");
|
104 | 110 | int seed_input = getProperty("Seed");
|
| 111 | + progress.report(); |
| 112 | + std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
105 | 113 |
|
106 | 114 | const Mantid::HistogramData::HistogramY &yData = instWs->y(0); // Counts in each bin
|
| 115 | + progress.report(); |
| 116 | + std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
107 | 117 |
|
108 | 118 | int numIterations = computeNumberOfIterations(yData);
|
109 | 119 | std::vector<double> cdf = computeNormalizedCDF(yData);
|
| 120 | + progress.report(); |
| 121 | + std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
110 | 122 |
|
111 | 123 | MatrixWorkspace_sptr outputWs = WorkspaceFactory::Instance().create(instWs);
|
| 124 | + progress.report(); |
| 125 | + std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
112 | 126 |
|
113 | 127 | // Copy the bin boundaries (X-values) from the input to the output
|
114 | 128 | outputWs->setSharedX(0, instWs->sharedX(0));
|
| 129 | + progress.report(); |
| 130 | + std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
115 | 131 |
|
116 | 132 | std::mt19937 gen(seed_input);
|
117 | 133 |
|
118 | 134 | Mantid::HistogramData::HistogramY outputY = fillHistogramWithRandomData(cdf, numIterations, gen);
|
| 135 | + progress.report(); |
| 136 | + std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
119 | 137 |
|
120 | 138 | outputWs->mutableY(0) = outputY;
|
| 139 | + progress.report(); |
| 140 | + std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
121 | 141 |
|
122 | 142 | setProperty("OutputWorkspace", outputWs);
|
123 | 143 | }
|
|
0 commit comments