Reference documentation for deal.II version 9.4.0
\(\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\}}\)
dof_renumbering.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2003 - 2022 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_dof_renumbering_h
17 #define dealii_dof_renumbering_h
18 
19 
20 #include <deal.II/base/config.h>
21 
23 #include <deal.II/base/point.h>
24 
26 
27 #include <deal.II/hp/dof_handler.h>
28 
29 #include <vector>
30 
32 
33 #ifndef DOXYGEN
34 // forward declaration
35 template <int, typename, typename>
36 class MatrixFree;
37 #endif
38 
357 namespace DoFRenumbering
358 {
364  template <class Iterator, int dim>
366  {
371  : dir(dir)
372  {}
376  bool
377  operator()(const Iterator &c1, const Iterator &c2) const
378  {
379  const Tensor<1, dim> diff = c2->center() - c1->center();
380  return (diff * dir > 0);
381  }
382 
383  private:
388  };
389 
390 
398  template <int dim>
400  {
405  : dir(dir)
406  {}
410  bool
412  const std::pair<Point<dim>, types::global_dof_index> &c2) const
413  {
414  const Tensor<1, dim> diff = c2.first - c1.first;
415  return (diff * dir > 0 || (diff * dir == 0 && c1.second < c2.second));
416  }
417 
418  private:
423  };
424 
425 
426 
440  namespace boost
441  {
453  template <int dim, int spacedim>
454  void
456  const bool reversed_numbering = false,
457  const bool use_constraints = false);
458 
464  template <int dim, int spacedim>
465  void
466  compute_Cuthill_McKee(std::vector<types::global_dof_index> &new_dof_indices,
468  const bool reversed_numbering = false,
469  const bool use_constraints = false);
470 
483  template <int dim, int spacedim>
484  void
486  const bool reversed_numbering = false,
487  const bool use_constraints = false);
488 
493  template <int dim, int spacedim>
494  void
495  compute_king_ordering(std::vector<types::global_dof_index> &new_dof_indices,
497  const bool reversed_numbering = false,
498  const bool use_constraints = false);
499 
511  template <int dim, int spacedim>
512  void
514  const bool reversed_numbering = false,
515  const bool use_constraints = false);
516 
521  template <int dim, int spacedim>
522  void
524  std::vector<types::global_dof_index> &new_dof_indices,
526  const bool reversed_numbering = false,
527  const bool use_constraints = false);
528  } // namespace boost
529 
594  template <int dim, int spacedim>
595  void
597  const bool reversed_numbering = false,
598  const bool use_constraints = false,
599  const std::vector<types::global_dof_index> &starting_indices =
600  std::vector<types::global_dof_index>());
601 
611  template <int dim, int spacedim>
612  void
614  std::vector<types::global_dof_index> &new_dof_indices,
616  const bool reversed_numbering = false,
617  const bool use_constraints = false,
618  const std::vector<types::global_dof_index> &starting_indices =
619  std::vector<types::global_dof_index>(),
620  const unsigned int level = numbers::invalid_unsigned_int);
621 
635  template <int dim, int spacedim>
636  void
638  const unsigned int level,
639  const bool reversed_numbering = false,
640  const std::vector<types::global_dof_index> &starting_indices =
641  std::vector<types::global_dof_index>());
642 
674  template <int dim, int spacedim>
675  void
677  const std::vector<unsigned int> &target_component =
678  std::vector<unsigned int>());
679 
680 
687  template <int dim, int spacedim>
688  void
690  const unsigned int level,
691  const std::vector<unsigned int> &target_component =
692  std::vector<unsigned int>());
693 
699  template <int dim, int spacedim, typename CellIterator>
701  compute_component_wise(std::vector<types::global_dof_index> &new_dof_indices,
702  const CellIterator & start,
703  const typename identity<CellIterator>::type &end,
704  const std::vector<unsigned int> &target_component,
705  const bool is_level_operation);
706 
735  template <int dim, int spacedim>
736  void
738 
745  template <int dim, int spacedim>
746  void
747  block_wise(DoFHandler<dim, spacedim> &dof_handler, const unsigned int level);
748 
754  template <int dim, int spacedim, class ITERATOR, class ENDITERATOR>
756  compute_block_wise(std::vector<types::global_dof_index> &new_dof_indices,
757  const ITERATOR & start,
758  const ENDITERATOR & end,
759  bool is_level_operation);
760 
842  template <int dim, int spacedim>
843  void
845 
870  template <int dim, int spacedim>
871  void
872  cell_wise(
873  DoFHandler<dim, spacedim> &dof_handler,
874  const std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
875  &cell_order);
876 
912  template <int dim, int spacedim>
913  void
915  std::vector<types::global_dof_index> &renumbering,
916  std::vector<types::global_dof_index> &inverse_renumbering,
917  const DoFHandler<dim, spacedim> & dof_handler,
918  const std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
919  &cell_order);
920 
925  template <int dim, int spacedim>
926  void
928  DoFHandler<dim, spacedim> &dof_handler,
929  const unsigned int level,
930  const std::vector<typename DoFHandler<dim, spacedim>::level_cell_iterator>
931  &cell_order);
932 
937  template <int dim, int spacedim>
938  void
940  std::vector<types::global_dof_index> &renumbering,
941  std::vector<types::global_dof_index> &inverse_renumbering,
942  const DoFHandler<dim, spacedim> & dof_handler,
943  const unsigned int level,
944  const std::vector<typename DoFHandler<dim, spacedim>::level_cell_iterator>
945  &cell_order);
946 
982  template <int dim, int spacedim>
983  void
985  const Tensor<1, spacedim> &direction,
986  const bool dof_wise_renumbering = false);
987 
988 
994  template <int dim, int spacedim>
995  void
997  const unsigned int level,
998  const Tensor<1, spacedim> &direction,
999  const bool dof_wise_renumbering = false);
1000 
1006  template <int dim, int spacedim>
1007  void
1008  compute_downstream(std::vector<types::global_dof_index> &new_dof_indices,
1009  std::vector<types::global_dof_index> &reverse,
1010  const DoFHandler<dim, spacedim> & dof_handler,
1011  const Tensor<1, spacedim> & direction,
1012  const bool dof_wise_renumbering);
1013 
1019  template <int dim, int spacedim>
1020  void
1021  compute_downstream(std::vector<types::global_dof_index> &new_dof_indices,
1022  std::vector<types::global_dof_index> &reverse,
1023  const DoFHandler<dim, spacedim> & dof_handler,
1024  const unsigned int level,
1025  const Tensor<1, spacedim> & direction,
1026  const bool dof_wise_renumbering);
1027 
1036  template <int dim, int spacedim>
1037  void
1039  const Point<spacedim> & center,
1040  const bool counter = false);
1041 
1046  template <int dim, int spacedim>
1047  void
1049  const unsigned int level,
1050  const Point<spacedim> & center,
1051  const bool counter = false);
1052 
1058  template <int dim, int spacedim>
1059  void
1060  compute_clockwise_dg(std::vector<types::global_dof_index> &new_dof_indices,
1061  const DoFHandler<dim, spacedim> & dof_handler,
1062  const Point<spacedim> & center,
1063  const bool counter);
1064 
1083  template <int dim, int spacedim>
1084  void
1086  const std::vector<bool> & selected_dofs);
1087 
1098  template <int dim, int spacedim>
1099  void
1101  const std::vector<bool> & selected_dofs,
1102  const unsigned int level);
1103 
1112  template <int dim, int spacedim>
1113  void
1115  std::vector<types::global_dof_index> &new_dof_indices,
1116  const DoFHandler<dim, spacedim> & dof_handler,
1117  const std::vector<bool> & selected_dofs);
1118 
1128  template <int dim, int spacedim>
1129  void
1131  std::vector<types::global_dof_index> &new_dof_indices,
1132  const DoFHandler<dim, spacedim> & dof_handler,
1133  const std::vector<bool> & selected_dofs,
1134  const unsigned int level);
1135 
1146  template <int dim, int spacedim>
1147  void
1148  random(DoFHandler<dim, spacedim> &dof_handler);
1149 
1156  template <int dim, int spacedim>
1157  void
1158  random(DoFHandler<dim, spacedim> &dof_handler, const unsigned int level);
1159 
1167  template <int dim, int spacedim>
1168  void
1169  compute_random(std::vector<types::global_dof_index> &new_dof_indices,
1170  const DoFHandler<dim, spacedim> & dof_handler);
1171 
1177  template <int dim, int spacedim>
1178  void
1179  compute_random(std::vector<types::global_dof_index> &new_dof_indices,
1180  const DoFHandler<dim, spacedim> & dof_handler,
1181  const unsigned int level);
1182 
1214  template <int dim, int spacedim>
1215  void
1217 
1223  template <int dim, int spacedim>
1224  void
1225  compute_subdomain_wise(std::vector<types::global_dof_index> &new_dof_indices,
1226  const DoFHandler<dim, spacedim> & dof_handler);
1227 
1263  template <int dim, int spacedim>
1264  void
1266 
1272  template <int dim, int spacedim>
1273  void
1275  std::vector<types::global_dof_index> &new_dof_indices,
1276  const DoFHandler<dim, spacedim> & dof_handler);
1277 
1319  template <int dim,
1320  int spacedim,
1321  typename Number,
1322  typename VectorizedArrayType>
1323  void
1325  DoFHandler<dim, spacedim> & dof_handler,
1327 
1337  template <int dim, int spacedim, typename Number, typename AdditionalDataType>
1338  void
1340  DoFHandler<dim, spacedim> & dof_handler,
1341  const AffineConstraints<Number> &constraints,
1342  const AdditionalDataType & matrix_free_additional_data);
1343 
1350  template <int dim,
1351  int spacedim,
1352  typename Number,
1353  typename VectorizedArrayType>
1354  std::vector<types::global_dof_index>
1356  const DoFHandler<dim, spacedim> & dof_handler,
1358 
1365  template <int dim, int spacedim, typename Number, typename AdditionalDataType>
1366  std::vector<types::global_dof_index>
1368  const DoFHandler<dim, spacedim> &dof_handler,
1369  const AffineConstraints<Number> &constraints,
1370  const AdditionalDataType & matrix_free_additional_data);
1371 
1383  "The DoFHandler on which this function should work has not "
1384  "been initialized, i.e., it doesn't appear that DoF indices "
1385  "have been distributed on it.");
1386 
1393 
1401 } // namespace DoFRenumbering
1402 
1403 
1405 
1406 #endif
Definition: point.h:111
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
Point< 3 > center
unsigned int level
Definition: grid_out.cc:4606
#define DeclException0(Exception0)
Definition: exceptions.h:464
static ::ExceptionBase & ExcInvalidComponentOrder()
static ::ExceptionBase & ExcDoFHandlerNotInitialized()
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:487
static ::ExceptionBase & ExcNotDGFEM()
void compute_Cuthill_McKee(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &, const bool reversed_numbering=false, const bool use_constraints=false)
void Cuthill_McKee(DoFHandler< dim, spacedim > &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false)
void king_ordering(DoFHandler< dim, spacedim > &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false)
void compute_king_ordering(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &, const bool reversed_numbering=false, const bool use_constraints=false)
void compute_minimum_degree(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &, const bool reversed_numbering=false, const bool use_constraints=false)
void minimum_degree(DoFHandler< dim, spacedim > &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false)
void compute_support_point_wise(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &dof_handler)
void compute_subdomain_wise(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &dof_handler)
void matrix_free_data_locality(DoFHandler< dim, spacedim > &dof_handler, const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free)
void subdomain_wise(DoFHandler< dim, spacedim > &dof_handler)
void hierarchical(DoFHandler< dim, spacedim > &dof_handler)
void compute_random(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &dof_handler)
void component_wise(DoFHandler< dim, spacedim > &dof_handler, const std::vector< unsigned int > &target_component=std::vector< unsigned int >())
void downstream(DoFHandler< dim, spacedim > &dof_handler, const Tensor< 1, spacedim > &direction, const bool dof_wise_renumbering=false)
types::global_dof_index compute_component_wise(std::vector< types::global_dof_index > &new_dof_indices, const CellIterator &start, const typename identity< CellIterator >::type &end, const std::vector< unsigned int > &target_component, const bool is_level_operation)
void compute_Cuthill_McKee(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &, const bool reversed_numbering=false, const bool use_constraints=false, const std::vector< types::global_dof_index > &starting_indices=std::vector< types::global_dof_index >(), const unsigned int level=numbers::invalid_unsigned_int)
void block_wise(DoFHandler< dim, spacedim > &dof_handler)
void Cuthill_McKee(DoFHandler< dim, spacedim > &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false, const std::vector< types::global_dof_index > &starting_indices=std::vector< types::global_dof_index >())
void compute_sort_selected_dofs_back(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &dof_handler, const std::vector< bool > &selected_dofs)
void sort_selected_dofs_back(DoFHandler< dim, spacedim > &dof_handler, const std::vector< bool > &selected_dofs)
void support_point_wise(DoFHandler< dim, spacedim > &dof_handler)
void compute_cell_wise(std::vector< types::global_dof_index > &renumbering, std::vector< types::global_dof_index > &inverse_renumbering, const DoFHandler< dim, spacedim > &dof_handler, const std::vector< typename DoFHandler< dim, spacedim >::active_cell_iterator > &cell_order)
std::vector< types::global_dof_index > compute_matrix_free_data_locality(const DoFHandler< dim, spacedim > &dof_handler, const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free)
void clockwise_dg(DoFHandler< dim, spacedim > &dof_handler, const Point< spacedim > &center, const bool counter=false)
void random(DoFHandler< dim, spacedim > &dof_handler)
void compute_downstream(std::vector< types::global_dof_index > &new_dof_indices, std::vector< types::global_dof_index > &reverse, const DoFHandler< dim, spacedim > &dof_handler, const Tensor< 1, spacedim > &direction, const bool dof_wise_renumbering)
void cell_wise(DoFHandler< dim, spacedim > &dof_handler, const std::vector< typename DoFHandler< dim, spacedim >::active_cell_iterator > &cell_order)
types::global_dof_index compute_block_wise(std::vector< types::global_dof_index > &new_dof_indices, const ITERATOR &start, const ENDITERATOR &end, bool is_level_operation)
void compute_clockwise_dg(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &dof_handler, const Point< spacedim > &center, const bool counter)
VectorType::value_type * end(VectorType &V)
static const unsigned int invalid_unsigned_int
Definition: types.h:201
unsigned int global_dof_index
Definition: types.h:76
bool operator()(const Iterator &c1, const Iterator &c2) const
CompareDownstream(const Tensor< 1, dim > &dir)
ComparePointwiseDownstream(const Tensor< 1, dim > &dir)
bool operator()(const std::pair< Point< dim >, types::global_dof_index > &c1, const std::pair< Point< dim >, types::global_dof_index > &c2) const