From d4b97a808f770b2380c4cb78dac7a4c186216c0b Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Thu, 19 May 2022 07:09:46 +0200 Subject: [PATCH] shorten fct name --- Device/Coord/CoordSystem1D.cpp | 2 +- Device/Data/DataUtils.cpp | 8 ++++---- Device/Data/Powerfield.cpp | 4 ++-- Device/Data/Powerfield.h | 14 +++++++------- Device/Data/PowerfieldIterator.h | 2 +- Device/Histo/IHistogram.cpp | 4 ++-- Device/Histo/SimulationResult.cpp | 2 +- Device/Mask/DetectorMask.cpp | 2 +- GUI/Model/Data/DataItem.cpp | 2 +- .../Loaders/AutomaticDataLoader1DResultModel.cpp | 2 +- GUI/View/Mask/MaskResultsPresenter.cpp | 2 +- GUI/View/PlotSpecular/SpecularPlot.cpp | 2 +- Sim/Simulation/OffSpecularSimulation.cpp | 4 ++-- .../Functional/Core/CoreSpecial/CoreIOPathTest.cpp | 2 +- Tests/PyUnit/intensitydata.py | 6 +++--- Tests/PyUnit/intensitydata_io.py | 4 ++-- Tests/Unit/Device/ArrayUtilsTest.cpp | 6 +++--- Tests/Unit/Device/DetectorMaskTest.cpp | 10 +++++----- Tests/Unit/Device/Histogram1DTest.cpp | 14 +++++++------- Tests/Unit/Device/Histogram2DTest.cpp | 14 +++++++------- Tests/Unit/Device/IOReaderWriterTest.cpp | 8 ++++---- Tests/Unit/Device/IntensityDataFunctionsTest.cpp | 14 +++++++------- Tests/Unit/Device/PowerfieldTest.cpp | 2 +- Tests/Unit/Device/ReadSANSDRawTest.cpp | 2 +- Tests/Unit/Device/SphericalDetectorTest.cpp | 6 +++--- Tests/Unit/Sim/CoordSystem1DTest.cpp | 4 ++-- Tests/Unit/Sim/DepthProbeSimulationTest.cpp | 2 +- Tests/Unit/Sim/SpecularSimulationTest.cpp | 2 +- 28 files changed, 73 insertions(+), 73 deletions(-) diff --git a/Device/Coord/CoordSystem1D.cpp b/Device/Coord/CoordSystem1D.cpp index e783f632a96..a8405a88bc5 100644 --- a/Device/Coord/CoordSystem1D.cpp +++ b/Device/Coord/CoordSystem1D.cpp @@ -141,7 +141,7 @@ CoordSystem1D::createConvertedData(const Powerfield<double>& data, Axes::Coords return result; } - for (size_t i = 0, size = result->getAllocatedSize(); i < size; ++i) + for (size_t i = 0, size = result->allocatedSize(); i < size; ++i) (*result)[i] = data[i] * std::pow((*q_axis)[i], 4); return result; } diff --git a/Device/Data/DataUtils.cpp b/Device/Data/DataUtils.cpp index 4a0080b05f9..6b9ca950ef4 100644 --- a/Device/Data/DataUtils.cpp +++ b/Device/Data/DataUtils.cpp @@ -40,9 +40,9 @@ double DataUtils::Data::relativeDataDifference(const Powerfield<double>& dat, throw std::runtime_error("Powerfield dimension differs from reference"); double diff = 0.0; - for (size_t i = 0; i < dat.getAllocatedSize(); ++i) + for (size_t i = 0; i < dat.allocatedSize(); ++i) diff += Numeric::GetRelativeDifference(dat[i], ref[i]); - diff /= dat.getAllocatedSize(); + diff /= dat.allocatedSize(); if (std::isnan(diff)) throw std::runtime_error("diff=NaN"); return diff; @@ -56,7 +56,7 @@ DataUtils::Data::createRelativeDifferenceData(const Powerfield<double>& data, throw std::runtime_error("DataUtils::Data::createRelativeDifferenceData() -> " "Error. Different dimensions of data and reference."); std::unique_ptr<Powerfield<double>> result(reference.clone()); - for (size_t i = 0; i < result->getAllocatedSize(); ++i) + for (size_t i = 0; i < result->allocatedSize(); ++i) (*result)[i] = Numeric::GetRelativeDifference(data[i], reference[i]); return result; } @@ -97,7 +97,7 @@ DataUtils::Data::createRearrangedDataSet(const Powerfield<double>& data, int n) }; } - for (size_t index = 0, size = data.getAllocatedSize(); index < size; ++index) { + for (size_t index = 0, size = data.allocatedSize(); index < size; ++index) { std::vector<int> axis_inds = data.getAxesBinIndices(index); index_mapping(axis_inds); size_t output_index = output->toGlobalIndex( diff --git a/Device/Data/Powerfield.cpp b/Device/Data/Powerfield.cpp index c01305eb8cb..b48ef2b4962 100644 --- a/Device/Data/Powerfield.cpp +++ b/Device/Data/Powerfield.cpp @@ -158,14 +158,14 @@ PyObject* Powerfield<double>::getArray() const // filling numpy array with output_data if (rank() == 2) { - for (size_t index = 0; index < getAllocatedSize(); ++index) { + for (size_t index = 0; index < allocatedSize(); ++index) { std::vector<int> axes_indices = getAxesBinIndices(index); size_t offset = axes_indices[0] + m_axes[0]->size() * (m_axes[1]->size() - 1 - axes_indices[1]); array_buffer[offset] = (*this)[index]; } } else { - for (size_t index = 0; index < getAllocatedSize(); ++index) + for (size_t index = 0; index < allocatedSize(); ++index) *array_buffer++ = (*this)[index]; } diff --git a/Device/Data/Powerfield.h b/Device/Data/Powerfield.h index 90f22e30866..32c2ebe3b58 100644 --- a/Device/Data/Powerfield.h +++ b/Device/Data/Powerfield.h @@ -138,7 +138,7 @@ public: // retrieve basic info //! Returns total size of data buffer (product of bin number in every dimension). - size_t getAllocatedSize() const + size_t allocatedSize() const { if (m_ll_data) return m_ll_data->getTotalSize(); @@ -169,10 +169,10 @@ public: const_iterator begin() const; //! Returns read/write iterator that points to the one past last element - iterator end() { return iterator(this, getAllocatedSize()); } + iterator end() { return iterator(this, allocatedSize()); } //! Returns read-only iterator that points to the one past last element - const_iterator end() const { return const_iterator(this, getAllocatedSize()); } + const_iterator end() const { return const_iterator(this, allocatedSize()); } // coordinate and index functions @@ -357,7 +357,7 @@ inline std::vector<T> Powerfield<T>::getRawDataVector() const { ASSERT(m_ll_data); std::vector<T> result; - for (size_t i = 0; i < getAllocatedSize(); ++i) + for (size_t i = 0; i < allocatedSize(); ++i) result.push_back((*m_ll_data)[i]); return result; } @@ -458,15 +458,15 @@ void Powerfield<T>::allocate() template <class T> inline void Powerfield<T>::setRawDataVector(const std::vector<T>& data_vector) { - ASSERT(data_vector.size() == getAllocatedSize()); - for (size_t i = 0; i < getAllocatedSize(); ++i) + ASSERT(data_vector.size() == allocatedSize()); + for (size_t i = 0; i < allocatedSize(); ++i) (*m_ll_data)[i] = data_vector[i]; } template <class T> inline void Powerfield<T>::setRawDataArray(const T* source) { - for (size_t i = 0; i < getAllocatedSize(); ++i) + for (size_t i = 0; i < allocatedSize(); ++i) (*m_ll_data)[i] = source[i]; } diff --git a/Device/Data/PowerfieldIterator.h b/Device/Data/PowerfieldIterator.h index 7c7f4bd587a..d5d691506c8 100644 --- a/Device/Data/PowerfieldIterator.h +++ b/Device/Data/PowerfieldIterator.h @@ -169,7 +169,7 @@ PowerfieldIterator<TValue, TContainer>::~PowerfieldIterator() = default; template <class TValue, class TContainer> PowerfieldIterator<TValue, TContainer>& PowerfieldIterator<TValue, TContainer>::operator++() { - if (m_current_index < m_output_data->getAllocatedSize()) { + if (m_current_index < m_output_data->allocatedSize()) { ++m_current_index; } return *this; diff --git a/Device/Histo/IHistogram.cpp b/Device/Histo/IHistogram.cpp index dd8ab28a254..581d43f8f2f 100644 --- a/Device/Histo/IHistogram.cpp +++ b/Device/Histo/IHistogram.cpp @@ -37,7 +37,7 @@ IHistogram::IHistogram(const IAxis& axis_x, const IAxis& axis_y) size_t IHistogram::getTotalNumberOfBins() const { - return m_data.getAllocatedSize(); + return m_data.allocatedSize(); } const IAxis& IHistogram::xAxis() const @@ -276,7 +276,7 @@ void IHistogram::init_from_data(const Powerfield<double>& source) } m_data.copyShapeFrom(source); - for (size_t i = 0; i < source.getAllocatedSize(); ++i) + for (size_t i = 0; i < source.allocatedSize(); ++i) m_data[i].add(source[i]); } diff --git a/Device/Histo/SimulationResult.cpp b/Device/Histo/SimulationResult.cpp index e7dff16840f..a7357ede09f 100644 --- a/Device/Histo/SimulationResult.cpp +++ b/Device/Histo/SimulationResult.cpp @@ -103,7 +103,7 @@ const double& SimulationResult::operator[](size_t i) const size_t SimulationResult::size() const { - return m_data ? m_data->getAllocatedSize() : 0; + return m_data ? m_data->allocatedSize() : 0; } SimulationResult SimulationResult::relativeToMaximum() const diff --git a/Device/Mask/DetectorMask.cpp b/Device/Mask/DetectorMask.cpp index aede37399f1..12cd1767ad3 100644 --- a/Device/Mask/DetectorMask.cpp +++ b/Device/Mask/DetectorMask.cpp @@ -106,7 +106,7 @@ void DetectorMask::process_masks() return; m_number_of_masked_channels = 0; - for (size_t index = 0; index < m_masked->getAllocatedSize(); ++index) { + for (size_t index = 0; index < m_masked->allocatedSize(); ++index) { Bin1D binx = m_masked->getAxisBin(index, 0); Bin1D biny = m_masked->getAxisBin(index, 1); // setting mask to the data starting from last shape added diff --git a/GUI/Model/Data/DataItem.cpp b/GUI/Model/Data/DataItem.cpp index f43eac1603e..0554b635bc2 100644 --- a/GUI/Model/Data/DataItem.cpp +++ b/GUI/Model/Data/DataItem.cpp @@ -25,7 +25,7 @@ void DataItem::setPowerfield(Powerfield<double>* data) void DataItem::setRawDataVector(std::vector<double> data) { - if (m_data->getAllocatedSize() != data.size()) + if (m_data->allocatedSize() != data.size()) throw Error("DataItem::setRawDataVector() -> Error. " "Different data size."); std::unique_lock<std::mutex> lock(m_update_data_mutex); diff --git a/GUI/View/Loaders/AutomaticDataLoader1DResultModel.cpp b/GUI/View/Loaders/AutomaticDataLoader1DResultModel.cpp index a0264674f5c..e4088f7062b 100644 --- a/GUI/View/Loaders/AutomaticDataLoader1DResultModel.cpp +++ b/GUI/View/Loaders/AutomaticDataLoader1DResultModel.cpp @@ -32,7 +32,7 @@ int AutomaticDataLoader1DResultModel::rowCount() const if (!data) return 0; - return int(data->getAllocatedSize()); + return int(data->allocatedSize()); } bool AutomaticDataLoader1DResultModel::rowIsSkipped(int /*row*/) const diff --git a/GUI/View/Mask/MaskResultsPresenter.cpp b/GUI/View/Mask/MaskResultsPresenter.cpp index 0ac5c4cebdd..3d3952bdb0f 100644 --- a/GUI/View/Mask/MaskResultsPresenter.cpp +++ b/GUI/View/Mask/MaskResultsPresenter.cpp @@ -110,7 +110,7 @@ Powerfield<double>* MaskResultsPresenter::createMaskPresentation() const if (!detectorMask.hasMasks()) return nullptr; - for (size_t i = 0; i < result->getAllocatedSize(); ++i) + for (size_t i = 0; i < result->allocatedSize(); ++i) if (detectorMask.isMasked(i)) (*result)[i] = 0.0; diff --git a/GUI/View/PlotSpecular/SpecularPlot.cpp b/GUI/View/PlotSpecular/SpecularPlot.cpp index 11f98cf5967..51eff799080 100644 --- a/GUI/View/PlotSpecular/SpecularPlot.cpp +++ b/GUI/View/PlotSpecular/SpecularPlot.cpp @@ -241,7 +241,7 @@ void SpecularPlot::setDataFromItem(SpecularDataItem* item) if (!data) return; - for (size_t i = 0, size = data->getAllocatedSize(); i < size; ++i) { + for (size_t i = 0, size = data->allocatedSize(); i < size; ++i) { double x = data->getAxisValue(i, 0); double y = data->operator[](i); m_custom_plot->graph()->addData(x, y); diff --git a/Sim/Simulation/OffSpecularSimulation.cpp b/Sim/Simulation/OffSpecularSimulation.cpp index 9266661d006..3017368053c 100644 --- a/Sim/Simulation/OffSpecularSimulation.cpp +++ b/Sim/Simulation/OffSpecularSimulation.cpp @@ -51,7 +51,7 @@ SimulationResult OffSpecularSimulation::pack_result() checkInitialization(); const IAxis& phi_axis = detector().axis(0); size_t phi_f_size = phi_axis.size(); - ASSERT(phi_f_size * m_intensity_map.getAllocatedSize() == m_eles.size()); + ASSERT(phi_f_size * m_intensity_map.allocatedSize() == m_eles.size()); for (size_t i = 0; i < m_alpha_i_axis->size(); ++i) transferDetectorImage(i); @@ -148,7 +148,7 @@ void OffSpecularSimulation::transferDetectorImage(size_t index) size_t detector_dimension = detector().dimension(); for (size_t dim = 0; dim < detector_dimension; ++dim) detector_image.addAxis(detector().axis(dim)); - size_t detector_size = detector_image.getAllocatedSize(); + size_t detector_size = detector_image.allocatedSize(); for (size_t i = 0; i < detector_size; ++i) detector_image[i] = m_eles[index * detector_size + i]->intensity(); detector().applyDetectorResolution(&detector_image); diff --git a/Tests/Functional/Core/CoreSpecial/CoreIOPathTest.cpp b/Tests/Functional/Core/CoreSpecial/CoreIOPathTest.cpp index 74de88a6a5e..5299a509561 100644 --- a/Tests/Functional/Core/CoreSpecial/CoreIOPathTest.cpp +++ b/Tests/Functional/Core/CoreSpecial/CoreIOPathTest.cpp @@ -27,7 +27,7 @@ std::unique_ptr<Powerfield<double>> createTestData() { std::unique_ptr<Powerfield<double>> result(new Powerfield<double>); result->addAxis("x", 10, 0.0, 10.0); - for (size_t i = 0; i < result->getAllocatedSize(); ++i) + for (size_t i = 0; i < result->allocatedSize(); ++i) (*result)[i] = static_cast<double>(i); return result; } diff --git a/Tests/PyUnit/intensitydata.py b/Tests/PyUnit/intensitydata.py index 5fe2935e96d..b3ef6dcf429 100644 --- a/Tests/PyUnit/intensitydata.py +++ b/Tests/PyUnit/intensitydata.py @@ -12,7 +12,7 @@ class IntensityDataTest(unittest.TestCase): def test_empty_data(self): data = ba.IntensityData() - self.assertEqual(1, data.getAllocatedSize()) + self.assertEqual(1, data.allocatedSize()) self.assertEqual(0, data.rank()) self.assertEqual(0, data.totalSum()) @@ -37,7 +37,7 @@ class IntensityDataTest(unittest.TestCase): self.assertEqual(20, axis0.upperBound()) data = ba.IntensityData() data.addAxis(axis0) - self.assertEqual(20, data.getAllocatedSize()) + self.assertEqual(20, data.allocatedSize()) self.assertEqual(1, data.rank()) self.assertEqual(0, data.totalSum()) @@ -45,7 +45,7 @@ class IntensityDataTest(unittest.TestCase): data = ba.IntensityData() data.addAxis("axis0", 10, 0, 10) data.addAxis("axis1", 20, 0, 20) - self.assertEqual(200, data.getAllocatedSize()) + self.assertEqual(200, data.allocatedSize()) self.assertEqual(2, data.rank()) self.assertEqual(0, data.totalSum()) data.setAllTo(1) diff --git a/Tests/PyUnit/intensitydata_io.py b/Tests/PyUnit/intensitydata_io.py index 8a088805474..0a1af8a2510 100644 --- a/Tests/PyUnit/intensitydata_io.py +++ b/Tests/PyUnit/intensitydata_io.py @@ -9,14 +9,14 @@ def is_the_same_data(data1, data2): """ Checks if two data are identical """ - if data1.getAllocatedSize() != data2.getAllocatedSize(): + if data1.allocatedSize() != data2.allocatedSize(): return False if data1.rank() != data2.rank(): return False for i in range(0, data1.rank()): if data1.axis(i) != data2.axis(i): return False - for i in range(0, data1.getAllocatedSize()): + for i in range(0, data1.allocatedSize()): if data1[i] != data2[i]: return False return True diff --git a/Tests/Unit/Device/ArrayUtilsTest.cpp b/Tests/Unit/Device/ArrayUtilsTest.cpp index c3ce27f34f2..2bd34746b97 100644 --- a/Tests/Unit/Device/ArrayUtilsTest.cpp +++ b/Tests/Unit/Device/ArrayUtilsTest.cpp @@ -11,7 +11,7 @@ TEST_F(ArrayUtilsTest, PowerfieldFromVector1D) const std::vector<double> vec_double = {10.0, 20.0, 30.0, 40.0}; auto data1 = DataUtils::Array::createData(vec_double); - EXPECT_EQ(data1->getAllocatedSize(), vec_double.size()); + EXPECT_EQ(data1->allocatedSize(), vec_double.size()); EXPECT_EQ(data1->getRawDataVector(), vec_double); EXPECT_EQ(data1->axis(0).lowerBound(), 0.0); EXPECT_EQ(data1->axis(0).upperBound(), 4.0); @@ -26,7 +26,7 @@ TEST_F(ArrayUtilsTest, PowerfieldToVector1D) auto vec = DataUtils::Array::createVector1D(data); - EXPECT_EQ(vec.size(), data.getAllocatedSize()); + EXPECT_EQ(vec.size(), data.allocatedSize()); EXPECT_EQ(vec, expected); } @@ -37,7 +37,7 @@ TEST_F(ArrayUtilsTest, PowerfieldFromVector2D) auto data = DataUtils::Array::createData(vec_double); EXPECT_EQ(data->rank(), 2u); - EXPECT_EQ(data->getAllocatedSize(), 12u); + EXPECT_EQ(data->allocatedSize(), 12u); EXPECT_EQ(data->axis(0).size(), 4u); EXPECT_EQ(data->axis(0).lowerBound(), 0.0); EXPECT_EQ(data->axis(0).upperBound(), 4.0); diff --git a/Tests/Unit/Device/DetectorMaskTest.cpp b/Tests/Unit/Device/DetectorMaskTest.cpp index 540de4a0724..ba05a903bb2 100644 --- a/Tests/Unit/Device/DetectorMaskTest.cpp +++ b/Tests/Unit/Device/DetectorMaskTest.cpp @@ -48,7 +48,7 @@ TEST_F(DetectorMaskTest, AddMask) EXPECT_TRUE(detectorMask.getMaskData()->isInitialized()); - for (size_t index = 0; index < detectorMask.getMaskData()->getAllocatedSize(); ++index) { + for (size_t index = 0; index < detectorMask.getMaskData()->allocatedSize(); ++index) { double x = detectorMask.getMaskData()->getAxisValue(index, 0); double y = detectorMask.getMaskData()->getAxisValue(index, 1); if (x >= -4.0 && x <= 4.0 && y >= -2.0 && y <= 2.0) @@ -63,7 +63,7 @@ TEST_F(DetectorMaskTest, AddMask) detectorMask.addMask(polygon, false); detectorMask.initMaskData(detector.axis(0), detector.axis(1)); - for (size_t index = 0; index < detectorMask.getMaskData()->getAllocatedSize(); ++index) + for (size_t index = 0; index < detectorMask.getMaskData()->allocatedSize(); ++index) EXPECT_FALSE(detectorMask.isMasked(index)); EXPECT_EQ(detectorMask.numberOfMaskedChannels(), 0); @@ -73,7 +73,7 @@ TEST_F(DetectorMaskTest, AddMask) Polygon polygon2(x, y); detectorMask.addMask(polygon2, true); detectorMask.initMaskData(detector.axis(0), detector.axis(1)); - for (size_t index = 0; index < detectorMask.getMaskData()->getAllocatedSize(); ++index) { + for (size_t index = 0; index < detectorMask.getMaskData()->allocatedSize(); ++index) { double x = detectorMask.getMaskData()->getAxisValue(index, 0); double y = detectorMask.getMaskData()->getAxisValue(index, 1); if (x >= 5.0 && x <= 8.0 && y >= 2.0 && y <= 4.0) @@ -103,7 +103,7 @@ TEST_F(DetectorMaskTest, AssignmentOperator) EXPECT_TRUE(mask.getMaskData()->isInitialized()); - for (size_t index = 0; index < mask.getMaskData()->getAllocatedSize(); ++index) { + for (size_t index = 0; index < mask.getMaskData()->allocatedSize(); ++index) { double x = mask.getMaskData()->getAxisValue(index, 0); double y = mask.getMaskData()->getAxisValue(index, 1); if (x >= -4.0 && x <= 4.0 && y >= -2.0 && y <= 2.0) @@ -134,7 +134,7 @@ TEST_F(DetectorMaskTest, CopyConstructor) EXPECT_TRUE(mask.getMaskData()->isInitialized()); - for (size_t index = 0; index < mask.getMaskData()->getAllocatedSize(); ++index) { + for (size_t index = 0; index < mask.getMaskData()->allocatedSize(); ++index) { double x = mask.getMaskData()->getAxisValue(index, 0); double y = mask.getMaskData()->getAxisValue(index, 1); if (x >= -4.0 && x <= 4.0 && y >= -2.0 && y <= 2.0) diff --git a/Tests/Unit/Device/Histogram1DTest.cpp b/Tests/Unit/Device/Histogram1DTest.cpp index db2c2bca70e..afb1e647878 100644 --- a/Tests/Unit/Device/Histogram1DTest.cpp +++ b/Tests/Unit/Device/Histogram1DTest.cpp @@ -129,12 +129,12 @@ TEST_F(Histogram1DTest, CreateHistogram) { Powerfield<double> data; data.addAxis("x-axis", 10, 0.0, 10.0); - for (size_t i = 0; i < data.getAllocatedSize(); ++i) + for (size_t i = 0; i < data.allocatedSize(); ++i) data[i] = double(i); std::unique_ptr<IHistogram> hist(IHistogram::createHistogram(data)); EXPECT_EQ(size_t(1), hist->rank()); - EXPECT_EQ(data.getAllocatedSize(), hist->getNbinsX()); + EXPECT_EQ(data.allocatedSize(), hist->getNbinsX()); EXPECT_EQ(data.axis(0).lowerBound(), hist->xMin()); EXPECT_EQ(data.axis(0).upperBound(), hist->xMax()); for (size_t i = 0; i < hist->getTotalNumberOfBins(); ++i) { @@ -156,22 +156,22 @@ TEST_F(Histogram1DTest, CreatePowerfield) std::unique_ptr<Powerfield<double>> data(hist.createPowerfield(IHistogram::DataType::INTEGRAL)); EXPECT_EQ(size_t(1), data->rank()); - EXPECT_EQ(data->getAllocatedSize(), hist.getNbinsX()); + EXPECT_EQ(data->allocatedSize(), hist.getNbinsX()); EXPECT_EQ(data->axis(0).lowerBound(), hist.xMin()); EXPECT_EQ(data->axis(0).upperBound(), hist.xMax()); - for (size_t i = 0; i < data->getAllocatedSize(); ++i) + for (size_t i = 0; i < data->allocatedSize(); ++i) EXPECT_EQ(4.0, (*data)[i]); data.reset(hist.createPowerfield(IHistogram::DataType::AVERAGE)); - for (size_t i = 0; i < data->getAllocatedSize(); ++i) + for (size_t i = 0; i < data->allocatedSize(); ++i) EXPECT_EQ(2.0, (*data)[i]); data.reset(hist.createPowerfield(IHistogram::DataType::STANDARD_ERROR)); - for (size_t i = 0; i < data->getAllocatedSize(); ++i) + for (size_t i = 0; i < data->allocatedSize(); ++i) EXPECT_EQ(1.0, (*data)[i]); data.reset(hist.createPowerfield(IHistogram::DataType::NENTRIES)); - for (size_t i = 0; i < data->getAllocatedSize(); ++i) + for (size_t i = 0; i < data->allocatedSize(); ++i) EXPECT_EQ(2.0, (*data)[i]); } diff --git a/Tests/Unit/Device/Histogram2DTest.cpp b/Tests/Unit/Device/Histogram2DTest.cpp index f61957b9af9..0b47580a099 100644 --- a/Tests/Unit/Device/Histogram2DTest.cpp +++ b/Tests/Unit/Device/Histogram2DTest.cpp @@ -335,12 +335,12 @@ TEST_F(Histogram2DTest, CreateHistogram) Powerfield<double> data; data.addAxis("x-axis", 10, 0.0, 10.0); data.addAxis("y-axis", 5, -5.0, 0.0); - for (size_t i = 0; i < data.getAllocatedSize(); ++i) + for (size_t i = 0; i < data.allocatedSize(); ++i) data[i] = double(i); std::unique_ptr<IHistogram> h2(IHistogram::createHistogram(data)); EXPECT_EQ(size_t(2), h2->rank()); - EXPECT_EQ(data.getAllocatedSize(), h2->getTotalNumberOfBins()); + EXPECT_EQ(data.allocatedSize(), h2->getTotalNumberOfBins()); EXPECT_EQ(data.axis(0).lowerBound(), h2->xMin()); EXPECT_EQ(data.axis(0).upperBound(), h2->xMax()); EXPECT_EQ(data.axis(1).lowerBound(), h2->yMin()); @@ -367,24 +367,24 @@ TEST_F(Histogram2DTest, CreatePowerfield) std::unique_ptr<Powerfield<double>> data(h2.createPowerfield(IHistogram::DataType::INTEGRAL)); EXPECT_EQ(size_t(2), data->rank()); - EXPECT_EQ(data->getAllocatedSize(), h2.getTotalNumberOfBins()); + EXPECT_EQ(data->allocatedSize(), h2.getTotalNumberOfBins()); EXPECT_EQ(data->axis(0).lowerBound(), h2.xMin()); EXPECT_EQ(data->axis(0).upperBound(), h2.xMax()); EXPECT_EQ(data->axis(1).lowerBound(), h2.yMin()); EXPECT_EQ(data->axis(1).upperBound(), h2.yMax()); - for (size_t i = 0; i < data->getAllocatedSize(); ++i) + for (size_t i = 0; i < data->allocatedSize(); ++i) EXPECT_EQ(double(i), (*data)[i]); data.reset(h2.createPowerfield(IHistogram::DataType::AVERAGE)); - for (size_t i = 0; i < data->getAllocatedSize(); ++i) + for (size_t i = 0; i < data->allocatedSize(); ++i) EXPECT_EQ(double(i), (*data)[i]); data.reset(h2.createPowerfield(IHistogram::DataType::STANDARD_ERROR)); - for (size_t i = 0; i < data->getAllocatedSize(); ++i) + for (size_t i = 0; i < data->allocatedSize(); ++i) EXPECT_EQ(0.0, (*data)[i]); data.reset(h2.createPowerfield(IHistogram::DataType::NENTRIES)); - for (size_t i = 0; i < data->getAllocatedSize(); ++i) + for (size_t i = 0; i < data->allocatedSize(); ++i) EXPECT_EQ(1.0, (*data)[i]); } diff --git a/Tests/Unit/Device/IOReaderWriterTest.cpp b/Tests/Unit/Device/IOReaderWriterTest.cpp index c5f1685a10e..7711c1cf952 100644 --- a/Tests/Unit/Device/IOReaderWriterTest.cpp +++ b/Tests/Unit/Device/IOReaderWriterTest.cpp @@ -16,7 +16,7 @@ IOReaderWriterTest::IOReaderWriterTest() FixedBinAxis axis2("y", 10, 6.0, 7.0); m_model_data.addAxis(axis1); m_model_data.addAxis(axis2); - for (size_t i = 0, size = m_model_data.getAllocatedSize(); i < size; ++i) + for (size_t i = 0, size = m_model_data.allocatedSize(); i < size; ++i) m_model_data[i] = static_cast<double>(i); } @@ -37,7 +37,7 @@ TEST_F(IOReaderWriterTest, TestRWINT) EXPECT_EQ(m_model_data.rank(), result->rank()); compare_axis(0); compare_axis(1); - for (size_t i = 0, size = m_model_data.getAllocatedSize(); i < size; ++i) + for (size_t i = 0, size = m_model_data.allocatedSize(); i < size; ++i) EXPECT_EQ(m_model_data[i], (*result)[i]); } @@ -50,7 +50,7 @@ TEST_F(IOReaderWriterTest, TestRWNumpyTXT) ReadWriteNumpyTXT read_txt; auto result = std::unique_ptr<Powerfield<double>>(read_txt.readPowerfield(ss)); EXPECT_EQ(m_model_data.rank(), result->rank()); - for (size_t i = 0, size = m_model_data.getAllocatedSize(); i < size; ++i) + for (size_t i = 0, size = m_model_data.allocatedSize(); i < size; ++i) EXPECT_EQ(m_model_data[i], (*result)[i]); } @@ -65,7 +65,7 @@ TEST_F(IOReaderWriterTest, TestRWTiff) ReadWriteTiff read_tiff; auto result = std::unique_ptr<Powerfield<double>>(read_tiff.readPowerfield(ss)); EXPECT_EQ(m_model_data.rank(), result->rank()); - for (size_t i = 0, size = m_model_data.getAllocatedSize(); i < size; ++i) + for (size_t i = 0, size = m_model_data.allocatedSize(); i < size; ++i) EXPECT_EQ(m_model_data[i], (*result)[i]); } diff --git a/Tests/Unit/Device/IntensityDataFunctionsTest.cpp b/Tests/Unit/Device/IntensityDataFunctionsTest.cpp index 3af731a962d..1e91224aa64 100644 --- a/Tests/Unit/Device/IntensityDataFunctionsTest.cpp +++ b/Tests/Unit/Device/IntensityDataFunctionsTest.cpp @@ -13,14 +13,14 @@ TEST_F(DataUtilsTest, ClipDataSetFixed) FixedBinAxis axis1("axis1", 3, 0.0, 3.0); data.addAxis(axis1); - for (size_t i = 0; i < data.getAllocatedSize(); ++i) + for (size_t i = 0; i < data.allocatedSize(); ++i) data[i] = static_cast<double>(i); auto clip = DataUtils::Data::createClippedDataSet(data, -5.0, 0.0, -1.5, 1.5); std::vector<double> vref = {0.0, 1.0, 3.0, 4.0, 6.0, 7.0, 9.0, 10.0}; - EXPECT_EQ(clip->getAllocatedSize(), size_t(8)); + EXPECT_EQ(clip->allocatedSize(), size_t(8)); size_t index(0); - for (size_t i = 0; i < clip->getAllocatedSize(); ++i) + for (size_t i = 0; i < clip->allocatedSize(); ++i) EXPECT_EQ(vref[index++], (*clip)[i]); } @@ -35,14 +35,14 @@ TEST_F(DataUtilsTest, ClipDataSetVariable) VariableBinAxis axis1("axis1", 4, values); data.addAxis(axis1); - for (size_t i = 0; i < data.getAllocatedSize(); ++i) + for (size_t i = 0; i < data.allocatedSize(); ++i) data[i] = static_cast<double>(i); auto clip = DataUtils::Data::createClippedDataSet(data, -0.5, 0.5, 0.99, 2.0); std::vector<double> vref = {6.0, 7.0, 10.0, 11.0}; - EXPECT_EQ(clip->getAllocatedSize(), size_t(4)); + EXPECT_EQ(clip->allocatedSize(), size_t(4)); size_t index(0); - for (size_t i = 0; i < clip->getAllocatedSize(); ++i) + for (size_t i = 0; i < clip->allocatedSize(); ++i) EXPECT_EQ(vref[index++], (*clip)[i]); } @@ -154,7 +154,7 @@ TEST_F(DataUtilsTest, create2DArrayfromPowerfieldTest) Powerfield<double> out_data; out_data.addAxis("axis0", 2, 1.0, 2.0); out_data.addAxis("axis1", 3, 3.0, 4.0); - EXPECT_EQ(6u, out_data.getAllocatedSize()); + EXPECT_EQ(6u, out_data.allocatedSize()); EXPECT_EQ(2u, out_data.axis(0).size()); // no. of rows EXPECT_EQ(3u, out_data.axis(1).size()); // no. of cols diff --git a/Tests/Unit/Device/PowerfieldTest.cpp b/Tests/Unit/Device/PowerfieldTest.cpp index 14f929eee55..c1a4031eb74 100644 --- a/Tests/Unit/Device/PowerfieldTest.cpp +++ b/Tests/Unit/Device/PowerfieldTest.cpp @@ -32,7 +32,7 @@ PowerfieldTest::PowerfieldTest() TEST_F(PowerfieldTest, SizeAfterAddingAxes) { - EXPECT_EQ(2000u, db_data_3d.getAllocatedSize()); + EXPECT_EQ(2000u, db_data_3d.allocatedSize()); } TEST_F(PowerfieldTest, DataInitialization) diff --git a/Tests/Unit/Device/ReadSANSDRawTest.cpp b/Tests/Unit/Device/ReadSANSDRawTest.cpp index 53836bc36c7..edecb8ed7e2 100644 --- a/Tests/Unit/Device/ReadSANSDRawTest.cpp +++ b/Tests/Unit/Device/ReadSANSDRawTest.cpp @@ -14,6 +14,6 @@ TEST_F(ReadSANSDRawTest, Read) if (!data) return; EXPECT_EQ(data->rank(), 2); - EXPECT_EQ(data->getAllocatedSize(), 16384); + EXPECT_EQ(data->allocatedSize(), 16384); EXPECT_EQ((*data)[128 * 70 + 62], 443); } diff --git a/Tests/Unit/Device/SphericalDetectorTest.cpp b/Tests/Unit/Device/SphericalDetectorTest.cpp index 8751329e76b..f188c2970f5 100644 --- a/Tests/Unit/Device/SphericalDetectorTest.cpp +++ b/Tests/Unit/Device/SphericalDetectorTest.cpp @@ -143,7 +143,7 @@ TEST_F(SphericalDetectorTest, MaskOfDetector) detector.addMask(polygon, true); const Powerfield<bool>* mask = detector.detectorMask()->getMaskData(); - for (size_t index = 0; index < mask->getAllocatedSize(); ++index) { + for (size_t index = 0; index < mask->allocatedSize(); ++index) { double x = mask->getAxisValue(index, 0); double y = mask->getAxisValue(index, 1); if (x >= -4.0 && x <= 4.0 && y >= -2.0 && y <= 2.0) @@ -154,7 +154,7 @@ TEST_F(SphericalDetectorTest, MaskOfDetector) SphericalDetector detector2(detector); mask = detector2.detectorMask()->getMaskData(); - for (size_t index = 0; index < mask->getAllocatedSize(); ++index) { + for (size_t index = 0; index < mask->allocatedSize(); ++index) { double x = mask->getAxisValue(index, 0); double y = mask->getAxisValue(index, 1); if (x >= -4.0 && x <= 4.0 && y >= -2.0 && y <= 2.0) @@ -164,7 +164,7 @@ TEST_F(SphericalDetectorTest, MaskOfDetector) } mask = detector.detectorMask()->getMaskData(); - for (size_t index = 0; index < mask->getAllocatedSize(); ++index) { + for (size_t index = 0; index < mask->allocatedSize(); ++index) { double x = mask->getAxisValue(index, 0); double y = mask->getAxisValue(index, 1); if (x >= -4.0 && x <= 4.0 && y >= -2.0 && y <= 2.0) diff --git a/Tests/Unit/Sim/CoordSystem1DTest.cpp b/Tests/Unit/Sim/CoordSystem1DTest.cpp index 0f3d782f864..ffe0b6338bd 100644 --- a/Tests/Unit/Sim/CoordSystem1DTest.cpp +++ b/Tests/Unit/Sim/CoordSystem1DTest.cpp @@ -97,7 +97,7 @@ void CoordSystem1DTest::checkConventionalConverter(const CoordSystem1D& test_obj // NBINS auto data_nbins = test_object.createConvertedData(fake_data, Axes::Coords::NBINS); EXPECT_EQ(data_nbins->axis(0), *axis_nbins); - EXPECT_EQ(data_nbins->getAllocatedSize(), axis_nbins->size()); + EXPECT_EQ(data_nbins->allocatedSize(), axis_nbins->size()); EXPECT_EQ(raw_fake, data_nbins->getRawDataVector()); // RQ4 @@ -165,7 +165,7 @@ void CoordSystem1DTest::checkQSpecConverter(const CoordSystem1D& test_object) // NBINS auto data_nbins = test_object.createConvertedData(fake_data, Axes::Coords::NBINS); EXPECT_EQ(data_nbins->axis(0), *axis_nbins); - EXPECT_EQ(data_nbins->getAllocatedSize(), axis_nbins->size()); + EXPECT_EQ(data_nbins->allocatedSize(), axis_nbins->size()); EXPECT_EQ(raw_fake, data_nbins->getRawDataVector()); // RQ4 diff --git a/Tests/Unit/Sim/DepthProbeSimulationTest.cpp b/Tests/Unit/Sim/DepthProbeSimulationTest.cpp index 4e78318ec63..94a1c604e67 100644 --- a/Tests/Unit/Sim/DepthProbeSimulationTest.cpp +++ b/Tests/Unit/Sim/DepthProbeSimulationTest.cpp @@ -131,7 +131,7 @@ TEST_F(DepthProbeSimulationTest, ResultAquisition) EXPECT_FAILED_ASSERT(sim_result.data(Axes::Coords::MM)); const auto output = sim_result.data(); - EXPECT_EQ(depth_map->getTotalNumberOfBins(), output->getAllocatedSize()); + EXPECT_EQ(depth_map->getTotalNumberOfBins(), output->allocatedSize()); EXPECT_EQ(depth_map->rank(), output->rank()); EXPECT_EQ(depth_map->xAxis().lowerBound(), output->axis(0).lowerBound()); EXPECT_EQ(depth_map->xAxis().upperBound(), output->axis(0).upperBound()); diff --git a/Tests/Unit/Sim/SpecularSimulationTest.cpp b/Tests/Unit/Sim/SpecularSimulationTest.cpp index 951e900d675..d3da2a10f87 100644 --- a/Tests/Unit/Sim/SpecularSimulationTest.cpp +++ b/Tests/Unit/Sim/SpecularSimulationTest.cpp @@ -169,7 +169,7 @@ TEST_F(SpecularSimulationTest, ConstructSimulation) const SimulationResult sim_result = sim->simulate(); auto data = sim_result.data(); - EXPECT_EQ(data->getAllocatedSize(), 10u); + EXPECT_EQ(data->allocatedSize(), 10u); EXPECT_EQ(data->rank(), 1u); EXPECT_NEAR(0.1 * Units::deg, sim_result.convertedBinCenters(Axes::Coords::RADIANS).front(), -- GitLab