diff --git a/opm/simulators/wells/GasLiftCommon.cpp b/opm/simulators/wells/GasLiftCommon.cpp index 96e4231d5..44ddea157 100644 --- a/opm/simulators/wells/GasLiftCommon.cpp +++ b/opm/simulators/wells/GasLiftCommon.cpp @@ -28,30 +28,27 @@ namespace Opm { -GasLiftCommon:: -GasLiftCommon( - WellState& well_state, - const GroupState& group_state, - DeferredLogger &deferred_logger, - const Parallel::Communication& comm, - bool glift_debug -) : - well_state_{well_state}, - group_state_{group_state}, - deferred_logger_{deferred_logger}, - comm_{comm}, - debug{glift_debug} -{ - -} +template +GasLiftCommon:: +GasLiftCommon(WellState& well_state, + const GroupState& group_state, + DeferredLogger& deferred_logger, + const Parallel::Communication& comm, + bool glift_debug) + : well_state_{well_state} + , group_state_{group_state} + , deferred_logger_{deferred_logger} + , comm_{comm} + , debug{glift_debug} +{} /**************************************** * Protected methods in alphabetical order ****************************************/ +template int -GasLiftCommon:: -debugUpdateGlobalCounter_() const +GasLiftCommon::debugUpdateGlobalCounter_() const { auto count = this->well_state_.gliftUpdateDebugCounter(); const std::string msg = fmt::format("global counter = {}", count); @@ -59,9 +56,9 @@ debugUpdateGlobalCounter_() const return count; } -void -GasLiftCommon:: -displayDebugMessageOnRank0_(const std::string &msg) const +template +void GasLiftCommon:: +displayDebugMessageOnRank0_(const std::string& msg) const { // This output should be identical for all ranks. @@ -71,12 +68,13 @@ displayDebugMessageOnRank0_(const std::string &msg) const } } -void -GasLiftCommon:: -logMessage_( - const std::string& prefix, const std::string& msg, MessageType msg_type) const +template +void GasLiftCommon:: +logMessage_(const std::string& prefix, + const std::string& msg, + MessageType msg_type) const { - std::string rank = ""; + std::string rank; if (this->comm_.size() > 1) { rank = fmt::format(" Rank #{} :", this->comm_.rank()); } @@ -105,9 +103,6 @@ logMessage_( } } -/**************************************** - * Private methods in alphabetical order - ****************************************/ - +template class GasLiftCommon; } // namespace Opm diff --git a/opm/simulators/wells/GasLiftCommon.hpp b/opm/simulators/wells/GasLiftCommon.hpp index 54c25cb64..38561e6d6 100644 --- a/opm/simulators/wells/GasLiftCommon.hpp +++ b/opm/simulators/wells/GasLiftCommon.hpp @@ -24,39 +24,37 @@ #include -namespace Opm -{ +namespace Opm { class DeferredLogger; template class GroupState; template class WellState; +template class GasLiftCommon { public: virtual ~GasLiftCommon() = default; protected: - GasLiftCommon( - WellState& well_state, - const GroupState& group_state, - DeferredLogger &deferred_logger, - const Parallel::Communication& comm, - bool debug - ); + GasLiftCommon(WellState& well_state, + const GroupState& group_state, + DeferredLogger& deferred_logger, + const Parallel::Communication& comm, + bool glift_debug); + enum class MessageType { INFO, WARNING }; int debugUpdateGlobalCounter_() const; virtual void displayDebugMessage_(const std::string& msg) const = 0; - void displayDebugMessageOnRank0_(const std::string &msg) const; - void logMessage_( - const std::string& prefix, - const std::string& msg, - MessageType msg_type = MessageType::INFO) const; + void displayDebugMessageOnRank0_(const std::string& msg) const; + void logMessage_(const std::string& prefix, + const std::string& msg, + MessageType msg_type = MessageType::INFO) const; - WellState& well_state_; - const GroupState& group_state_; - DeferredLogger &deferred_logger_; + WellState& well_state_; + const GroupState& group_state_; + DeferredLogger& deferred_logger_; const Parallel::Communication& comm_; bool debug; // By setting this variable to true we restrict some debug output diff --git a/opm/simulators/wells/GasLiftGroupInfo.hpp b/opm/simulators/wells/GasLiftGroupInfo.hpp index 6e242a4c9..0ac1cbdc0 100644 --- a/opm/simulators/wells/GasLiftGroupInfo.hpp +++ b/opm/simulators/wells/GasLiftGroupInfo.hpp @@ -41,7 +41,7 @@ class SummaryState; class Well; template class WellState; -class GasLiftGroupInfo : public GasLiftCommon +class GasLiftGroupInfo : public GasLiftCommon { protected: class GroupRates; diff --git a/opm/simulators/wells/GasLiftSingleWellGeneric.hpp b/opm/simulators/wells/GasLiftSingleWellGeneric.hpp index f1c9cdf70..6a77ec44f 100644 --- a/opm/simulators/wells/GasLiftSingleWellGeneric.hpp +++ b/opm/simulators/wells/GasLiftSingleWellGeneric.hpp @@ -45,7 +45,7 @@ class WellInterfaceGeneric; template class WellState; template class GroupState; -class GasLiftSingleWellGeneric : public GasLiftCommon +class GasLiftSingleWellGeneric : public GasLiftCommon { protected: static constexpr int Water = BlackoilPhases::Aqua; diff --git a/opm/simulators/wells/GasLiftStage2.hpp b/opm/simulators/wells/GasLiftStage2.hpp index 50df116fb..5ac02ad3f 100644 --- a/opm/simulators/wells/GasLiftStage2.hpp +++ b/opm/simulators/wells/GasLiftStage2.hpp @@ -42,7 +42,7 @@ class Schedule; class WellInterfaceGeneric; template class WellState; -class GasLiftStage2 : public GasLiftCommon { +class GasLiftStage2 : public GasLiftCommon { using GasLiftSingleWell = GasLiftSingleWellGeneric; using GLiftOptWells = std::map>; using GLiftProdWells = std::map;