My Project
Loading...
Searching...
No Matches
Events.hpp
1/*
2 Copyright 2015 Statoil 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#ifndef SCHEDULE_EVENTS_HPP
20#define SCHEDULE_EVENTS_HPP
21
22#include <cstdint>
23#include <string>
24#include <unordered_map>
25
26namespace Opm
27{
28 namespace ScheduleEvents {
29 // These values are used as bitmask - 2^n structure is essential.
30 enum Events : std::uint64_t {
36 NEW_WELL = (UINT64_C(1) << 0),
37
41 WELL_WELSPECS_UPDATE = (UINT64_C(1) << 1),
42
43 // WELL_POLYMER_UPDATE = (UINT64_C(1) << 2),
44
47 NEW_GROUP = (UINT64_C(1) << 3),
48
54 PRODUCTION_UPDATE = (UINT64_C(1) << 4),
55 INJECTION_UPDATE = (UINT64_C(1) << 5),
56 //POLYMER_UPDATES = (UINT64_C(1) << 6),
57
61 WELL_STATUS_CHANGE = (UINT64_C(1) << 7),
62
64 COMPLETION_CHANGE = (UINT64_C(1) << 8),
65
67 GROUP_CHANGE = (UINT64_C(1) << 9),
68
70 GEO_MODIFIER = (UINT64_C(1) << 10),
71
73 TUNING_CHANGE = (UINT64_C(1) << 11),
74
76 VFPINJ_UPDATE = (UINT64_C(1) << 12),
77 VFPPROD_UPDATE = (UINT64_C(1) << 13),
78
80 GROUP_PRODUCTION_UPDATE = (UINT64_C(1) << 14),
81 GROUP_INJECTION_UPDATE = (UINT64_C(1) << 15),
82
84 WELL_PRODUCTIVITY_INDEX = (UINT64_C(1) << 16),
85
87 WELLGROUP_EFFICIENCY_UPDATE = (UINT64_C(1) << 17),
88
90 INJECTION_TYPE_CHANGED = (UINT64_C(1) << 18),
91
93 WELL_SWITCHED_INJECTOR_PRODUCER = (UINT64_C(1) << 19),
94
96 ACTIONX_WELL_EVENT = (UINT64_C(1) << 20),
97
103 REQUEST_OPEN_WELL = (UINT64_C(1) << 21),
104 };
105 } // namespace ScheduleEvents
106
125 class Events
126 {
127 public:
130
134 void addEvent(ScheduleEvents::Events event);
135
140 void clearEvent(std::uint64_t eventMask);
141
143 void reset();
144
149 void merge(const Events& events);
150
158 bool hasEvent(std::uint64_t eventMask) const;
159
167 bool operator==(const Events& data) const;
168
174 template<class Serializer>
175 void serializeOp(Serializer& serializer)
176 {
177 serializer(m_events);
178 }
179
180 private:
182 std::uint64_t m_events = 0;
183 };
184
188 {
189 public:
192
196 void addWell(const std::string& wname);
197
202 void addGroup(const std::string& gname);
203
210 void addEvent(const std::string& wgname, ScheduleEvents::Events event);
211
220 void clearEvent(const std::string& wgname, std::uint64_t eventMask);
221
226 void reset();
227
232 void merge(const WellGroupEvents& events);
233
241 bool has(const std::string& wgname) const;
242
253 bool hasEvent(const std::string& wgname, std::uint64_t eventMask) const;
254
264 const Events& at(const std::string& wgname) const;
265
273 bool operator==(const WellGroupEvents& data) const;
274
280 template<class Serializer>
281 void serializeOp(Serializer& serializer)
282 {
283 serializer(m_wellgroup_events);
284 }
285
286 private:
288 std::unordered_map<std::string, Events> m_wellgroup_events{};
289 };
290
291} // namespace Opm
292
293#endif // SCHEDULE_EVENTS_HPP
Events tied to a time and applicable to the simulation or an individual well or group.
Definition Events.hpp:126
void clearEvent(std::uint64_t eventMask)
Remove one or more events from collection.
Definition Events.cpp:43
void reset()
Remove all events from collection.
Definition Events.cpp:50
void merge(const Events &events)
Merge current event collection with other.
Definition Events.cpp:55
bool operator==(const Events &data) const
Equality predicate.
Definition Events.cpp:65
static Events serializationTestObject()
Create a serialisation test object.
Definition Events.cpp:31
void addEvent(ScheduleEvents::Events event)
Incorporate a new event into collection.
Definition Events.cpp:38
bool hasEvent(std::uint64_t eventMask) const
Event existence predicate.
Definition Events.cpp:60
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition Events.hpp:175
Class for (de-)serializing.
Definition Serializer.hpp:94
Collection of events tied to a time and associated to specific, named wells or groups.
Definition Events.hpp:188
void merge(const WellGroupEvents &events)
Merge current event collection with other.
Definition Events.cpp:129
void addWell(const std::string &wname)
Include a named well into the events collection.
Definition Events.cpp:80
bool operator==(const WellGroupEvents &data) const
Equality predicate.
Definition Events.cpp:167
bool hasEvent(const std::string &wgname, std::uint64_t eventMask) const
Query current collection for one or more specific events associated to a specific well or group.
Definition Events.cpp:144
const Events & at(const std::string &wgname) const
Look up collection of events for named well or group.
Definition Events.cpp:155
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition Events.hpp:281
void addGroup(const std::string &gname)
Include a named group in the events collection.
Definition Events.cpp:88
void addEvent(const std::string &wgname, ScheduleEvents::Events event)
Add a single event for a named well or group.
Definition Events.cpp:96
bool has(const std::string &wgname) const
Check if any events have ever been registered for a named well or group.
Definition Events.cpp:138
void reset()
Remove all events for all known wells and groups.
Definition Events.cpp:118
void clearEvent(const std::string &wgname, std::uint64_t eventMask)
Remove one or more individual events from the collection tied to a single named well or group.
Definition Events.cpp:109
static WellGroupEvents serializationTestObject()
Create a serialisation test object.
Definition Events.cpp:72
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30