Reference documentation for deal.II version GIT 6bdf9a4b6c 2022-08-12 19:20:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
sparsity_tools.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2008 - 2021 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 
23 
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 
38 
39 
51 namespace SparsityTools
52 {
56  enum class Partitioner
57  {
61  metis = 0,
65  zoltan
66  };
67 
68 
104  void
105  partition(const SparsityPattern & sparsity_pattern,
106  const unsigned int n_partitions,
107  std::vector<unsigned int> &partition_indices,
108  const Partitioner partitioner = Partitioner::metis);
109 
110 
121  void
122  partition(const SparsityPattern & sparsity_pattern,
123  const std::vector<unsigned int> &cell_weights,
124  const unsigned int n_partitions,
125  std::vector<unsigned int> & partition_indices,
126  const Partitioner partitioner = Partitioner::metis);
127 
160  unsigned int
161  color_sparsity_pattern(const SparsityPattern & sparsity_pattern,
162  std::vector<unsigned int> &color_indices);
163 
213  void
215  const DynamicSparsityPattern & sparsity,
216  std::vector<DynamicSparsityPattern::size_type> & new_indices,
217  const std::vector<DynamicSparsityPattern::size_type> &starting_indices =
218  std::vector<DynamicSparsityPattern::size_type>());
219 
241  void
243  const DynamicSparsityPattern & sparsity,
244  std::vector<DynamicSparsityPattern::size_type> &new_indices);
245 
246 #ifdef DEAL_II_WITH_MPI
271  void
273  const IndexSet & locally_owned_rows,
274  const MPI_Comm & mpi_comm,
275  const IndexSet & locally_relevant_rows);
276 
287  void
290  const std::vector<DynamicSparsityPattern::size_type> &rows_per_cpu,
291  const MPI_Comm & mpi_comm,
292  const IndexSet & myrange);
293 
308  void
310  const IndexSet & locally_owned_rows,
311  const MPI_Comm & mpi_comm,
312  const IndexSet &locally_relevant_rows);
313 
318  void
320  const std::vector<IndexSet> &owned_set_per_cpu,
321  const MPI_Comm & mpi_comm,
322  const IndexSet & myrange);
323 
347  void
349  const IndexSet & locally_owned_rows,
350  const MPI_Comm & mpi_comm,
351  const IndexSet & locally_relevant_rows);
352 
353 #endif
354 
355 
360  "The function you called requires METIS, but you did not "
361  "configure deal.II with METIS.");
362 
367  int,
368  << "The number of partitions you gave is " << arg1
369  << ", but must be greater than zero.");
370 
375  int,
376  << " An error with error number " << arg1
377  << " occurred while calling a METIS function");
378 
383  int,
384  int,
385  << "The array has size " << arg1 << " but should have size "
386  << arg2);
392  "The function you called requires ZOLTAN, but you did not "
393  "configure deal.II with ZOLTAN or zoltan_cpp.h is not available.");
394 } // namespace SparsityTools
395 
401 
402 #endif
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
static ::ExceptionBase & ExcZOLTANNotInstalled()
static ::ExceptionBase & ExcInvalidNumberOfPartitions(int arg1)
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:532
static ::ExceptionBase & ExcMETISNotInstalled()
static ::ExceptionBase & ExcInvalidArraySize(int arg1, int arg2)
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:487
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:509
static ::ExceptionBase & ExcMETISError(int arg1)
void gather_sparsity_pattern(DynamicSparsityPattern &dsp, const IndexSet &locally_owned_rows, const MPI_Comm &mpi_comm, const IndexSet &locally_relevant_rows)
unsigned int color_sparsity_pattern(const SparsityPattern &sparsity_pattern, std::vector< unsigned int > &color_indices)
void partition(const SparsityPattern &sparsity_pattern, const unsigned int n_partitions, std::vector< unsigned int > &partition_indices, const Partitioner partitioner=Partitioner::metis)
void reorder_hierarchical(const DynamicSparsityPattern &sparsity, std::vector< DynamicSparsityPattern::size_type > &new_indices)
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 >())
void distribute_sparsity_pattern(DynamicSparsityPattern &dsp, const IndexSet &locally_owned_rows, const MPI_Comm &mpi_comm, const IndexSet &locally_relevant_rows)