make Valve constructible from variables
also make it default constructible and equality operator
This commit is contained in:
@@ -38,7 +38,16 @@ namespace Opm {
|
||||
SHUT
|
||||
};
|
||||
|
||||
Valve();
|
||||
explicit Valve(const DeckRecord& record);
|
||||
Valve(double conFlowCoeff,
|
||||
double conCrossA,
|
||||
double conMaxCrossA,
|
||||
double pipeAddLength,
|
||||
double pipeDiam,
|
||||
double pipeRough,
|
||||
double pipeCrossA,
|
||||
Status stat);
|
||||
|
||||
// the function will return a map
|
||||
// [
|
||||
@@ -67,9 +76,11 @@ namespace Opm {
|
||||
void setPipeRoughness(const double rou);
|
||||
void setPipeCrossArea(const double area);
|
||||
|
||||
bool operator==(const Valve& data) const;
|
||||
|
||||
private:
|
||||
const double m_con_flow_coeff;
|
||||
const double m_con_cross_area;
|
||||
double m_con_flow_coeff;
|
||||
double m_con_cross_area;
|
||||
double m_con_max_cross_area;
|
||||
|
||||
double m_pipe_additional_length;
|
||||
|
||||
@@ -26,6 +26,30 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
Valve::Valve()
|
||||
: Valve(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Status::SHUT)
|
||||
{
|
||||
}
|
||||
|
||||
Valve::Valve(double conFlowCoeff,
|
||||
double conCrossA,
|
||||
double conMaxCrossA,
|
||||
double pipeAddLength,
|
||||
double pipeDiam,
|
||||
double pipeRough,
|
||||
double pipeCrossA,
|
||||
Status stat)
|
||||
: m_con_flow_coeff(conFlowCoeff)
|
||||
, m_con_cross_area(conCrossA)
|
||||
, m_con_max_cross_area(conMaxCrossA)
|
||||
, m_pipe_additional_length(pipeAddLength)
|
||||
, m_pipe_diameter(pipeDiam)
|
||||
, m_pipe_roughness(pipeRough)
|
||||
, m_pipe_cross_area(pipeCrossA)
|
||||
, m_status(stat)
|
||||
{
|
||||
}
|
||||
|
||||
Valve::Valve(const DeckRecord& record)
|
||||
: m_con_flow_coeff(record.getItem("CV").get<double>(0))
|
||||
, m_con_cross_area(record.getItem("AREA").get<double>(0))
|
||||
@@ -140,4 +164,15 @@ namespace Opm {
|
||||
void Valve::setPipeAdditionalLength(const double length) {
|
||||
m_pipe_additional_length = length;
|
||||
}
|
||||
|
||||
bool Valve::operator==(const Valve& data) const {
|
||||
return this->conFlowCoefficient() == data.conFlowCoefficient() &&
|
||||
this->conCrossArea() == data.conCrossArea() &&
|
||||
this->conMaxCrossArea() == data.conMaxCrossArea() &&
|
||||
this->pipeAdditionalLength() == data.pipeAdditionalLength() &&
|
||||
this->pipeDiameter() == data.pipeDiameter() &&
|
||||
this->pipeRoughness() == data.pipeRoughness() &&
|
||||
this->pipeCrossArea() == data.pipeCrossArea() &&
|
||||
this->status() == data.status();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user