Loading...
Searching...
No Matches
CompletedCells.hpp
/*
Copyright 2021 Equinor 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 COMPLETED_CELLS
#define COMPLETED_CELLS
#include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
#include <array>
#include <cstddef>
#include <optional>
#include <unordered_map>
#include <utility>
namespace Opm {
class CompletedCells
{
public:
struct Cell
{
struct Props
{
std::size_t active_index{};
double permx{};
double permy{};
double permz{};
double poro{};
double ntg{};
int satnum{};
int pvtnum{};
bool operator==(const Props& other) const;
static Props serializationTestObject();
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(this->active_index);
serializer(this->permx);
serializer(this->permy);
serializer(this->permz);
serializer(this->poro);
serializer(this->satnum);
serializer(this->pvtnum);
serializer(this->ntg);
}
};
Cell() = default;
Cell(const std::size_t g,
const std::size_t i_,
const std::size_t j_,
const std::size_t k_)
: global_index(g)
, i(i_)
, j(j_)
, k(k_)
{}
std::size_t global_index{};
std::size_t i{};
std::size_t j{};
std::size_t k{};
double depth{};
std::array<double, 3> dimensions{};
std::optional<Props> props{};
bool is_active() const;
std::size_t active_index() const;
bool operator==(const Cell& other) const;
static Cell serializationTestObject();
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(this->global_index);
serializer(this->i);
serializer(this->j);
serializer(this->k);
serializer(this->props);
serializer(this->depth);
serializer(this->dimensions);
}
};
CompletedCells() = default;
explicit CompletedCells(const GridDims& dims);
CompletedCells(std::size_t nx, std::size_t ny, std::size_t nz);
const Cell& get(std::size_t i, std::size_t j, std::size_t k) const;
std::pair<Cell*, bool>
try_get(std::size_t i, std::size_t j, std::size_t k);
bool operator==(const CompletedCells& other) const;
static CompletedCells serializationTestObject();
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(this->dims);
serializer(this->cells);
}
private:
GridDims dims;
std::unordered_map<std::size_t, Cell> cells{};
};
} // namespace Opm
#endif // COMPLETED_CELLS
Opm::CompletedCells::serializeOp
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition CompletedCells.hpp:257
Opm::CompletedCells::try_get
std::pair< Cell *, bool > try_get(std::size_t i, std::size_t j, std::size_t k)
Retrieve, and possibly create, an intersected cell.
Definition CompletedCells.cpp:114
Opm::CompletedCells::CompletedCells
CompletedCells()=default
Default constructor.
Opm::CompletedCells::serializationTestObject
static CompletedCells serializationTestObject()
Create a serialisation test object.
Definition CompletedCells.cpp:133
Opm::CompletedCells::operator==
bool operator==(const CompletedCells &other) const
Equality predicate.
Definition CompletedCells.cpp:125
Opm::CompletedCells::get
const Cell & get(std::size_t i, std::size_t j, std::size_t k) const
Retrieve intersected cell.
Definition CompletedCells.cpp:106
Opm::GridDims
Definition GridDims.hpp:31
Opm::Serializer
Class for (de-)serializing.
Definition Serializer.hpp:94
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Opm::CompletedCells::Cell::Props
Property data of intersected cell.
Definition CompletedCells.hpp:44
Opm::CompletedCells::Cell::Props::active_index
std::size_t active_index
Cell's active index in the range [0 .
Definition CompletedCells.hpp:48
Opm::CompletedCells::Cell::Props::operator==
bool operator==(const Props &other) const
Equality predicate.
Definition CompletedCells.cpp:28
Opm::CompletedCells::Cell::Props::satnum
int satnum
Cell's saturation region.
Definition CompletedCells.hpp:66
Opm::CompletedCells::Cell::Props::serializeOp
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition CompletedCells.hpp:89
Opm::CompletedCells::Cell::Props::pvtnum
int pvtnum
Cell's PVT region index.
Definition CompletedCells.hpp:69
Opm::CompletedCells::Cell::Props::permy
double permy
Cell's permeability component in the grid's Y direction.
Definition CompletedCells.hpp:54
Opm::CompletedCells::Cell::Props::poro
double poro
Cell's porosity.
Definition CompletedCells.hpp:60
Opm::CompletedCells::Cell::Props::permx
double permx
Cell's permeability component in the grid's X direction.
Definition CompletedCells.hpp:51
Opm::CompletedCells::Cell::Props::permz
double permz
Cell's permeability component in the grid's Z direction.
Definition CompletedCells.hpp:57
Opm::CompletedCells::Cell::Props::ntg
double ntg
Cell's net-to-gross ratio.
Definition CompletedCells.hpp:63
Opm::CompletedCells::Cell::Props::serializationTestObject
static Props serializationTestObject()
Create a serialisation test object.
Definition CompletedCells.cpp:42
Opm::CompletedCells::Cell
Identification and associate properties of cell intersected by one or more well connections.
Definition CompletedCells.hpp:41
Opm::CompletedCells::Cell::depth
double depth
Depth of cell centre.
Definition CompletedCells.hpp:146
Opm::CompletedCells::Cell::Cell
Cell()=default
Default constructor.
Opm::CompletedCells::Cell::serializationTestObject
static Cell serializationTestObject()
Create a serialisation test object.
Definition CompletedCells.cpp:82
Opm::CompletedCells::Cell::global_index
std::size_t global_index
Linearised Cartesian cell index.
Definition CompletedCells.hpp:134
Opm::CompletedCells::Cell::active_index
std::size_t active_index() const
Retrieve cell's active index grid.
Definition CompletedCells.cpp:64
Opm::CompletedCells::Cell::serializeOp
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition CompletedCells.hpp:182
Opm::CompletedCells::Cell::Cell
Cell(const std::size_t g, const std::size_t i_, const std::size_t j_, const std::size_t k_)
Constructor.
Definition CompletedCells.hpp:121
Opm::CompletedCells::Cell::k
std::size_t k
Cartesian K index relative to grid origin.
Definition CompletedCells.hpp:143
Opm::CompletedCells::Cell::operator==
bool operator==(const Cell &other) const
Equality predicate.
Definition CompletedCells.cpp:69
Opm::CompletedCells::Cell::i
std::size_t i
Cartesian I index relative to grid origin.
Definition CompletedCells.hpp:137
Opm::CompletedCells::Cell::props
std::optional< Props > props
Cell property data.
Definition CompletedCells.hpp:154
Opm::CompletedCells::Cell::j
std::size_t j
Cartesian J index relative to grid origin.
Definition CompletedCells.hpp:140
Opm::CompletedCells::Cell::dimensions
std::array< double, 3 > dimensions
Physical cell extents.
Definition CompletedCells.hpp:149
Opm::CompletedCells::Cell::is_active
bool is_active() const
Check if cell is discovered and has associated property data.
Definition CompletedCells.cpp:59