Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
sparsity_tools.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2008 - 2019 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.md at
12 // the top level directory of deal.II.
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 
22 #include <deal.II/base/exceptions.h>
23 
24 #include <deal.II/lac/block_sparsity_pattern.h>
25 #include <deal.II/lac/dynamic_sparsity_pattern.h>
26 #include <deal.II/lac/sparsity_pattern.h>
27 
28 #include <memory>
29 #include <vector>
30 
31 #ifdef DEAL_II_WITH_MPI
32 # include <deal.II/base/index_set.h>
33 
34 # include <mpi.h>
35 #endif
36 
37 DEAL_II_NAMESPACE_OPEN
38 
39 
50 namespace SparsityTools
51 {
55  enum class Partitioner
56  {
60  metis = 0,
64  zoltan
65  };
66 
67 
103  void
104  partition(const SparsityPattern & sparsity_pattern,
105  const unsigned int n_partitions,
106  std::vector<unsigned int> &partition_indices,
107  const Partitioner partitioner = Partitioner::metis);
108 
109 
120  void
121  partition(const SparsityPattern & sparsity_pattern,
122  const std::vector<unsigned int> &cell_weights,
123  const unsigned int n_partitions,
124  std::vector<unsigned int> & partition_indices,
125  const Partitioner partitioner = Partitioner::metis);
126 
159  unsigned int
160  color_sparsity_pattern(const SparsityPattern & sparsity_pattern,
161  std::vector<unsigned int> &color_indices);
162 
212  void
214  const DynamicSparsityPattern & sparsity,
215  std::vector<DynamicSparsityPattern::size_type> & new_indices,
216  const std::vector<DynamicSparsityPattern::size_type> &starting_indices =
217  std::vector<DynamicSparsityPattern::size_type>());
218 
240  void
242  const DynamicSparsityPattern & sparsity,
243  std::vector<DynamicSparsityPattern::size_type> &new_indices);
244 
245 #ifdef DEAL_II_WITH_MPI
246 
270  void
273  const std::vector<DynamicSparsityPattern::size_type> &rows_per_cpu,
274  const MPI_Comm & mpi_comm,
275  const IndexSet & myrange);
276 
289  void
291  const std::vector<IndexSet> &owned_set_per_cpu,
292  const MPI_Comm & mpi_comm,
293  const IndexSet & myrange);
294 
317  void
319  const std::vector<IndexSet> &owned_rows_per_processor,
320  const MPI_Comm & mpi_comm,
321  const IndexSet & ghost_range);
322 
323 #endif
324 
325 
330  "The function you called requires METIS, but you did not "
331  "configure deal.II with METIS.");
332 
337  int,
338  << "The number of partitions you gave is " << arg1
339  << ", but must be greater than zero.");
340 
345  int,
346  << " An error with error number " << arg1
347  << " occurred while calling a METIS function");
348 
353  int,
354  int,
355  << "The array has size " << arg1 << " but should have size "
356  << arg2);
362  "The function you called requires ZOLTAN, but you did not "
363  "configure deal.II with ZOLTAN or zoltan_cpp.h is not available.");
364 } // namespace SparsityTools
365 
370 DEAL_II_NAMESPACE_CLOSE
371 
372 #endif
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:541
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:518
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:496
void gather_sparsity_pattern(DynamicSparsityPattern &dsp, const std::vector< IndexSet > &owned_rows_per_processor, const MPI_Comm &mpi_comm, const IndexSet &ghost_range)
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)