DOLFIN
DOLFIN C++ interface
Loading...
Searching...
No Matches
ParMETIS.h
1// Copyright (C) 2008-2009 Niclas Jansson, Ola Skavhaug, Anders Logg,
2// Garth N. Wells and Chris Richardson
3//
4// This file is part of DOLFIN.
5//
6// DOLFIN is free software: you can redistribute it and/or modify
7// it under the terms of the GNU Lesser 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// DOLFIN 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 Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
18
19#ifndef __PARMETIS_PARTITIONER_H
20#define __PARMETIS_PARTITIONER_H
21
22#include <cstdint>
23#include <cstddef>
24#include <map>
25#include <string>
26#include <vector>
27#include <boost/multi_array.hpp>
28
29#include <dolfin/common/MPI.h>
30#include "CSRGraph.h"
31
32namespace dolfin
33{
34 class CellType;
35
37
39 {
40 public:
41
51 static void
52 compute_partition(const MPI_Comm mpi_comm,
53 std::vector<int>& cell_partition,
54 std::map<std::int64_t, std::vector<int>>& ghost_procs,
55 const boost::multi_array<std::int64_t, 2>& cell_vertices,
56 const std::size_t num_global_vertices,
57 const CellType& cell_type,
58 const std::string mode="partition");
59
60 private:
61
62#ifdef HAS_PARMETIS
63
64 // Standard ParMETIS partition. CSRGraph should be const, but
65 // ParMETIS accesses it non-const, so has to be non-const here
66 template <typename T>
67 static void partition(MPI_Comm mpi_comm,
68 CSRGraph<T>& csr_graph,
69 std::vector<int>& cell_partition,
70 std::map<std::int64_t, std::vector<int>>& ghost_procs);
71
72 // ParMETIS adaptive repartition. CSRGraph should be const, but
73 // ParMETIS accesses it non-const, so has to be non-const here
74 template <typename T>
75 static void adaptive_repartition(MPI_Comm mpi_comm,
76 CSRGraph<T>& csr_graph,
77 std::vector<int>& cell_partition);
78
79 // ParMETIS refine repartition. CSRGraph should be const, but
80 // ParMETIS accesses it non-const, so has to be non-const here
81 template <typename T>
82 static void refine(MPI_Comm mpi_comm, CSRGraph<T>& csr_graph,
83 std::vector<int>& cell_partition);
84#endif
85
86
87 };
88
89}
90
91#endif
Compressed Sparse Row graph.
Definition CSRGraph.h:45
Definition CellType.h:47
This class provides an interface to ParMETIS.
Definition ParMETIS.h:39
static void compute_partition(const MPI_Comm mpi_comm, std::vector< int > &cell_partition, std::map< std::int64_t, std::vector< int > > &ghost_procs, const boost::multi_array< std::int64_t, 2 > &cell_vertices, const std::size_t num_global_vertices, const CellType &cell_type, const std::string mode="partition")
Definition ParMETIS.cpp:117
Definition adapt.h:30