My Project
TransMult.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 
29 #ifndef OPM_PARSER_TRANSMULT_HPP
30 #define OPM_PARSER_TRANSMULT_HPP
31 
32 
33 #include <cstddef>
34 #include <map>
35 #include <memory>
36 
37 #include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
38 #include <opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.hpp>
39 
40 namespace Opm {
41  template< typename > class GridProperty;
42  class Fault;
43  class FaultCollection;
44  class DeckKeyword;
45  class FieldPropsManager;
46 
47  class TransMult {
48 
49  public:
50  TransMult() = default;
51  TransMult(const GridDims& dims, const Deck& deck, const FieldPropsManager& fp);
52 
53  static TransMult serializeObject();
54 
55  double getMultiplier(size_t globalIndex, FaceDir::DirEnum faceDir) const;
56  double getMultiplier(size_t i , size_t j , size_t k, FaceDir::DirEnum faceDir) const;
57  double getRegionMultiplier( size_t globalCellIndex1, size_t globalCellIndex2, FaceDir::DirEnum faceDir) const;
58  void applyMULT(const std::vector<double>& srcMultProp, FaceDir::DirEnum faceDir);
59  void applyMULTFLT(const FaultCollection& faults);
60  void applyMULTFLT(const Fault& fault);
61 
62  bool operator==(const TransMult& data) const;
63 
64  template<class Serializer>
65  void serializeOp(Serializer& serializer)
66  {
67  serializer(m_nx);
68  serializer(m_ny);
69  serializer(m_nz);
70  // map used to avoid explicit instances with FaceDir::DirEnum in serializer
71  serializer.template map<decltype(m_trans),false>(m_trans);
72  serializer.template map<decltype(m_names),false>(m_names);
73  m_multregtScanner.serializeOp(serializer);
74  }
75 
76  private:
77  size_t getGlobalIndex(size_t i , size_t j , size_t k) const;
78  void assertIJK(size_t i , size_t j , size_t k) const;
79  double getMultiplier__(size_t globalIndex , FaceDir::DirEnum faceDir) const;
80  bool hasDirectionProperty(FaceDir::DirEnum faceDir) const;
81  std::vector<double>& getDirectionProperty(FaceDir::DirEnum faceDir);
82 
83  size_t m_nx = 0, m_ny = 0, m_nz = 0;
84  std::map<FaceDir::DirEnum , std::vector<double> > m_trans;
85  std::map<FaceDir::DirEnum , std::string> m_names;
86  MULTREGTScanner m_multregtScanner;
87  };
88 
89 }
90 
91 #endif // OPM_PARSER_TRANSMULT_HPP
Definition: DeckKeyword.hpp:36
Definition: Deck.hpp:119
Definition: FaultCollection.hpp:35
Definition: Fault.hpp:33
Definition: FieldPropsManager.hpp:37
Definition: GridDims.hpp:32
Definition: TransMult.hpp:41
Definition: MULTREGTScanner.hpp:85
Definition: Serializer.hpp:38
Definition: TransMult.hpp:47
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29