Skip to content
Snippets Groups Projects
Commit be58497f authored by Matthias Puchner's avatar Matthias Puchner
Browse files

remove error prone and unused method "index"

was not in use at all, only in tests. Only roiIndex and detectorIndex shall be used
parent b75798f2
No related branches found
No related tags found
1 merge request!81Refactorings no. 2 for the upcoming removing of "region of interest" (ROI)
......@@ -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;
......
......@@ -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());
}
......
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