Box.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 BOX_HPP_
22 #define BOX_HPP_
23 
24 #include <vector>
25 #include <cstddef>
26 
27 namespace Opm {
28 
29  class Box {
30  public:
31  Box(int nx , int ny , int nz);
32  Box(const Box& globalBox , int i1 , int i2 , int j1 , int j2 , int k1 , int k2); // Zero offset coordinates.
33  size_t size() const;
34  bool isGlobal() const;
35  size_t getDim(size_t idim) const;
36  const std::vector<size_t>& getIndexList() const;
37  bool equal(const Box& other) const;
38 
39 
40  private:
41  void initIndexList();
42  static void assertDims(const Box& globalBox, size_t idim , int l1 , int l2);
43  size_t m_dims[3];
44  size_t m_offset[3];
45  size_t m_stride[3];
46 
47  bool m_isGlobal;
48  std::vector<size_t> m_indexList;
49  };
50 }
51 
52 
53 #endif
const std::vector< size_t > & getIndexList() const
Definition: Deck.hpp:29
size_t size() const
bool equal(const Box &other) const
Box(int nx, int ny, int nz)
bool isGlobal() const
size_t getDim(size_t idim) const
Definition: Box.hpp:29