Add begin() and end() to Box.
This commit is contained in:
@@ -103,6 +103,16 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::vector<size_t>::const_iterator Box::begin() const {
|
||||
return m_indexList.begin();
|
||||
}
|
||||
|
||||
std::vector<size_t>::const_iterator Box::end() const {
|
||||
return m_indexList.end();
|
||||
}
|
||||
|
||||
|
||||
const std::vector<size_t>& Box::getIndexList() const {
|
||||
return m_indexList;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,8 @@ namespace Opm {
|
||||
bool equal(const Box& other) const;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
std::vector<size_t>::const_iterator begin() const;
|
||||
std::vector<size_t>::const_iterator end() const;
|
||||
|
||||
private:
|
||||
void initIndexList();
|
||||
|
||||
@@ -53,10 +53,16 @@ BOOST_AUTO_TEST_CASE(CreateBox) {
|
||||
for (i=0; i < box.getDim(0); i++) {
|
||||
size_t g = i + j*box.getDim(0) + k*box.getDim(0)*box.getDim(1);
|
||||
BOOST_CHECK_EQUAL( indexList[g] , g);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i = 0;
|
||||
for (auto index : box) {
|
||||
BOOST_CHECK_EQUAL( index , indexList[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user