21 #ifndef OPM_WELLSWITCHINGLOGGER_HEADER_INCLUDED
22 #define OPM_WELLSWITCHINGLOGGER_HEADER_INCLUDED
29 #include <dune/common/parallel/mpihelper.hh>
31 #include <opm/common/OpmLog/OpmLog.hpp>
33 #include <opm/core/well_controls.h>
46 typedef std::map<std::string, std::array<char,2> > SwitchMap;
50 typedef Dune::CollectiveCommunication<typename Dune::MPIHelper::MPICommunicator>
57 Dune::MPIHelper::getCollectiveCommunication())
71 using Pair =
typename SwitchMap::value_type;
72 switchMap_.insert(Pair(name, {char(from), char(to)}));
76 std::ostringstream ss;
77 ss <<
" Switching control mode for well " << name
78 <<
" from " << modestring[from]
79 <<
" to " << modestring[to];
80 OpmLog::info(ss.str());
90 void unpackDataAndLog(std::vector<char>& recv_buffer,
91 const std::vector<int>& displ);
93 void packData(std::vector<int>& well_name_length,
94 std::vector<char>& buffer);
96 int calculateMessageSize(std::vector<int>& well_name_length);
98 void logSwitch(
const char* name, std::array<char,2> fromto,
103 void gatherDataAndLog();
106 SwitchMap switchMap_;
110 const std::string modestring[4] = {
"BHP",
"THP",
"RESERVOIR_RATE",
"SURFACE_RATE" };
void wellSwitched(std::string name, WellControlType from, WellControlType to)
Log that a well switched.
Definition: WellSwitchingLogger.hpp:65
Utility class to handle the log messages about well switching.
Definition: WellSwitchingLogger.hpp:44
~WellSwitchingLogger()
Destructor send does the actual logging.
Definition: WellSwitchingLogger.cpp:200
Dune::CollectiveCommunication< typename Dune::MPIHelper::MPICommunicator > Communication
The type of the collective communication used.
Definition: WellSwitchingLogger.hpp:51
WellSwitchingLogger(const Communication &cc=Dune::MPIHelper::getCollectiveCommunication())
Constructor.
Definition: WellSwitchingLogger.hpp:56