|
12 | 12 | #include "MantidTypes/SpectrumDefinition.h"
|
13 | 13 |
|
14 | 14 | #include <algorithm>
|
15 |
| -#include <functional> |
16 | 15 | #include <numeric>
|
17 | 16 |
|
18 | 17 | namespace Mantid::Indexing {
|
@@ -100,21 +99,17 @@ const std::vector<SpectrumNumber> &IndexInfo::spectrumNumbers() const {
|
100 | 99 | /// Set a spectrum number for each index.
|
101 | 100 | void IndexInfo::setSpectrumNumbers(std::vector<SpectrumNumber> &&spectrumNumbers) {
|
102 | 101 | if (m_spectrumNumberTranslator->globalSize() != spectrumNumbers.size())
|
103 |
| - throw std::runtime_error("IndexInfo::setSpectrumNumbers: Size mismatch. " |
104 |
| - "The vector must contain a spectrum number for " |
105 |
| - "each spectrum (not just for the local " |
106 |
| - "partition)."); |
| 102 | + throw std::runtime_error("IndexInfo::setSpectrumNumbers: Size mismatch. The vector must contain a spectrum number " |
| 103 | + "for each spectrum (not just for the local partition)."); |
107 | 104 | makeSpectrumNumberTranslator(std::move(spectrumNumbers));
|
108 | 105 | }
|
109 | 106 |
|
110 | 107 | /// Set a contiguous range of spectrum numbers.
|
111 | 108 | void IndexInfo::setSpectrumNumbers(const SpectrumNumber min, const SpectrumNumber max) {
|
112 | 109 | auto newSize = static_cast<int32_t>(max) - static_cast<int32_t>(min) + 1;
|
113 | 110 | if (static_cast<int64_t>(m_spectrumNumberTranslator->globalSize()) != newSize)
|
114 |
| - throw std::runtime_error("IndexInfo::setSpectrumNumbers: Size mismatch. " |
115 |
| - "The range of spectrum numbers must provide a " |
116 |
| - "spectrum number for each spectrum (not just for " |
117 |
| - "the local partition)."); |
| 111 | + throw std::runtime_error("IndexInfo::setSpectrumNumbers: Size mismatch. The range of spectrum numbers must provide " |
| 112 | + "a spectrum number for each spectrum (not just for the local partition)."); |
118 | 113 | std::vector<SpectrumNumber> specNums(newSize);
|
119 | 114 | std::iota(specNums.begin(), specNums.end(), static_cast<int32_t>(min));
|
120 | 115 | makeSpectrumNumberTranslator(std::move(specNums));
|
@@ -197,9 +192,8 @@ SpectrumIndexSet IndexInfo::makeIndexSet(const std::vector<GlobalSpectrumIndex>
|
197 | 192 | std::vector<GlobalSpectrumIndex>
|
198 | 193 | IndexInfo::globalSpectrumIndicesFromDetectorIndices(const std::vector<size_t> &detectorIndices) const {
|
199 | 194 | if (!m_spectrumDefinitions)
|
200 |
| - throw std::runtime_error("IndexInfo::" |
201 |
| - "globalSpectrumIndicesFromDetectorIndices -- no " |
202 |
| - "spectrum definitions available"); |
| 195 | + throw std::runtime_error( |
| 196 | + "IndexInfo::globalSpectrumIndicesFromDetectorIndices -- no spectrum definitions available"); |
203 | 197 | /*
|
204 | 198 | * We need some way of keeping track of which time indices of given detector
|
205 | 199 | * have a matching mapping. detectorMap holds pairs; first in the pair
|
@@ -260,26 +254,22 @@ IndexInfo::globalSpectrumIndicesFromDetectorIndices(const std::vector<size_t> &d
|
260 | 254 | }
|
261 | 255 | }
|
262 | 256 | if (spectrumDefinition.first == -2)
|
263 |
| - throw std::runtime_error("SpectrumDefinition contains multiple entries. " |
264 |
| - "No unique mapping from detector to spectrum " |
265 |
| - "possible"); |
| 257 | + throw std::runtime_error( |
| 258 | + "SpectrumDefinition contains multiple entries. No unique mapping from detector to spectrum possible"); |
266 | 259 | }
|
267 | 260 |
|
268 | 261 | if (std::any_of(detectorMap.begin(), detectorMap.end(),
|
269 | 262 | [](const std::pair<char, std::vector<char>> &p) { return p.first == 1; })) {
|
270 |
| - throw std::runtime_error("Some of the requested detectors do not have a " |
271 |
| - "corresponding spectrum"); |
| 263 | + throw std::runtime_error("Some of the requested detectors do not have a corresponding spectrum"); |
272 | 264 | }
|
273 | 265 | if (std::any_of(detectorMap.begin(), detectorMap.end(), [](const std::pair<char, std::vector<char>> &p) {
|
274 | 266 | return std::any_of(p.second.begin(), p.second.end(), [](char c) { return c > 1; });
|
275 | 267 | })) {
|
276 |
| - throw std::runtime_error("Some of the spectra map to the same detector " |
277 |
| - "at the same time index"); |
| 268 | + throw std::runtime_error("Some of the spectra map to the same detector at the same time index"); |
278 | 269 | }
|
279 | 270 |
|
280 | 271 | if (detectorIndices.size() > spectrumIndices.size())
|
281 |
| - throw std::runtime_error("Some of the requested detectors do not have a " |
282 |
| - "corresponding spectrum"); |
| 272 | + throw std::runtime_error("Some of the requested detectors do not have a corresponding spectrum"); |
283 | 273 | return spectrumIndices;
|
284 | 274 | }
|
285 | 275 |
|
|
0 commit comments