My Project
MULTREGTScanner.hpp
1 /*
2  Copyright 2014 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 
21 #ifndef OPM_PARSER_MULTREGTSCANNER_HPP
22 #define OPM_PARSER_MULTREGTSCANNER_HPP
23 
24 #include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
25 
26 namespace Opm {
27 
28  class DeckRecord;
29  class DeckKeyword;
30  class FieldPropsManager;
31  class GridDims;
32 
33  namespace MULTREGT {
34 
35 
36  enum NNCBehaviourEnum {
37  NNC = 1,
38  NONNC = 2,
39  ALL = 3,
40  NOAQUNNC = 4
41  };
42 
43  std::string RegionNameFromDeckValue(const std::string& stringValue);
44  NNCBehaviourEnum NNCBehaviourFromString(const std::string& stringValue);
45  }
46 
47 
48 
49 
50  struct MULTREGTRecord {
51  int src_value;
52  int target_value;
53  double trans_mult;
54  int directions;
55  MULTREGT::NNCBehaviourEnum nnc_behaviour;
56  std::string region_name;
57 
58  bool operator==(const MULTREGTRecord& data) const {
59  return src_value == data.src_value &&
60  target_value == data.target_value &&
61  trans_mult == data.trans_mult &&
62  directions == data.directions &&
63  nnc_behaviour == data.nnc_behaviour &&
64  region_name == data.region_name;
65  }
66 
67  template<class Serializer>
68  void serializeOp(Serializer& serializer)
69  {
70  serializer(src_value);
71  serializer(target_value);
72  serializer(trans_mult);
73  serializer(directions);
74  serializer(nnc_behaviour);
75  serializer(region_name);
76  }
77  };
78 
79  typedef std::map< std::pair<int , int> , const MULTREGTRecord * > MULTREGTSearchMap;
80  typedef std::tuple<size_t , FaceDir::DirEnum , double> MULTREGTConnection;
81 
82 
83 
85 
86  public:
87  using ExternalSearchMap = std::map<std::string, std::map<std::pair<int,int>, int>>;
88 
89  MULTREGTScanner() = default;
90  MULTREGTScanner(const MULTREGTScanner& data);
91  MULTREGTScanner(const GridDims& grid,
92  const FieldPropsManager* fp_arg,
93  const std::vector< const DeckKeyword* >& keywords);
94 
95  static MULTREGTScanner serializationTestObject();
96 
97  double getRegionMultiplier(size_t globalCellIdx1, size_t globalCellIdx2, FaceDir::DirEnum faceDir) const;
98 
99  bool operator==(const MULTREGTScanner& data) const;
100  MULTREGTScanner& operator=(const MULTREGTScanner& data);
101 
102  template<class Serializer>
103  void serializeOp(Serializer& serializer)
104  {
105  serializer(nx);
106  serializer(ny);
107  serializer(nz);
108  serializer(m_records);
109  ExternalSearchMap searchMap = getSearchMap();
110  serializer(searchMap);
111  if (m_searchMap.empty())
112  constructSearchMap(searchMap);
113  serializer(regions);
114  serializer(default_region);
115  }
116 
117  private:
118  ExternalSearchMap getSearchMap() const;
119  void constructSearchMap(const ExternalSearchMap& searchMap);
120 
121  void addKeyword( const DeckKeyword& deckKeyword, const std::string& defaultRegion);
122  void assertKeywordSupported(const DeckKeyword& deckKeyword);
123  std::size_t nx = 0,ny = 0, nz = 0;
124  const FieldPropsManager* fp = nullptr;
125  std::vector< MULTREGTRecord > m_records;
126  std::map<std::string , MULTREGTSearchMap> m_searchMap;
127  std::map<std::string, std::vector<int>> regions;
128  std::string default_region;
129  };
130 
131 }
132 
133 #endif // OPM_PARSER_MULTREGTSCANNER_HPP
Definition: DeckKeyword.hpp:36
Definition: FieldPropsManager.hpp:38
Definition: GridDims.hpp:31
Definition: MULTREGTScanner.hpp:84
Class for (de-)serializing.
Definition: Serializer.hpp:75
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29
Definition: MULTREGTScanner.hpp:50