Reference documentation for deal.II version GIT 3a483e2de5 2022-11-28 08:40: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 #include <deal.II/base/index_set.h>
24 #include <deal.II/base/mpi_stub.h>
25 
29 
30 #include <memory>
31 #include <vector>
32 
34 
35 
47 namespace SparsityTools
48 {
52  enum class Partitioner
53  {
57  metis = 0,
61  zoltan
62  };
63 
64 
100  void
101  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 
117  void
118  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 
156  unsigned int
157  color_sparsity_pattern(const SparsityPattern & sparsity_pattern,
158  std::vector<unsigned int> &color_indices);
159 
209  void
211  const DynamicSparsityPattern & sparsity,
212  std::vector<DynamicSparsityPattern::size_type> & new_indices,
213  const std::vector<DynamicSparsityPattern::size_type> &starting_indices =
214  std::vector<DynamicSparsityPattern::size_type>());
215 
237  void
239  const DynamicSparsityPattern & sparsity,
240  std::vector<DynamicSparsityPattern::size_type> &new_indices);
241 
242 #ifdef DEAL_II_WITH_MPI
267  void
269  const IndexSet & locally_owned_rows,
270  const MPI_Comm & mpi_comm,
271  const IndexSet & locally_relevant_rows);
272 
283  void
286  const std::vector<DynamicSparsityPattern::size_type> &rows_per_cpu,
287  const MPI_Comm & mpi_comm,
288  const IndexSet & myrange);
289 
304  void
306  const IndexSet & locally_owned_rows,
307  const MPI_Comm & mpi_comm,
308  const IndexSet &locally_relevant_rows);
309 
314  void
316  const std::vector<IndexSet> &owned_set_per_cpu,
317  const MPI_Comm & mpi_comm,
318  const IndexSet & myrange);
319 
343  void
345  const IndexSet & locally_owned_rows,
346  const MPI_Comm & mpi_comm,
347  const IndexSet & locally_relevant_rows);
348 
349 #endif
350 
351 
356  "The function you called requires METIS, but you did not "
357  "configure deal.II with METIS.");
358 
363  int,
364  << "The number of partitions you gave is " << arg1
365  << ", but must be greater than zero.");
366 
371  int,
372  << " An error with error number " << arg1
373  << " occurred while calling a METIS function");
374 
379  int,
380  int,
381  << "The array has size " << arg1 << " but should have size "
382  << arg2);
388  "The function you called requires ZOLTAN, but you did not "
389  "configure deal.II with ZOLTAN or zoltan_cpp.h is not available.");
390 } // namespace SparsityTools
391 
397 
398 #endif
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:458
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:459
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)