My Project
ZoltanPartition.hpp
1 /*
2  Copyright 2015 Dr. Blatt - HPC-Simulation-Software & Services.
3  Copyright 2015 Statoil AS
4 
5  This file is part of The Open Porous Media project (OPM).
6 
7  OPM is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  OPM is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with OPM. If not, see <http://www.gnu.org/licenses/>.
19 */
20 #ifndef DUNE_CPGRID_ZOLTANPARTITION_HEADER
21 #define DUNE_CPGRID_ZOLTANPARTITION_HEADER
22 
23 #include <unordered_set>
24 
25 #include <opm/grid/CpGrid.hpp>
26 #include <opm/grid/common/ZoltanGraphFunctions.hpp>
27 #include <opm/grid/common/WellConnections.hpp>
28 
29 #if HAVE_MPI
30 namespace Dune
31 {
32 namespace cpgrid
33 {
64 template<class Id>
65 std::tuple<std::vector<int>, std::vector<std::pair<std::string,bool>>,
66  std::vector<std::tuple<int,int,char> >,
67  std::vector<std::tuple<int,int,char,int> >,
68  WellConnections>
69 makeImportAndExportLists(const Dune::CpGrid& cpgrid,
70 #if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
71  const Dune::Communication<MPI_Comm>& cc,
72 #else
73  const Dune::CollectiveCommunication<MPI_Comm>& cc,
74 #endif
75  const std::vector<Dune::cpgrid::OpmWellType> * wells,
76  const Dune::cpgrid::CombinedGridWellGraph* gridAndWells,
77  int root,
78  int numExport,
79  int numImport,
80  const Id* exportLocalGids,
81  const Id* exportGlobalGids,
82  const int* exportToPart,
83  const Id* importGlobalGids,
84  bool allowDistributedWells = false);
85 
86 template<class Id>
87 std::tuple<int, std::vector<Id> >
88 scatterExportInformation(int numExport, const Id* exportGlobalGids,
89  const int* exportToPart, int root,
90 #if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
91  const Dune::Communication<MPI_Comm>& cc);
92 #else
93  const Dune::CollectiveCommunication<MPI_Comm>& cc);
94 #endif
95 } // end namespace cpgrid
96 } // end namespace Dune
97 #endif //HAVE_MPI
98 #if defined(HAVE_ZOLTAN) && defined(HAVE_MPI)
99 namespace Dune
100 {
101 namespace cpgrid
102 {
132 
133 std::tuple<std::vector<int>,std::vector<std::pair<std::string,bool>>,
134  std::vector<std::tuple<int,int,char> >,
135  std::vector<std::tuple<int,int,char,int> >,
136  WellConnections>
137 zoltanGraphPartitionGridOnRoot(const CpGrid& grid,
138  const std::vector<OpmWellType> * wells,
139  const double* transmissibilities,
140 #if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
141  const Communication<MPI_Comm>& cc,
142 #else
143  const CollectiveCommunication<MPI_Comm>& cc,
144 #endif
145  EdgeWeightMethod edgeWeightsMethod, int root,
146  const double zoltanImbalanceTol,
147  bool allowDistributedWells,
148  const std::map<std::string,std::string>& params);
149 
180 std::tuple<std::vector<int>, std::vector<std::pair<std::string,bool>>,
181  std::vector<std::tuple<int,int,char> >,
182  std::vector<std::tuple<int,int,char,int> >,
183  WellConnections>
184 zoltanSerialGraphPartitionGridOnRoot(const CpGrid& grid,
185  const std::vector<OpmWellType> * wells,
186  const double* transmissibilities,
187 #if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
188  const Communication<MPI_Comm>& cc,
189 #else
190  const CollectiveCommunication<MPI_Comm>& cc,
191 #endif
192  EdgeWeightMethod edgeWeightsMethod, int root,
193  const double zoltanImbalanceTol,
194  bool allowDistributedWells,
195  const std::map<std::string,std::string>& params);
196 
216 std::vector<int>
217 zoltanGraphPartitionGridForJac(const CpGrid& cpgrid,
218  const std::vector<OpmWellType> * wells,
219  const double* transmissibilities,
220 #if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
221  const Communication<MPI_Comm>& cc,
222 #else
223  const CollectiveCommunication<MPI_Comm>& cc,
224 #endif
225  EdgeWeightMethod edgeWeightsMethod, int root,
226  int numParts, const double zoltanImbalanceTol);
227 
228 }
229 }
230 
231 
232 #endif // HAVE_ZOLTAN
233 #endif // header guard
[ provides Dune::Grid ]
Definition: CpGrid.hpp:210
A graph repesenting a grid together with the well completions.
Definition: ZoltanGraphFunctions.hpp:131
Copyright 2019 Equinor AS.
Definition: CartesianIndexMapper.hpp:10
EdgeWeightMethod
enum for choosing Methods for weighting graph-edges correspoding to cell interfaces in Zoltan's graph...
Definition: GridEnums.hpp:34