DOLFIN
DOLFIN C++ interface
Loading...
Searching...
No Matches
SCOTCH.h
1// Copyright (C) 2010-2013 Garth N. Wells and Chris Richardson
2//
3// This file is part of DOLFIN.
4//
5// DOLFIN is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// DOLFIN is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17//
18// First added: 2010-02-10
19// Last changed: 2014-01-09
20
21#ifndef __SCOTCH_PARTITIONER_H
22#define __SCOTCH_PARTITIONER_H
23
24#include <cstddef>
25#include <cstdint>
26#include <map>
27#include <set>
28#include <string>
29#include <vector>
30
31#include <dolfin/common/MPI.h>
32#include <dolfin/common/Set.h>
33#include "Graph.h"
34
35#include "CSRGraph.h"
36
37namespace dolfin
38{
39 // Forward declarations
40 class CellType;
41 class LocalMeshData;
42
44
45 class SCOTCH
46 {
47 public:
48
63 static void compute_partition(
64 const MPI_Comm mpi_comm,
65 std::vector<int>& cell_partition,
66 std::map<std::int64_t, std::vector<int>>& ghost_procs,
67 const boost::multi_array<std::int64_t, 2>& cell_vertices,
68 const std::vector<std::size_t>& cell_weight,
69 const std::int64_t num_global_vertices,
70 const std::int64_t num_global_cells,
71 const CellType& cell_type);
72
81 static std::vector<int> compute_gps(const Graph& graph,
82 std::size_t num_passes=5);
83
91 static std::vector<int>
92 compute_reordering(const Graph& graph,
93 std::string scotch_strategy="");
94
100 static
101 void compute_reordering(const Graph& graph,
102 std::vector<int>& permutation,
103 std::vector<int>& inverse_permutation,
104 std::string scotch_strategy="");
105
106 private:
107
108 // Compute cell partitions from distributed dual graph. Note that
109 // local_graph is not const since we share the data with SCOTCH,
110 // and the SCOTCH interface is not const-correct.
111 template<typename T>
112 static void partition(
113 const MPI_Comm mpi_comm,
114 CSRGraph<T>& local_graph,
115 const std::vector<std::size_t>& node_weights,
116 const std::set<std::int64_t>& ghost_vertices,
117 const std::size_t num_global_vertices,
118 std::vector<int>& cell_partition,
119 std::map<std::int64_t, std::vector<int>>& ghost_procs);
120
121 };
122
123}
124
125#endif
Compressed Sparse Row graph.
Definition CSRGraph.h:45
Definition CellType.h:47
This class provides an interface to SCOTCH-PT (parallel version)
Definition SCOTCH.h:46
static std::vector< int > compute_reordering(const Graph &graph, std::string scotch_strategy="")
Definition SCOTCH.cpp:92
static std::vector< int > compute_gps(const Graph &graph, std::size_t num_passes=5)
Definition SCOTCH.cpp:84
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::vector< std::size_t > &cell_weight, const std::int64_t num_global_vertices, const std::int64_t num_global_cells, const CellType &cell_type)
Definition SCOTCH.cpp:51
Definition adapt.h:30
std::vector< graph_set_type > Graph
Vector of unordered Sets.
Definition Graph.h:39