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