From b0c6e43cf84e3990a0c3ab912ad7586fef54818e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Wed, 15 Jun 2016 08:57:20 +0200 Subject: [PATCH 1/2] Add operator== and operator!= to PhasePresence. This makes it simpler to write code debugging or inspecting changed phase configurations. --- opm/core/props/BlackoilPhases.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opm/core/props/BlackoilPhases.hpp b/opm/core/props/BlackoilPhases.hpp index ebfd1f72a..679fd95da 100644 --- a/opm/core/props/BlackoilPhases.hpp +++ b/opm/core/props/BlackoilPhases.hpp @@ -60,6 +60,9 @@ namespace Opm void setFreeOil () { insert(BlackoilPhases::Liquid); } void setFreeGas () { insert(BlackoilPhases::Vapour); } + bool operator==(const PhasePresence& other) { return present_ == other.present_; } + bool operator!=(const PhasePresence& other) { return !this->operator==(other); } + private: unsigned char present_; From d065a2c095eeb79a4acf5eedbd647edc655bd52c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Wed, 15 Jun 2016 09:20:19 +0200 Subject: [PATCH 2/2] Make new ops const. --- opm/core/props/BlackoilPhases.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opm/core/props/BlackoilPhases.hpp b/opm/core/props/BlackoilPhases.hpp index 679fd95da..981588ff7 100644 --- a/opm/core/props/BlackoilPhases.hpp +++ b/opm/core/props/BlackoilPhases.hpp @@ -60,8 +60,8 @@ namespace Opm void setFreeOil () { insert(BlackoilPhases::Liquid); } void setFreeGas () { insert(BlackoilPhases::Vapour); } - bool operator==(const PhasePresence& other) { return present_ == other.present_; } - bool operator!=(const PhasePresence& other) { return !this->operator==(other); } + bool operator==(const PhasePresence& other) const { return present_ == other.present_; } + bool operator!=(const PhasePresence& other) const { return !this->operator==(other); } private: unsigned char present_;