GasLiftCommon.hpp
Go to the documentation of this file.
1/*
2 Copyright 2022 Equinor ASA.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_GASLIFT_COMMON_HEADER_INCLUDED
21#define OPM_GASLIFT_COMMON_HEADER_INCLUDED
22
24
25#include <string>
26
27namespace Opm
28{
29
30class DeferredLogger;
31template<class Scalar> class GroupState;
32template<class Scalar> class WellState;
33
35{
36public:
37 virtual ~GasLiftCommon() = default;
38
39protected:
41 WellState<double>& well_state,
42 const GroupState<double>& group_state,
43 DeferredLogger &deferred_logger,
44 const Parallel::Communication& comm,
45 bool debug
46 );
47 enum class MessageType { INFO, WARNING };
48
50 virtual void displayDebugMessage_(const std::string& msg) const = 0;
51 void displayDebugMessageOnRank0_(const std::string &msg) const;
53 const std::string& prefix,
54 const std::string& msg,
55 MessageType msg_type = MessageType::INFO) const;
56
61 bool debug;
62 // By setting this variable to true we restrict some debug output
63 // to only be printed for rank 0. By setting this variable to false we keep
64 // the output on all ranks. This can in some cases be helpful as a debugging
65 // aid to check that the output is in fact identical over all ranks
67};
68
69} // namespace Opm
70
71#endif // OPM_GASLIFT_COMMON_INCLUDED
Definition: DeferredLogger.hpp:57
Definition: GasLiftCommon.hpp:35
const Parallel::Communication & comm_
Definition: GasLiftCommon.hpp:60
WellState< double > & well_state_
Definition: GasLiftCommon.hpp:57
int debugUpdateGlobalCounter_() const
bool debug
Definition: GasLiftCommon.hpp:61
DeferredLogger & deferred_logger_
Definition: GasLiftCommon.hpp:59
virtual ~GasLiftCommon()=default
virtual void displayDebugMessage_(const std::string &msg) const =0
const GroupState< double > & group_state_
Definition: GasLiftCommon.hpp:58
GasLiftCommon(WellState< double > &well_state, const GroupState< double > &group_state, DeferredLogger &deferred_logger, const Parallel::Communication &comm, bool debug)
void displayDebugMessageOnRank0_(const std::string &msg) const
MessageType
Definition: GasLiftCommon.hpp:47
void logMessage_(const std::string &prefix, const std::string &msg, MessageType msg_type=MessageType::INFO) const
bool debug_output_only_on_rank0
Definition: GasLiftCommon.hpp:66
Dune::Communication< MPIComm > Communication
Definition: ParallelCommunication.hpp:30
Definition: BlackoilPhases.hpp:27