My Project
Loading...
Searching...
No Matches
ScheduleBlock.hpp
1/*
2 Copyright 2021 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#ifndef SCHEDULE_BLOCK_HPP
20#define SCHEDULE_BLOCK_HPP
21
22#include <opm/common/OpmLog/KeywordLocation.hpp>
23#include <opm/common/utility/TimeService.hpp>
24
25#include <opm/input/eclipse/Deck/DeckKeyword.hpp>
26
27#include <cstddef>
28#include <optional>
29#include <vector>
30
31namespace Opm {
32 class UnitSystem;
33}
34
35namespace Opm {
36
37class DeckOutput;
38
39enum class ScheduleTimeType {
40 START = 0,
41 DATES = 1,
42 TSTEP = 2,
43 RESTART = 3,
44};
45
46/*
47 The ScheduleBlock is collection of all the Schedule keywords from one
48 report step.
49*/
50
52{
53public:
54 ScheduleBlock() = default;
55 ScheduleBlock(const KeywordLocation& location,
56 ScheduleTimeType time_type,
57 const time_point& start_time);
58 std::size_t size() const;
59 void push_back(const DeckKeyword& keyword);
60 std::optional<DeckKeyword> get(const std::string& kw) const;
61 const time_point& start_time() const;
62 const std::optional<time_point>& end_time() const;
63 void end_time(const time_point& t);
64 ScheduleTimeType time_type() const;
65 const KeywordLocation& location() const;
66 const DeckKeyword& operator[](const std::size_t index) const;
67 std::vector<DeckKeyword>::const_iterator begin() const;
68 std::vector<DeckKeyword>::const_iterator end() const;
69
70 bool operator==(const ScheduleBlock& other) const;
71 static ScheduleBlock serializationTestObject();
72
73 template<class Serializer>
74 void serializeOp(Serializer& serializer)
75 {
76 serializer(m_time_type);
77 serializer(m_start_time);
78 serializer(m_end_time);
79 serializer(m_keywords);
80 serializer(m_location);
81 }
82
83 void dump_deck(const UnitSystem& usys,
84 DeckOutput& output,
85 time_point& current_time) const;
86
87private:
88 ScheduleTimeType m_time_type;
89 time_point m_start_time;
90 std::optional<time_point> m_end_time;
91 KeywordLocation m_location;
92 std::vector<DeckKeyword> m_keywords;
93
94 void dump_time(const UnitSystem& usys,
95 time_point current_time,
96 DeckOutput& output) const;
97
98 void writeDates(DeckOutput& output) const;
99
100 void writeTStep(const UnitSystem& usys,
101 time_point current_time,
102 DeckOutput& output) const;
103};
104
105} // end namespace Opm
106
107#endif // SCHEDULE_BLOCK_HPP
Definition DeckKeyword.hpp:36
Definition DeckOutput.hpp:29
Definition KeywordLocation.hpp:27
Definition ScheduleBlock.hpp:52
Class for (de-)serializing.
Definition Serializer.hpp:84
Definition UnitSystem.hpp:34
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30