GridPartitioning.hpp
1 //===========================================================================
2 //
3 // File: GridPartitioning.hpp
4 //
5 // Created: Mon Sep 7 10:09:13 2009
6 //
7 // Author(s): Atgeirr F Rasmussen <atgeirr@sintef.no>
8 // Bård Skaflestad <bard.skaflestad@sintef.no>
9 //
10 // $Date$
11 //
12 // $Revision$
13 //
14 //===========================================================================
15 
16 /*
17  Copyright 2009, 2010, 2013 SINTEF ICT, Applied Mathematics.
18  Copyright 2009, 2010 Statoil ASA.
19  Copyright 2013 Dr. Markus Blatt - HPC-Simulation-Software & Services
20 
21  This file is part of The Open Porous Media project (OPM).
22 
23  OPM is free software: you can redistribute it and/or modify
24  it under the terms of the GNU General Public License as published by
25  the Free Software Foundation, either version 3 of the License, or
26  (at your option) any later version.
27 
28  OPM is distributed in the hope that it will be useful,
29  but WITHOUT ANY WARRANTY; without even the implied warranty of
30  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31  GNU General Public License for more details.
32 
33  You should have received a copy of the GNU General Public License
34  along with OPM. If not, see <http://www.gnu.org/licenses/>.
35 */
36 
37 #ifndef OPM_GRIDPARTITIONING_HEADER
38 #define OPM_GRIDPARTITIONING_HEADER
39 
40 #include <vector>
41 #include <array>
42 #include <set>
43 
44 namespace Dune
45 {
46 
47  class CpGrid;
48 
49  struct OrderByFirst
50  {
51  bool operator()(const std::pair<int,int>& o, const std::pair<int,int>& v)
52  {
53  return o.first < v.first;
54  }
55  };
56 
65  void partition(const CpGrid& grid,
66  const std::array<int, 3>& initial_split,
67  int& num_part,
68  std::vector<int>& cell_part,
69  bool recursive = false,
70  bool ensureConnectivity = true);
71 
80  void addOverlapLayer(const CpGrid& grid,
81  const std::vector<int>& cell_part,
82  std::vector<std::set<int> >& cell_overlap,
83  int mypart, int overlapLayers, bool all=false);
84 
85 } // namespace Dune
86 
87 
88 #endif // OPM_GRIDPARTITIONING_HEADER
Definition: GridPartitioning.hpp:49
Holds the implementation of the CpGrid as a pimple.
Definition: OpmParserIncludes.hpp:42
[ provides Dune::Grid ]
Definition: CpGrid.hpp:213
void partition(const CpGrid &grid, const coord_t &initial_split, int &num_part, std::vector< int > &cell_part, bool recursive, bool ensureConnectivity)
Partition a CpGrid based on (ijk) coordinates, with splitting to ensure that each partition is connec...
Definition: GridPartitioning.cpp:188