My Project
DeckSection.hpp
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 
25 #include <opm/parser/eclipse/Deck/Deck.hpp>
26 
27 namespace Opm {
28 
29 enum class Section {
30  RUNSPEC,
31  GRID,
32  EDIT,
33  PROPS,
34  REGIONS,
35  SOLUTION,
36  SUMMARY,
37  SCHEDULE
38 };
39 
40  class UnitSystem;
41  class Parser;
42 
43 
44 class DeckSection : public DeckView {
45  public:
46  using DeckView::const_iterator;
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:
75  using DeckSection::const_iterator;
76  explicit RUNSPECSection(const Deck& deck) : DeckSection(deck, "RUNSPEC") {}
77  };
78 
79  class GRIDSection : public DeckSection {
80  public:
81  using DeckSection::const_iterator;
82  explicit GRIDSection(const Deck& deck) : DeckSection(deck, "GRID") {}
83  };
84 
85  class EDITSection : public DeckSection {
86  public:
87  using DeckSection::const_iterator;
88  explicit EDITSection(const Deck& deck) : DeckSection(deck, "EDIT") {}
89  };
90 
91  class PROPSSection : public DeckSection {
92  public:
93  using DeckSection::const_iterator;
94  explicit PROPSSection(const Deck& deck) : DeckSection(deck, "PROPS") {}
95  };
96 
97  class REGIONSSection : public DeckSection {
98  public:
99  using DeckSection::const_iterator;
100  explicit REGIONSSection(const Deck& deck) : DeckSection(deck, "REGIONS") {}
101  };
102 
103  class SOLUTIONSection : public DeckSection {
104  public:
105  using DeckSection::const_iterator;
106  explicit SOLUTIONSection(const Deck& deck) : DeckSection(deck, "SOLUTION") {}
107  };
108 
109  class SUMMARYSection : public DeckSection {
110  public:
111  using DeckSection::const_iterator;
112  explicit SUMMARYSection(const Deck& deck) : DeckSection(deck, "SUMMARY") {}
113  };
114 
115  class SCHEDULESection : public DeckSection {
116  public:
117  using DeckSection::const_iterator;
118  explicit SCHEDULESection(const Deck& deck) : DeckSection(deck, "SCHEDULE") {}
119  };
120 }
121 
122 #endif // SECTION_HPP
Definition: DeckSection.hpp:44
Definition: Deck.hpp:59
Definition: Deck.hpp:119
Definition: DeckSection.hpp:85
Definition: DeckSection.hpp:79
Definition: DeckSection.hpp:91
The hub of the parsing process.
Definition: Parser.hpp:60
Definition: DeckSection.hpp:97
Definition: DeckSection.hpp:73
Definition: DeckSection.hpp:115
Definition: DeckSection.hpp:103
Definition: DeckSection.hpp:109
Definition: UnitSystem.hpp:34
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29