Reference documentation for deal.II version 9.0.0
sparsity_tools.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2008 - 2018 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_sparsity_tools_h
17 #define dealii_sparsity_tools_h
18 
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/exceptions.h>
22 #include <deal.II/lac/block_sparsity_pattern.h>
23 #include <deal.II/lac/dynamic_sparsity_pattern.h>
24 #include <deal.II/lac/sparsity_pattern.h>
25 
26 #include <vector>
27 #include <memory>
28 
29 #ifdef DEAL_II_WITH_MPI
30 #include <mpi.h>
31 #include <deal.II/base/index_set.h>
32 #endif
33 
34 DEAL_II_NAMESPACE_OPEN
35 
36 
47 namespace SparsityTools
48 {
49 
53  enum class Partitioner
54  {
58  metis = 0,
62  zoltan
63  };
64 
65 
101  void partition (const SparsityPattern &sparsity_pattern,
102  const unsigned int n_partitions,
103  std::vector<unsigned int> &partition_indices,
104  const Partitioner partitioner = Partitioner::metis
105  );
106 
107 
118  void partition (const SparsityPattern &sparsity_pattern,
119  const std::vector<unsigned int> &cell_weights,
120  const unsigned int n_partitions,
121  std::vector<unsigned int> &partition_indices,
122  const Partitioner partitioner = Partitioner::metis
123  );
124 
157  unsigned int color_sparsity_pattern (const SparsityPattern &sparsity_pattern,
158  std::vector<unsigned int> &color_indices);
159 
209  void
211  std::vector<DynamicSparsityPattern::size_type> &new_indices,
212  const std::vector<DynamicSparsityPattern::size_type> &starting_indices = std::vector<DynamicSparsityPattern::size_type>());
213 
235  void
237  std::vector<DynamicSparsityPattern::size_type> &new_indices);
238 
239 #ifdef DEAL_II_WITH_MPI
240 
266  const std::vector<DynamicSparsityPattern::size_type> &rows_per_cpu,
267  const MPI_Comm &mpi_comm,
268  const IndexSet &myrange);
269 
284  const std::vector<IndexSet> &owned_set_per_cpu,
285  const MPI_Comm &mpi_comm,
286  const IndexSet &myrange);
287 
288 #endif
289 
290 
295  "The function you called requires METIS, but you did not "
296  "configure deal.II with METIS.");
297 
302  int,
303  << "The number of partitions you gave is " << arg1
304  << ", but must be greater than zero.");
305 
310  int,
311  << " An error with error number " << arg1
312  << " occurred while calling a METIS function");
313 
318  int, int,
319  << "The array has size " << arg1 << " but should have size "
320  << arg2);
325  "The function you called requires ZOLTAN, but you did not "
326  "configure deal.II with ZOLTAN or zoltan_cpp.h is not available.");
327 }
328 
333 DEAL_II_NAMESPACE_CLOSE
334 
335 #endif
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:358
static ::ExceptionBase & ExcMETISNotInstalled()
void reorder_Cuthill_McKee(const DynamicSparsityPattern &sparsity, std::vector< DynamicSparsityPattern::size_type > &new_indices, const std::vector< DynamicSparsityPattern::size_type > &starting_indices=std::vector< DynamicSparsityPattern::size_type >())
static ::ExceptionBase & ExcInvalidNumberOfPartitions(int arg1)
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:346
void distribute_sparsity_pattern(DynamicSparsityPattern &dsp, const std::vector< DynamicSparsityPattern::size_type > &rows_per_cpu, const MPI_Comm &mpi_comm, const IndexSet &myrange)
void partition(const SparsityPattern &sparsity_pattern, const unsigned int n_partitions, std::vector< unsigned int > &partition_indices, const Partitioner partitioner=Partitioner::metis)
static ::ExceptionBase & ExcInvalidArraySize(int arg1, int arg2)
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:335
void reorder_hierarchical(const DynamicSparsityPattern &sparsity, std::vector< DynamicSparsityPattern::size_type > &new_indices)
static ::ExceptionBase & ExcZOLTANNotInstalled()
unsigned int color_sparsity_pattern(const SparsityPattern &sparsity_pattern, std::vector< unsigned int > &color_indices)
static ::ExceptionBase & ExcMETISError(int arg1)