Loading...
Searching...
No Matches
ConnectionIndexMap.hpp
/*
Copyright 2016 SINTEF ICT, Applied Mathematics.
Copyright 2016 - 2017 Statoil ASA.
Copyright 2017 Dr. Blatt - HPC-Simulation-Software & Services
Copyright 2016 - 2018 IRIS AS
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_CONNECTION_INDEX_MAP_HEADER_INCLUDED
#define OPM_CONNECTION_INDEX_MAP_HEADER_INCLUDED
#include <cstddef>
#include <vector>
namespace Opm {
class ConnectionIndexMap
{
public:
explicit ConnectionIndexMap(const std::size_t numConns)
: local_(numConns, -1)
{
this->global_.reserve(numConns);
this->open_.reserve(numConns);
}
void addActiveConnection(const int connIdx,
const bool connIsOpen)
{
this->local_[connIdx] =
static_cast<int>(this->global_.size());
this->global_.push_back(connIdx);
const auto open_conn_idx = connIsOpen
? this->num_open_conns_++
: -1;
this->open_.push_back(open_conn_idx);
}
const std::vector<int>& local() const
{
return this->local_;
}
int global(const int connIdx) const
{
return this->global_[connIdx];
}
int open(const int connIdx) const
{
return this->open_[connIdx];
}
private:
std::vector<int> local_{};
std::vector<int> global_{};
std::vector<int> open_{};
int num_open_conns_{0};
};
} // namespace Opm
#endif
Opm::ConnectionIndexMap::addActiveConnection
void addActiveConnection(const int connIdx, const bool connIsOpen)
Enumerate/map new active connection.
Definition ConnectionIndexMap.hpp:53
Opm::ConnectionIndexMap::ConnectionIndexMap
ConnectionIndexMap(const std::size_t numConns)
Constructor.
Definition ConnectionIndexMap.hpp:39
Opm::ConnectionIndexMap::local
const std::vector< int > & local() const
Get local connection IDs/indices of every existing well connection.
Definition ConnectionIndexMap.hpp:73
Opm::ConnectionIndexMap::global
int global(const int connIdx) const
Get global connection ID of local (on-rank) connection.
Definition ConnectionIndexMap.hpp:83
Opm::ConnectionIndexMap::open
int open(const int connIdx) const
Get open connection ID of local (on-rank) connection.
Definition ConnectionIndexMap.hpp:95
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43