Add size() method to EclFile

This commit is contained in:
Joakim Hove 2019-10-30 09:28:35 +01:00
parent 292d00417c
commit 290368985a
3 changed files with 9 additions and 0 deletions

View File

@ -64,6 +64,7 @@ public:
bool hasKey(const std::string &name) const;
const std::vector<std::string>& arrayNames() const { return array_name; }
std::size_t size() const;
protected:
bool formatted;

View File

@ -898,4 +898,10 @@ const std::vector<std::string>& EclFile::get<std::string>(const std::string &nam
return getImpl(search->second, CHAR, char_array, "string");
}
std::size_t EclFile::size() const {
return this->array_name.size();
}
}} // namespace Opm::ecl

View File

@ -272,6 +272,8 @@ BOOST_AUTO_TEST_CASE(TestEcl_Write_formatted_not_finite) {
BOOST_CHECK(std::isinf(d[0]));
BOOST_CHECK(std::isnan(f[1]));
BOOST_CHECK(std::isnan(d[1]));
BOOST_CHECK_EQUAL(file1.size(), 2);
}