ParallelNLDDPartitioningZoltan.hpp
Go to the documentation of this file.
1/*
2 Copyright 2023 Equinor ASA
3
4 This file is part of the Open Porous Media Project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_UTILITY_PARALLEL_NLDD_PARTITIONING_ZOLTAN_HPP
21#define OPM_UTILITY_PARALLEL_NLDD_PARTITIONING_ZOLTAN_HPP
22
24
25#include <cstddef>
26#include <functional>
27#include <map>
28#include <string>
29#include <utility>
30#include <vector>
31
32namespace Opm {
33
38 {
39 public:
42 using GlobalCellID = std::function<int(int)>;
43
45 using ZoltanParamMap = std::map<std::string, std::string>;
46
58 const std::size_t numElements,
59 const GlobalCellID& globalCell)
60 : comm_ { comm }
61 , numElements_ { numElements }
62 , globalCell_ { globalCell }
63 {}
64
70 void registerConnection(std::size_t c1, std::size_t c2)
71 {
72 this->conns_.emplace_back(c1, c2);
73 }
74
82 void forceSameDomain(std::vector<int>&& cells)
83 {
84 this->sameDomain_.emplace_back(std::move(cells));
85 }
86
99 std::vector<int>
100 partitionElements(const ZoltanParamMap& params) const;
101
102 private:
104 using Connection = std::pair<std::size_t, std::size_t>;
105
108
111 std::size_t numElements_{};
112
115 GlobalCellID globalCell_{};
116
118 std::vector<Connection> conns_{};
119
124 std::vector<std::vector<int>> sameDomain_{};
125 };
126
127} // namespace Opm
128
129#endif // OPM_UTILITY_PARALLEL_NLDD_PARTITIONING_ZOLTAN_HPP
Definition: ParallelNLDDPartitioningZoltan.hpp:38
void forceSameDomain(std::vector< int > &&cells)
Definition: ParallelNLDDPartitioningZoltan.hpp:82
void registerConnection(std::size_t c1, std::size_t c2)
Definition: ParallelNLDDPartitioningZoltan.hpp:70
std::vector< int > partitionElements(const ZoltanParamMap &params) const
std::function< int(int)> GlobalCellID
Definition: ParallelNLDDPartitioningZoltan.hpp:42
ParallelNLDDPartitioningZoltan(const Parallel::Communication comm, const std::size_t numElements, const GlobalCellID &globalCell)
Definition: ParallelNLDDPartitioningZoltan.hpp:57
std::map< std::string, std::string > ZoltanParamMap
Collection of parameters to control the partitioning procedure.
Definition: ParallelNLDDPartitioningZoltan.hpp:45
Dune::Communication< MPIComm > Communication
Definition: ParallelCommunication.hpp:30
Definition: BlackoilPhases.hpp:27