My Project
MapAxes.hpp
1 /*
2  Copyright 2021 Equinor 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_MAPAXES_HPP
22 #define OPM_MAPAXES_HPP
23 
24 #include <array>
25 #include <optional>
26 #include <string>
27 #include <vector>
28 
29 namespace Opm {
30 
31 /*
32  This class will internalize the information needed to transform (X,Y)
33  coordinates between grid input coordinates and world coordinates based on the
34  MAPAXES keyword.
35 */
36 class Deck;
37 
38 namespace EclIO {
39 class EclFile;
40 }
41 
42 class MapAxes {
43 public:
44  MapAxes();
45  MapAxes(double X1, double Y1, double X2, double Y2, double X3, double Y3);
46  MapAxes(const std::string& mapunits, double X1, double Y1, double X2, double Y2, double X3, double Y3);
47  explicit MapAxes(EclIO::EclFile& egridfile);
48  explicit MapAxes(const Deck& deck);
49 
50  void transform(double& x, double& y) const;
51  void inv_transform(double& x, double& y) const;
52  const std::optional<std::string>& mapunits() const;
53  const std::vector<float>& input() const;
54  bool operator==(const MapAxes& other) const;
55 
56 private:
57  MapAxes(double length_factor, double X1, double Y1, double X2, double Y2, double X3, double Y3);
58  void init(double length_factor, double X1, double Y1, double X2, double Y2, double X3, double Y3);
59 
60  std::array<double, 2> origin;
61  std::array<double, 2> unit_x;
62  std::array<double, 2> unit_y;
63  std::vector<float> m_input;
64  double inv_norm = 1.0;
65  std::optional<std::string> map_units;
66 };
67 
68 
69 }
70 
71 #endif
Definition: Deck.hpp:63
Definition: EclFile.hpp:35
Definition: MapAxes.hpp:42
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29