Loading...
Searching...
No Matches
ActiveIndexByColumns.hpp
/*
Copyright (c) 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 OPM_ACTIVE_INDEX_BY_COLUMNS_HPP
#define OPM_ACTIVE_INDEX_BY_COLUMNS_HPP
#include <array>
#include <cassert>
#include <cstddef>
#include <functional>
#include <vector>
namespace Opm {
class EclipseGrid;
}
namespace Opm {
class ActiveIndexByColumns
{
public:
bool operator==(const ActiveIndexByColumns& rhs) const;
explicit ActiveIndexByColumns(const std::size_t numActive,
const std::array<int, 3>& cartDims,
const std::function<std::array<int, 3>(const std::size_t)>& getIJK);
int getColumnarActiveIndex(const std::size_t naturalActiveIndex) const
{
assert ((naturalActiveIndex < this->natural2columnar_.size())
&& "Natural active cell index out of bounds");
return this->natural2columnar_[naturalActiveIndex];
}
private:
std::vector<int> natural2columnar_;
};
ActiveIndexByColumns buildColumnarActiveIndexMappingTables(const EclipseGrid& grid);
} // namespace Opm
#endif // OPM_ACTIVE_INDEX_BY_COLUMNS_HPP
Opm::ActiveIndexByColumns::ActiveIndexByColumns
ActiveIndexByColumns(const std::size_t numActive, const std::array< int, 3 > &cartDims, const std::function< std::array< int, 3 >(const std::size_t)> &getIJK)
Create natural->columnar active cell index mapping.
Definition ActiveIndexByColumns.cpp:130
Opm::ActiveIndexByColumns::getColumnarActiveIndex
int getColumnarActiveIndex(const std::size_t naturalActiveIndex) const
Map active index in natural order to active index in columnar order.
Definition ActiveIndexByColumns.hpp:57
Opm::EclipseGrid
About cell information and dimension: The actual grid information is held in a pointer to an ERT ecl_...
Definition EclipseGrid.hpp:61
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Opm::buildColumnarActiveIndexMappingTables
ActiveIndexByColumns buildColumnarActiveIndexMappingTables(const EclipseGrid &grid)
Build natural->columnar active cell index mapping from an EclipseGrid instance.
Definition ActiveIndexByColumns.cpp:137