diff --git a/Device/Detector/SimulationAreaIterator.h b/Device/Detector/SimulationAreaIterator.h index d938bbc31a69a2f59a5cebf440db101aa7fb611f..d55fa2f1160ccef38f8513f9765a4bb62e3c216e 100644 --- a/Device/Detector/SimulationAreaIterator.h +++ b/Device/Detector/SimulationAreaIterator.h @@ -49,7 +49,6 @@ public: //! Convenience function to create an end-iterator matching to this iterator. SimulationAreaIterator createEnd() const; - size_t index() const { return m_index; } size_t roiIndex() const; size_t detectorIndex() const; @@ -65,8 +64,8 @@ public: private: size_t nextIndex(size_t currentIndex); - //! Check whether masked according to the given mode (always false if mode is regionOfInterest). - //! index is an ROI index. + //! Check whether masked according to the actual mode (always false if mode is + //! regionOfInterest). index is an ROI index. bool isMasked(size_t index) const; const IDetector* m_detector; diff --git a/Tests/UnitTests/Core/Instrument/SimulationAreaTest.cpp b/Tests/UnitTests/Core/Instrument/SimulationAreaTest.cpp index 894ed78547e7270721dcec13cf89e3d1c614292d..6345063281089e35aca5b8587e42707d21a551fe 100644 --- a/Tests/UnitTests/Core/Instrument/SimulationAreaTest.cpp +++ b/Tests/UnitTests/Core/Instrument/SimulationAreaTest.cpp @@ -16,13 +16,13 @@ TEST_F(SimulationAreaTest, iteratorOperations) // begin iterator SimulationAreaIterator it_begin = detector.beginNonMaskedPoints(); - EXPECT_EQ(it_begin.index(), 0u); + EXPECT_EQ(it_begin.roiIndex(), 0u); EXPECT_TRUE(it_begin == detector.beginNonMaskedPoints()); EXPECT_FALSE(it_begin != detector.beginNonMaskedPoints()); // end iterator SimulationAreaIterator it_end = detector.endNonMaskedPoints(); - EXPECT_EQ(it_end.index(), detector.totalSize()); + EXPECT_EQ(it_end.roiIndex(), detector.totalSize()); // begin/end comparison EXPECT_TRUE(it_begin != it_end); @@ -35,16 +35,16 @@ TEST_F(SimulationAreaTest, iteratorOperations) // increment it++; - EXPECT_EQ(it.index(), 1u); + EXPECT_EQ(it.roiIndex(), 1u); EXPECT_TRUE(it != it_begin); EXPECT_FALSE(it == it_begin); ++it; - EXPECT_EQ(it.index(), 2u); + EXPECT_EQ(it.roiIndex(), 2u); // incrementing well behind the end for (size_t i = 0; i < 100; ++i) ++it; - EXPECT_EQ(it.index(), detector.totalSize()); + EXPECT_EQ(it.roiIndex(), detector.totalSize()); } //! Iteration over non-masked detector @@ -58,7 +58,7 @@ TEST_F(SimulationAreaTest, detectorIteration) std::vector<size_t> indexes; std::vector<size_t> detectorIndexes; for (auto it = detector.beginNonMaskedPoints(); it != detector.endNonMaskedPoints(); ++it) { - indexes.push_back(it.index()); + indexes.push_back(it.roiIndex()); detectorIndexes.push_back(it.detectorIndex()); } EXPECT_EQ(indexes, expectedIndexes); @@ -76,7 +76,7 @@ TEST_F(SimulationAreaTest, maskedIteration) std::vector<size_t> expectedIndexes = {0, 1, 2, 3, 4, 7, 8, 11, 12, 15, 16, 17, 18}; std::vector<size_t> indexes; for (auto it = detector.beginNonMaskedPoints(); it != detector.endNonMaskedPoints(); ++it) - indexes.push_back(it.index()); + indexes.push_back(it.roiIndex()); EXPECT_EQ(indexes, expectedIndexes); } @@ -93,7 +93,7 @@ TEST_F(SimulationAreaTest, maskedCornerIteration) std::vector<size_t> indexes; std::vector<size_t> elementIndexes; for (auto it = detector.beginNonMaskedPoints(); it != detector.endNonMaskedPoints(); ++it) - indexes.push_back(it.index()); + indexes.push_back(it.roiIndex()); EXPECT_EQ(indexes, expectedIndexes); } @@ -107,7 +107,7 @@ TEST_F(SimulationAreaTest, allMaskedIteration) std::vector<size_t> indexes; for (auto it = detector.beginNonMaskedPoints(); it != detector.endNonMaskedPoints(); ++it) - indexes.push_back(it.index()); + indexes.push_back(it.roiIndex()); EXPECT_EQ(indexes.size(), size_t(0)); } @@ -127,7 +127,7 @@ TEST_F(SimulationAreaTest, maskAndRoiIteration) std::vector<size_t> detectorIndexes; std::vector<size_t> roiIndexes; for (auto it = detector.beginNonMaskedPoints(); it != detector.endNonMaskedPoints(); ++it) { - indexes.push_back(it.index()); + indexes.push_back(it.roiIndex()); detectorIndexes.push_back(it.detectorIndex()); roiIndexes.push_back(it.roiIndex()); } @@ -140,7 +140,7 @@ TEST_F(SimulationAreaTest, maskAndRoiIteration) detectorIndexes.clear(); roiIndexes.clear(); detector.iterateOverNonMaskedPoints([&](IDetector::const_iterator it) { - indexes.push_back(it.index()); + indexes.push_back(it.roiIndex()); detectorIndexes.push_back(it.detectorIndex()); roiIndexes.push_back(it.roiIndex()); }); @@ -164,7 +164,7 @@ TEST_F(SimulationAreaTest, maskAndRoiIterationVisitMasks) std::vector<size_t> roiIndexes; for (auto it = detector.beginRegionOfInterestPoints(); it != detector.endRegionOfInterestPoints(); ++it) { - indexes.push_back(it.index()); + indexes.push_back(it.roiIndex()); detectorIndexes.push_back(it.detectorIndex()); roiIndexes.push_back(it.roiIndex()); } @@ -177,7 +177,7 @@ TEST_F(SimulationAreaTest, maskAndRoiIterationVisitMasks) detectorIndexes.clear(); roiIndexes.clear(); detector.iterateOverRegionOfInterest([&](IDetector::const_iterator it) { - indexes.push_back(it.index()); + indexes.push_back(it.roiIndex()); detectorIndexes.push_back(it.detectorIndex()); roiIndexes.push_back(it.roiIndex()); }); @@ -201,7 +201,7 @@ TEST_F(SimulationAreaTest, indexInRoi) std::vector<size_t> roiIndexes; std::vector<size_t> detectorIndexes; for (auto it = detector.beginNonMaskedPoints(); it != detector.endNonMaskedPoints(); ++it) { - indexes.push_back(it.index()); + indexes.push_back(it.roiIndex()); roiIndexes.push_back(it.roiIndex()); detectorIndexes.push_back(it.detectorIndex()); }