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