From 0c599b88685262be6a8b2ee16e8db681cc0d5f6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Wed, 24 Oct 2012 21:12:29 +0200 Subject: [PATCH] Fix well classification that was only correct by accident Specifically, the tests if (!wells->type[self_index] == INJECTOR) if (!wells->type[self_index] == PRODUCER) produced the expected results *only* because INJECTOR==0 and PRODUCER==1 in the WellType enumeration, thus (!INJECTOR == PRODUCER) and (!PRODUCER == INJECTOR). Installing the (much) more appropriate if (wells->type[self_index] != INJECTOR) if (wells->type[self_index] != PRODUCER) is not only more readable, it is also future-proof and scales better if we ever introduce new WellTypes (e.g., a MONITOR). --- opm/core/wells/WellsGroup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opm/core/wells/WellsGroup.cpp b/opm/core/wells/WellsGroup.cpp index e1bed0cb0..d34d36982 100644 --- a/opm/core/wells/WellsGroup.cpp +++ b/opm/core/wells/WellsGroup.cpp @@ -794,7 +794,7 @@ namespace Opm && (injSpec().control_mode_ != InjectionSpecification::GRUP && injSpec().control_mode_ != InjectionSpecification::NONE)) { return; } - if (!wells_->type[self_index_] == INJECTOR) { + if (wells_->type[self_index_] != INJECTOR) { ASSERT(target == 0.0); return; } @@ -871,7 +871,7 @@ namespace Opm std::cout << "Returning" << std::endl; return; } - if (!wells_->type[self_index_] == PRODUCER) { + if (wells_->type[self_index_] != PRODUCER) { ASSERT(target == 0.0); return; }