DeckSection.hpp
Go to the documentation of this file.
1/*
2 Copyright 2013 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
20#ifndef SECTION_HPP
21#define SECTION_HPP
22
23#include <string>
24
26
27namespace Opm {
28
29enum class Section {
30 RUNSPEC,
31 GRID,
32 EDIT,
33 PROPS,
34 REGIONS,
36 SUMMARY,
38};
39
40 class UnitSystem;
41 class Parser;
42
43
44class DeckSection : public DeckView {
45 public:
47
48 DeckSection( const Deck& deck, const std::string& startKeyword );
49 const std::string& name() const;
50 const UnitSystem& unitSystem() const;
51
52 static bool hasRUNSPEC( const Deck& );
53 static bool hasGRID( const Deck& );
54 static bool hasEDIT( const Deck& );
55 static bool hasPROPS( const Deck& );
56 static bool hasREGIONS( const Deck& );
57 static bool hasSOLUTION( const Deck& );
58 static bool hasSUMMARY( const Deck& );
59 static bool hasSCHEDULE( const Deck& );
60
61 // returns whether the deck has all mandatory sections and if all sections are in
62 // the right order
63 static bool checkSectionTopology(const Deck& deck,
64 const Parser&,
65 bool ensureKeywordSectionAffiliation = false);
66
67 private:
68 std::string section_name;
69 const UnitSystem& units;
70
71 };
72
73 class RUNSPECSection : public DeckSection {
74 public:
76 explicit RUNSPECSection(const Deck& deck) : DeckSection(deck, "RUNSPEC") {}
77 };
78
79 class GRIDSection : public DeckSection {
80 public:
82 explicit GRIDSection(const Deck& deck) : DeckSection(deck, "GRID") {}
83 };
84
85 class EDITSection : public DeckSection {
86 public:
88 explicit EDITSection(const Deck& deck) : DeckSection(deck, "EDIT") {}
89 };
90
91 class PROPSSection : public DeckSection {
92 public:
94 explicit PROPSSection(const Deck& deck) : DeckSection(deck, "PROPS") {}
95 };
96
97 class REGIONSSection : public DeckSection {
98 public:
100 explicit REGIONSSection(const Deck& deck) : DeckSection(deck, "REGIONS") {}
101 };
102
104 public:
106 explicit SOLUTIONSection(const Deck& deck) : DeckSection(deck, "SOLUTION") {}
107 };
108
110 public:
112 explicit SUMMARYSection(const Deck& deck) : DeckSection(deck, "SUMMARY") {}
113 };
114
116 public:
118 explicit SCHEDULESection(const Deck& deck) : DeckSection(deck, "SCHEDULE") {}
119 };
120}
121
122#endif // SECTION_HPP
const char *const string
Definition: cJSON.h:170
Definition: Deck.hpp:115
Definition: DeckSection.hpp:44
static bool hasSUMMARY(const Deck &)
static bool hasREGIONS(const Deck &)
const UnitSystem & unitSystem() const
static bool hasGRID(const Deck &)
DeckSection(const Deck &deck, const std::string &startKeyword)
const std::string & name() const
std::vector< DeckKeyword >::const_iterator const_iterator
Definition: Deck.hpp:59
static bool hasSCHEDULE(const Deck &)
static bool hasSOLUTION(const Deck &)
static bool hasPROPS(const Deck &)
static bool hasRUNSPEC(const Deck &)
static bool checkSectionTopology(const Deck &deck, const Parser &, bool ensureKeywordSectionAffiliation=false)
static bool hasEDIT(const Deck &)
Definition: Deck.hpp:57
std::vector< DeckKeyword >::const_iterator const_iterator
Definition: Deck.hpp:59
Definition: DeckSection.hpp:85
EDITSection(const Deck &deck)
Definition: DeckSection.hpp:88
Definition: DeckSection.hpp:79
GRIDSection(const Deck &deck)
Definition: DeckSection.hpp:82
Definition: DeckSection.hpp:91
PROPSSection(const Deck &deck)
Definition: DeckSection.hpp:94
Definition: custom-opm-common/opm-common/opm/parser/eclipse/Parser/Parser.hpp:54
Definition: DeckSection.hpp:97
REGIONSSection(const Deck &deck)
Definition: DeckSection.hpp:100
Definition: DeckSection.hpp:73
RUNSPECSection(const Deck &deck)
Definition: DeckSection.hpp:76
Definition: DeckSection.hpp:115
SCHEDULESection(const Deck &deck)
Definition: DeckSection.hpp:118
Definition: DeckSection.hpp:103
SOLUTIONSection(const Deck &deck)
Definition: DeckSection.hpp:106
Definition: DeckSection.hpp:109
SUMMARYSection(const Deck &deck)
Definition: DeckSection.hpp:112
Definition: UnitSystem.hpp:32
Definition: A.hpp:4
Section
Definition: DeckSection.hpp:29