allow constructing Equil from tables

also add accessors and equality operator
This commit is contained in:
Arne Morten Kvarving
2019-11-29 09:57:25 +01:00
parent d532f861ac
commit 0741f4c099
2 changed files with 24 additions and 7 deletions

View File

@@ -44,8 +44,10 @@ namespace Opm {
Equil() = default;
explicit Equil( const DeckKeyword& );
Equil(const std::vector<EquilRecord>& records);
const EquilRecord& getRecord( size_t id ) const;
const std::vector<EquilRecord>& records() const;
size_t size() const;
bool empty() const;
@@ -53,8 +55,10 @@ namespace Opm {
const_iterator begin() const;
const_iterator end() const;
bool operator==(const Equil& data) const;
private:
std::vector< EquilRecord > records;
std::vector< EquilRecord > m_records;
};
}

View File

@@ -85,27 +85,40 @@ namespace Opm {
auto wet_gas_init = record.getItem(7).get<int>(0) <= 0;
auto target_accuracy = record.getItem(8).get<int>(0);
this->records.push_back( EquilRecord(datum_depth_arg, datum_depth_pc_arg, woc_depth, woc_pc, goc_depth, goc_pc, live_oil_init, wet_gas_init, target_accuracy) );
this->m_records.push_back( EquilRecord(datum_depth_arg, datum_depth_pc_arg, woc_depth, woc_pc, goc_depth, goc_pc, live_oil_init, wet_gas_init, target_accuracy) );
}
}
Equil::Equil(const std::vector<EquilRecord>& records) :
m_records(records)
{
}
const EquilRecord& Equil::getRecord( size_t id ) const {
return this->records.at( id );
return this->m_records.at( id );
}
const std::vector<EquilRecord>& Equil::records() const {
return m_records;
}
size_t Equil::size() const {
return this->records.size();
return this->m_records.size();
}
bool Equil::empty() const {
return this->records.empty();
return this->m_records.empty();
}
Equil::const_iterator Equil::begin() const {
return this->records.begin();
return this->m_records.begin();
}
Equil::const_iterator Equil::end() const {
return this->records.end();
return this->m_records.end();
}
bool Equil::operator==(const Equil& data) const {
return this->records() == data.records();
}
}