make UDQAssign constructible from variables
also make it default constructible, add accessors and equality operator
This commit is contained in:
@@ -49,11 +49,21 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
UDQAssign();
|
||||
UDQAssign(const std::string& keyword, const std::vector<std::string>& selector, double value);
|
||||
UDQAssign(const std::string& keyword,
|
||||
UDQVarType varType,
|
||||
const std::vector<AssignRecord>& records);
|
||||
|
||||
const std::string& keyword() const;
|
||||
UDQVarType var_type() const;
|
||||
void add_record(const std::vector<std::string>& selector, double value);
|
||||
UDQSet eval(const std::vector<std::string>& wells) const;
|
||||
|
||||
const std::vector<AssignRecord>& getRecords() const;
|
||||
|
||||
bool operator==(const UDQAssign& data) const;
|
||||
|
||||
private:
|
||||
std::string m_keyword;
|
||||
UDQVarType m_var_type;
|
||||
|
||||
@@ -22,6 +22,11 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
UDQAssign::UDQAssign() :
|
||||
m_var_type(UDQVarType::NONE)
|
||||
{
|
||||
}
|
||||
|
||||
UDQAssign::UDQAssign(const std::string& keyword, const std::vector<std::string>& selector, double value) :
|
||||
m_keyword(keyword),
|
||||
m_var_type(UDQ::varType(keyword))
|
||||
@@ -29,6 +34,15 @@ UDQAssign::UDQAssign(const std::string& keyword, const std::vector<std::string>&
|
||||
this->add_record(selector, value);
|
||||
}
|
||||
|
||||
UDQAssign::UDQAssign(const std::string& keyword,
|
||||
UDQVarType varType,
|
||||
const std::vector<AssignRecord>& record) :
|
||||
m_keyword(keyword),
|
||||
m_var_type(varType),
|
||||
records(record)
|
||||
{
|
||||
}
|
||||
|
||||
void UDQAssign::add_record(const std::vector<std::string>& selector, double value) {
|
||||
this->records.push_back({selector, value});
|
||||
}
|
||||
@@ -58,4 +72,15 @@ UDQSet UDQAssign::eval(const std::vector<std::string>& wells) const {
|
||||
}
|
||||
throw std::invalid_argument("Not yet implemented");
|
||||
}
|
||||
|
||||
const std::vector<UDQAssign::AssignRecord>& UDQAssign::getRecords() const {
|
||||
return records;
|
||||
}
|
||||
|
||||
bool UDQAssign::operator==(const UDQAssign& data) const {
|
||||
return this->keyword() == data.keyword() &&
|
||||
this->var_type() == data.var_type() &&
|
||||
this->getRecords() == data.getRecords();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user