Add accessor and constructor for serialization

This commit is contained in:
Joakim Hove
2020-02-05 21:57:57 +01:00
parent f91630a62d
commit 140a1c0bf3
3 changed files with 14 additions and 0 deletions

View File

@@ -69,10 +69,12 @@ namespace Opm {
};
AquiferCT(const TableManager& tables, const Deck& deck);
AquiferCT(const std::vector<AquiferCT::AQUCT_data>& data);
std::size_t size() const;
std::vector<AquiferCT::AQUCT_data>::const_iterator begin() const;
std::vector<AquiferCT::AQUCT_data>::const_iterator end() const;
const std::vector<AquiferCT::AQUCT_data>& data() const;
bool operator==(const AquiferCT& other) const;
private:
std::vector<AquiferCT::AQUCT_data> m_aquct;

View File

@@ -107,6 +107,10 @@ AquiferCT::AquiferCT(const TableManager& tables, const Deck& deck)
this->m_aquct.emplace_back(record, tables);
}
AquiferCT::AquiferCT(const std::vector<AquiferCT::AQUCT_data>& data) :
m_aquct(data)
{}
std::size_t AquiferCT::size() const {
return this->m_aquct.size();
@@ -123,4 +127,9 @@ std::vector<AquiferCT::AQUCT_data>::const_iterator AquiferCT::end() const {
bool AquiferCT::operator==(const AquiferCT& other) const {
return this->m_aquct == other.m_aquct;
}
const std::vector<AquiferCT::AQUCT_data>& AquiferCT::data() const {
return this->m_aquct;
}
}

View File

@@ -127,5 +127,8 @@ BOOST_AUTO_TEST_CASE(AquiferCTTest){
BOOST_CHECK_EQUAL(it.inftableID , 2);
BOOST_CHECK(it.p0.first == false);
}
auto data = aquiferct.data();
AquiferCT aq2(data);
BOOST_CHECK( aq2 == aquiferct );
}
}