Skip to content
Snippets Groups Projects
Commit f3a8e432 authored by Simon Heybrock's avatar Simon Heybrock
Browse files

Re #21128. Check storage mode in Indexing::extract.

parent 68fdebed
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,15 @@
namespace Mantid {
namespace Indexing {
namespace {
void checkStorageMode(const IndexInfo &indexInfo) {
using namespace Parallel;
if (indexInfo.storageMode() == StorageMode::Distributed)
throw std::runtime_error("extract() does not support " +
Parallel::toString(StorageMode::Distributed));
}
}
/// Extracts IndexInfo from source IndexInfo, extracting data for all indices
/// specified by index set.
IndexInfo extract(const IndexInfo &source, const SpectrumIndexSet &indices) {
......@@ -15,6 +24,7 @@ IndexInfo extract(const IndexInfo &source, const SpectrumIndexSet &indices) {
/// Extracts IndexInfo from source IndexInfo, extracting data for all indices
/// specified by vector.
IndexInfo extract(const IndexInfo &source, const std::vector<size_t> &indices) {
checkStorageMode(source);
std::vector<SpectrumNumber> specNums;
std::vector<SpectrumDefinition> specDefs;
const auto &sourceDefs = source.spectrumDefinitions();
......@@ -31,6 +41,7 @@ IndexInfo extract(const IndexInfo &source, const std::vector<size_t> &indices) {
/// specified by range.
IndexInfo extract(const IndexInfo &source, const size_t minIndex,
const size_t maxIndex) {
checkStorageMode(source);
std::vector<SpectrumNumber> specNums;
std::vector<SpectrumDefinition> specDefs;
const auto &sourceDefs = source.spectrumDefinitions();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment