Loading...
Searching...
No Matches
ParallelNLDDPartitioningZoltan.hpp
/*
Copyright 2023 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_UTILITY_PARALLEL_NLDD_PARTITIONING_ZOLTAN_HPP
#define OPM_UTILITY_PARALLEL_NLDD_PARTITIONING_ZOLTAN_HPP
#include <opm/simulators/utils/ParallelCommunication.hpp>
#include <cstddef>
#include <functional>
#include <map>
#include <string>
#include <utility>
#include <vector>
namespace Opm {
class ParallelNLDDPartitioningZoltan
{
public:
using GlobalCellID = std::function<int(int)>;
using ZoltanParamMap = std::map<std::string, std::string>;
explicit ParallelNLDDPartitioningZoltan(const Parallel::Communication comm,
const std::size_t numElements,
const GlobalCellID& globalCell)
: comm_ { comm }
, numElements_ { numElements }
, globalCell_ { globalCell }
{}
void registerConnection(std::size_t c1, std::size_t c2)
{
this->conns_.emplace_back(c1, c2);
}
std::vector<int>
partitionElements(const ZoltanParamMap& params) const;
void addVertexGroup(const std::vector<int>& vertices);
private:
using Connection = std::pair<std::size_t, std::size_t>;
std::vector<std::vector<int>> vertexGroups_{};
Parallel::Communication comm_{};
std::size_t numElements_{};
GlobalCellID globalCell_{};
std::vector<Connection> conns_{};
};
} // namespace Opm
#endif // OPM_UTILITY_PARALLEL_NLDD_PARTITIONING_ZOLTAN_HPP
Opm::ParallelNLDDPartitioningZoltan::registerConnection
void registerConnection(std::size_t c1, std::size_t c2)
Insert directed graph edge between two vertices.
Definition ParallelNLDDPartitioningZoltan.hpp:69
Opm::ParallelNLDDPartitioningZoltan::addVertexGroup
void addVertexGroup(const std::vector< int > &vertices)
Add a group of vertices that should be merged together.
Definition ParallelNLDDPartitioningZoltan.cpp:562
Opm::ParallelNLDDPartitioningZoltan::partitionElements
std::vector< int > partitionElements(const ZoltanParamMap &params) const
Partition connectivity graph using Zoltan graph partitioning package.
Definition ParallelNLDDPartitioningZoltan.cpp:568
Opm::ParallelNLDDPartitioningZoltan::GlobalCellID
std::function< int(int)> GlobalCellID
Callback type for mapping a vertex/cell ID to a globally unique ID.
Definition ParallelNLDDPartitioningZoltan.hpp:42
Opm::ParallelNLDDPartitioningZoltan::ParallelNLDDPartitioningZoltan
ParallelNLDDPartitioningZoltan(const Parallel::Communication comm, const std::size_t numElements, const GlobalCellID &globalCell)
Constructor.
Definition ParallelNLDDPartitioningZoltan.hpp:57
Opm::ParallelNLDDPartitioningZoltan::ZoltanParamMap
std::map< std::string, std::string > ZoltanParamMap
Collection of parameters to control the partitioning procedure.
Definition ParallelNLDDPartitioningZoltan.hpp:45
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43