Files
opm-common/opm/parser/eclipse/EclipseState/Grid/Box.hpp

86 lines
2.2 KiB
C++
Raw Normal View History

/*
Copyright 2014 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BOX_HPP_
#define BOX_HPP_
#include <vector>
2014-06-02 18:14:24 +02:00
#include <cstddef>
namespace Opm {
2019-11-13 20:19:47 +01:00
class DeckRecord;
class EclipseGrid;
2019-11-13 20:19:47 +01:00
class Box {
public:
2019-10-21 15:45:39 +02:00
struct cell_index {
std::size_t global_index;
std::size_t active_index;
std::size_t data_index;
2019-11-02 10:27:28 +01:00
cell_index(std::size_t g,std::size_t a, std::size_t d) :
global_index(g),
active_index(a),
data_index(d)
{}
};
Box(const EclipseGrid& grid);
Box(const EclipseGrid& grid , int i1 , int i2 , int j1 , int j2 , int k1 , int k2);
2019-11-13 20:19:47 +01:00
void update(const DeckRecord& deckRecord);
void reset();
size_t size() const;
bool isGlobal() const;
size_t getDim(size_t idim) const;
2019-10-21 15:45:39 +02:00
const std::vector<cell_index>& index_list() const;
const std::vector<size_t>& getIndexList() const;
bool equal(const Box& other) const;
2014-05-26 18:47:15 +02:00
2018-01-18 12:43:43 +01:00
int I1() const;
int I2() const;
int J1() const;
int J2() const;
int K1() const;
int K2() const;
private:
2019-11-13 20:19:47 +01:00
void init(int i1, int i2, int j1, int j2, int k1, int k2);
void initIndexList();
const EclipseGrid& grid;
2019-11-13 20:19:47 +01:00
size_t m_stride[3];
size_t m_dims[3] = { 0, 0, 0 };
size_t m_offset[3];
2014-05-26 18:47:15 +02:00
bool m_isGlobal;
std::vector<size_t> global_index_list;
2019-10-21 15:45:39 +02:00
std::vector<cell_index> m_index_list;
2018-01-18 12:43:43 +01:00
int lower(int dim) const;
int upper(int dim) const;
};
}
#endif