opm-simulators
partitionCells.hpp
1 /*
2  Copyright 2021 Total SE
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_ASPINPARTITION_HEADER_INCLUDED
21 #define OPM_ASPINPARTITION_HEADER_INCLUDED
22 
23 #include <functional>
24 #include <set>
25 #include <string>
26 #include <utility>
27 #include <vector>
28 
29 namespace Opm {
30 
31 class Well;
32 
33 } // namespace Opm
34 
35 namespace Opm {
36 
40 template <typename Element>
42 {
45  double domain_imbalance{1.03};
46 
49  std::function<int(const Element&)> index;
50 
58  std::function<int(int)> local_to_global;
59 };
60 
95 template <class GridView, class Element>
96 std::pair<std::vector<int>, int>
97 partitionCells(const std::string& method,
98  const int num_local_domains,
99  const GridView& grid_view,
100  const std::vector<Well>& wells,
101  const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
102  const ZoltanPartitioningControl<Element>& zoltan_ctrl,
103  const int num_neighbor_levels);
104 
107 std::pair<std::vector<int>, int> partitionCellsFromFile(const std::string& filename, const int num_cells);
108 
111 std::pair<std::vector<int>, int> partitionCellsSimple(const int num_cells, const int num_domains);
112 
113 } // namespace Opm
114 
115 #endif // OPM_ASPINPARTITION_HEADER_INCLUDED
std::function< int(int)> local_to_global
Compute a globally unique, across all MPI processes, ID for a local cell/element/entity.
Definition: partitionCells.hpp:58
double domain_imbalance
Partition imbalance, percentage units.
Definition: partitionCells.hpp:45
std::function< int(const Element &)> index
Compute a locally unique, for this MPI process, ID of a local cell/element/entity.
Definition: partitionCells.hpp:49
Control parameters for on-rank subdomain partitioning using Zoltan library.
Definition: partitionCells.hpp:41
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
std::pair< std::vector< int >, int > partitionCellsSimple(const int num_cells, const int num_domains)
Trivially simple partitioner assigning partitions en bloc, consecutively by cell index.
Definition: partitionCells.cpp:735
std::pair< std::vector< int >, int > partitionCellsFromFile(const std::string &filename, const int num_cells)
Read a partitioning from file, assumed to contain one number per cell, its partition number...
Definition: partitionCells.cpp:708
std::pair< std::vector< int >, int > partitionCells(const std::string &method, const int num_local_domains, const GridView &grid_view, const std::vector< Well > &wells, const std::unordered_map< std::string, std::set< int >> &possibleFutureConnections, const ZoltanPartitioningControl< Element > &zoltan_ctrl, const int num_neighbor_levels)
Partition rank&#39;s interior cells.