allow constructing PolyInjTables from variables

also add equality operator
This commit is contained in:
Arne Morten Kvarving
2019-12-02 21:45:35 +01:00
parent ceb4b1e287
commit 6ccdaaa635
2 changed files with 28 additions and 1 deletions

View File

@@ -44,18 +44,26 @@ namespace Opm {
class PolyInjTable {
public:
PolyInjTable() = default;
PolyInjTable(const std::vector<double>& throughputs,
const std::vector<double>& velocities,
int tableNumber,
const std::vector<std::vector<double>>& data);
int getTableNumber() const;
const std::vector<double>& getThroughputs() const;
const std::vector<double>& getVelocities() const;
const std::vector<std::vector<double>>& getTableData() const;
bool operator==(const PolyInjTable& data) const;
protected:
std::vector<double> m_throughputs;
std::vector<double> m_velocities;
// TODO: maybe not needed, since this is also stored in the std::map
int m_table_number;
int m_table_number = 0;
// each vector corresponds to the values corresponds to one value related to one x sampling point
// as a result, the number of the vector should be equal to be the size of m_x_points,

View File

@@ -38,6 +38,17 @@ namespace Opm{
// PolyInjTable
PolyInjTable::PolyInjTable(const std::vector<double>& throughputs,
const std::vector<double>& velocities,
int tableNumber,
const std::vector<std::vector<double>>& data)
: m_throughputs(throughputs)
, m_velocities(velocities)
, m_table_number(tableNumber)
, m_data(data)
{
}
int PolyInjTable::getTableNumber() const
{
return m_table_number;
@@ -58,6 +69,14 @@ namespace Opm{
return m_data;
}
bool PolyInjTable::operator==(const PolyInjTable& data) const
{
return this->getTableNumber() == data.getTableNumber() &&
this->getThroughputs() == data.getThroughputs() &&
this->getVelocities() == data.getVelocities() &&
this->getTableData() == data.getTableData();
}
// PlymwinjTable