Commit 5c947c51 authored by Stephen's avatar Stephen
Browse files

clang format

parent 71343c18
......@@ -7,8 +7,8 @@
#pragma once
#include "MantidDataHandling/DllConfig.h"
#include "MantidNexus/NexusClasses.h"
#include "MantidGeometry/IDTypes.h"
#include "MantidNexus/NexusClasses.h"
namespace Mantid {
namespace DataHandling {
......
......@@ -17,18 +17,21 @@ namespace DataHandling {
DataBlock::DataBlock()
: m_numberOfPeriods(0), m_numberOfSpectra(0), m_numberOfChannels(0),
m_minSpectraID(std::numeric_limits<specnum_t>::max()), m_maxSpectraID(0) {}
m_minSpectraID(std::numeric_limits<specnum_t>::max()), m_maxSpectraID(0) {
}
DataBlock::DataBlock(const Mantid::NeXus::NXInt &data)
: m_numberOfPeriods(data.dim0()), m_numberOfSpectra(data.dim1()),
m_numberOfChannels(data.dim2()),
m_minSpectraID(std::numeric_limits<specnum_t>::max()), m_maxSpectraID(0) {}
m_minSpectraID(std::numeric_limits<specnum_t>::max()), m_maxSpectraID(0) {
}
DataBlock::DataBlock(int numberOfPeriods, size_t numberOfSpectra,
size_t numberOfChannels)
: m_numberOfPeriods(numberOfPeriods), m_numberOfSpectra(numberOfSpectra),
m_numberOfChannels(numberOfChannels),
m_minSpectraID(std::numeric_limits<specnum_t>::max()), m_maxSpectraID(0) {}
m_minSpectraID(std::numeric_limits<specnum_t>::max()), m_maxSpectraID(0) {
}
specnum_t DataBlock::getMinSpectrumID() const { return m_minSpectraID; }
......
......@@ -280,8 +280,8 @@ int DataBlockComposite::getNumberOfPeriods() const {
return m_dataBlocks.empty() ? 0 : m_dataBlocks[0].getNumberOfPeriods();
}
DataBlockComposite
DataBlockComposite::operator+(const DataBlockComposite &other) {
DataBlockComposite DataBlockComposite::
operator+(const DataBlockComposite &other) {
DataBlockComposite output;
output.m_dataBlocks.insert(std::end(output.m_dataBlocks),
std::begin(m_dataBlocks), std::end(m_dataBlocks));
......
......@@ -17,8 +17,7 @@ DataBlockGenerator::DataBlockGenerator(
const std::vector<spectrumPair> &intervals)
: m_intervals(intervals) {
// We need to sort the data items.
auto comparison = [](const spectrumPair &el1,
const spectrumPair &el2) {
auto comparison = [](const spectrumPair &el1, const spectrumPair &el2) {
return el1.first < el2.first;
};
std::sort(m_intervals.begin(), m_intervals.end(), comparison);
......
......@@ -109,11 +109,12 @@ void LoadISISNexus2::init() {
auto mustBePositiveSpectrum = std::make_shared<BoundedValidator<specnum_t>>();
mustBePositiveSpectrum->setLower(0);
declareProperty("SpectrumMin", static_cast<specnum_t>(0), mustBePositiveSpectrum);
declareProperty("SpectrumMin", static_cast<specnum_t>(0),
mustBePositiveSpectrum);
declareProperty("SpectrumMax", static_cast<specnum_t>(EMPTY_INT()),
mustBePositiveSpectrum);
declareProperty(std::make_unique<ArrayProperty<specnum_t>>("SpectrumList"));
auto mustBePositive= std::make_shared<BoundedValidator<int64_t>>();
auto mustBePositive = std::make_shared<BoundedValidator<int64_t>>();
declareProperty("EntryNumber", static_cast<int64_t>(0), mustBePositive,
"0 indicates that every entry is loaded, into a separate "
"workspace within a group. "
......
......@@ -356,10 +356,9 @@ void LoadMuonNexus1::loadDeadTimes(NXRoot &root) {
// Set the spectrum list that should be loaded
if (m_interval || m_list) {
// Load only selected spectra
specToLoad.insert(
specToLoad.end(),
boost::counting_iterator<specnum_t>(m_spec_min),
boost::counting_iterator<specnum_t>(m_spec_max));
specToLoad.insert(specToLoad.end(),
boost::counting_iterator<specnum_t>(m_spec_min),
boost::counting_iterator<specnum_t>(m_spec_max));
specToLoad.insert(specToLoad.end(), m_spec_list.begin(),
m_spec_list.end());
} else {
......@@ -464,10 +463,9 @@ Workspace_sptr LoadMuonNexus1::loadDetectorGrouping(
// Set the spectrum list that should be loaded
if (m_interval || m_list) {
// Load only selected spectra
specToLoad.insert(
specToLoad.end(),
boost::counting_iterator<specnum_t>(m_spec_min),
boost::counting_iterator<specnum_t>(m_spec_max));
specToLoad.insert(specToLoad.end(),
boost::counting_iterator<specnum_t>(m_spec_min),
boost::counting_iterator<specnum_t>(m_spec_max));
specToLoad.insert(specToLoad.end(), m_spec_list.begin(),
m_spec_list.end());
} else {
......
......@@ -91,7 +91,8 @@ void LoadMuonNexusV2::init() {
auto mustBePositiveSpectra = std::make_shared<BoundedValidator<specnum_t>>();
mustBePositiveSpectra->setLower(0);
declareProperty("SpectrumMin", static_cast<specnum_t>(0), mustBePositiveSpectra);
declareProperty("SpectrumMin", static_cast<specnum_t>(0),
mustBePositiveSpectra);
declareProperty("SpectrumMax", static_cast<specnum_t>(EMPTY_INT()),
mustBePositiveSpectra);
declareProperty(std::make_unique<ArrayProperty<specnum_t>>("SpectrumList"));
......
......@@ -13,9 +13,9 @@
#include "MantidDataHandling/DataBlockGenerator.h"
#include <memory>
using Mantid::specnum_t;
using Mantid::DataHandling::DataBlock;
using Mantid::DataHandling::DataBlockComposite;
using Mantid::specnum_t;
class DataBlockCompositeTest : public CxxTest::TestSuite {
public:
......@@ -58,7 +58,7 @@ public:
// Assert
std::vector<specnum_t> expected = {2, 3, 4, 5, 6, 7, 8, 23, 24,
25, 26, 27, 45, 46, 47, 48, 49};
25, 26, 27, 45, 46, 47, 48, 49};
auto index = 0;
for (; !generator->isDone(); generator->next(), ++index) {
TSM_ASSERT_EQUALS("Should take elements out of the DataBlock interval",
......
......@@ -9,7 +9,7 @@
#include "MantidDataHandling/DataBlockGenerator.h"
#include <cxxtest/TestSuite.h>
using Mantid::specnum_t;
using Mantid::specnum_t;
class DataBlockGeneratorTest : public CxxTest::TestSuite {
public:
......@@ -37,7 +37,8 @@ public:
// Arrange
specnum_t min = 2;
specnum_t max = 8;
std::vector<std::pair<specnum_t, specnum_t>> interval{std::make_pair(min, max)};
std::vector<std::pair<specnum_t, specnum_t>> interval{
std::make_pair(min, max)};
Mantid::DataHandling::DataBlockGenerator generator(interval);
// Act + Assert
......@@ -70,7 +71,7 @@ public:
std::make_pair(min1, max1), std::make_pair(min2, max2),
std::make_pair(min3, max3)};
std::vector<specnum_t> expectedOutput = {2, 3, 4, 5, 8, 9, 10,
11, 12, 15, 16, 17, 18, 19};
11, 12, 15, 16, 17, 18, 19};
// Act + Assert
do_test_interval(interval, expectedOutput);
......@@ -91,7 +92,7 @@ public:
std::make_pair(min1, max1), std::make_pair(min2, max2),
std::make_pair(min3, max3)};
std::vector<specnum_t> expectedOutput = {2, 3, 4, 5, 8, 9, 10,
11, 12, 15, 16, 17, 18, 19};
11, 12, 15, 16, 17, 18, 19};
// Act + Assert
do_test_interval(interval, expectedOutput);
......
......@@ -11,8 +11,8 @@
#include "MantidDataHandling/DataBlock.h"
#include "MantidDataHandling/DataBlockGenerator.h"
using Mantid::DataHandling::DataBlock;
using Mantid::specnum_t;
using Mantid::DataHandling::DataBlock;
class DataBlockTest : public CxxTest::TestSuite {
public:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment