deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+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\}}\)
Loading...
Searching...
No Matches
dof_renumbering.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2003 - 2025 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_dof_renumbering_h
14#define dealii_dof_renumbering_h
15
16
17#include <deal.II/base/config.h>
18
20#include <deal.II/base/point.h>
21
23
24#include <vector>
25
27
28#ifndef DOXYGEN
29// forward declaration
30template <int, typename, typename>
31class MatrixFree;
32#endif
33
354{
360 template <class Iterator, int dim>
362 {
372 bool
373 operator()(const Iterator &c1, const Iterator &c2) const
374 {
375 const Tensor<1, dim> diff = c2->center() - c1->center();
376 return (diff * dir > 0);
377 }
378
379 private:
384 };
385
386
394 template <int dim>
396 {
406 bool
408 const std::pair<Point<dim>, types::global_dof_index> &c2) const
409 {
410 const Tensor<1, dim> diff = c2.first - c1.first;
411 return (diff * dir > 0 || (diff * dir == 0 && c1.second < c2.second));
412 }
413
414 private:
419 };
420
421
422
436 namespace boost
437 {
449 template <int dim, int spacedim>
450 void
452 const bool reversed_numbering = false,
453 const bool use_constraints = false);
454
460 template <int dim, int spacedim>
461 void
462 compute_Cuthill_McKee(std::vector<types::global_dof_index> &new_dof_indices,
464 const bool reversed_numbering = false,
465 const bool use_constraints = false);
466
479 template <int dim, int spacedim>
480 void
482 const bool reversed_numbering = false,
483 const bool use_constraints = false);
484
489 template <int dim, int spacedim>
490 void
491 compute_king_ordering(std::vector<types::global_dof_index> &new_dof_indices,
493 const bool reversed_numbering = false,
494 const bool use_constraints = false);
495
507 template <int dim, int spacedim>
508 void
510 const bool reversed_numbering = false,
511 const bool use_constraints = false);
512
517 template <int dim, int spacedim>
518 void
520 std::vector<types::global_dof_index> &new_dof_indices,
522 const bool reversed_numbering = false,
523 const bool use_constraints = false);
524 } // namespace boost
525
590 template <int dim, int spacedim>
591 void
593 const bool reversed_numbering = false,
594 const bool use_constraints = false,
595 const std::vector<types::global_dof_index> &starting_indices =
596 std::vector<types::global_dof_index>());
597
607 template <int dim, int spacedim>
608 void
610 std::vector<types::global_dof_index> &new_dof_indices,
612 const bool reversed_numbering = false,
613 const bool use_constraints = false,
614 const std::vector<types::global_dof_index> &starting_indices =
615 std::vector<types::global_dof_index>(),
616 const unsigned int level = numbers::invalid_unsigned_int);
617
631 template <int dim, int spacedim>
632 void
634 const unsigned int level,
635 const bool reversed_numbering = false,
636 const std::vector<types::global_dof_index> &starting_indices =
637 std::vector<types::global_dof_index>());
638
670 template <int dim, int spacedim>
671 void
673 const std::vector<unsigned int> &target_component =
674 std::vector<unsigned int>());
675
676
683 template <int dim, int spacedim>
684 void
686 const unsigned int level,
687 const std::vector<unsigned int> &target_component =
688 std::vector<unsigned int>());
689
690
691
724 template <int dim, int spacedim>
725 void
727 const std::vector<FEValuesExtractors::AnyExtractor> &order);
728
735 template <int dim, int spacedim>
736 void
738 const unsigned int level,
739 const std::vector<FEValuesExtractors::AnyExtractor> &order);
740
741
747 template <int dim, int spacedim, typename CellIterator>
749 compute_component_wise(std::vector<types::global_dof_index> &new_dof_indices,
750 const CellIterator &start,
752 const std::vector<unsigned int> &target_component,
753 const bool is_level_operation);
754
783 template <int dim, int spacedim>
784 void
786
793 template <int dim, int spacedim>
794 void
795 block_wise(DoFHandler<dim, spacedim> &dof_handler, const unsigned int level);
796
802 template <int dim, int spacedim, class IteratorType, class EndIteratorType>
804 compute_block_wise(std::vector<types::global_dof_index> &new_dof_indices,
805 const IteratorType &start,
806 const EndIteratorType &end,
807 const bool is_level_operation);
808
890 template <int dim, int spacedim>
891 void
893
918 template <int dim, int spacedim>
919 void
920 cell_wise(
921 DoFHandler<dim, spacedim> &dof_handler,
922 const std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
923 &cell_order);
924
960 template <int dim, int spacedim>
961 void
963 std::vector<types::global_dof_index> &renumbering,
964 std::vector<types::global_dof_index> &inverse_renumbering,
965 const DoFHandler<dim, spacedim> &dof_handler,
966 const std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
967 &cell_order);
968
973 template <int dim, int spacedim>
974 void
976 DoFHandler<dim, spacedim> &dof_handler,
977 const unsigned int level,
978 const std::vector<typename DoFHandler<dim, spacedim>::level_cell_iterator>
979 &cell_order);
980
985 template <int dim, int spacedim>
986 void
988 std::vector<types::global_dof_index> &renumbering,
989 std::vector<types::global_dof_index> &inverse_renumbering,
990 const DoFHandler<dim, spacedim> &dof_handler,
991 const unsigned int level,
992 const std::vector<typename DoFHandler<dim, spacedim>::level_cell_iterator>
993 &cell_order);
994
1030 template <int dim, int spacedim>
1031 void
1033 const Tensor<1, spacedim> &direction,
1034 const bool dof_wise_renumbering = false);
1035
1036
1042 template <int dim, int spacedim>
1043 void
1045 const unsigned int level,
1046 const Tensor<1, spacedim> &direction,
1047 const bool dof_wise_renumbering = false);
1048
1054 template <int dim, int spacedim>
1055 void
1056 compute_downstream(std::vector<types::global_dof_index> &new_dof_indices,
1057 std::vector<types::global_dof_index> &reverse,
1058 const DoFHandler<dim, spacedim> &dof_handler,
1059 const Tensor<1, spacedim> &direction,
1060 const bool dof_wise_renumbering);
1061
1067 template <int dim, int spacedim>
1068 void
1069 compute_downstream(std::vector<types::global_dof_index> &new_dof_indices,
1070 std::vector<types::global_dof_index> &reverse,
1071 const DoFHandler<dim, spacedim> &dof_handler,
1072 const unsigned int level,
1073 const Tensor<1, spacedim> &direction,
1074 const bool dof_wise_renumbering);
1075
1084 template <int dim, int spacedim>
1085 void
1087 const Point<spacedim> &center,
1088 const bool counter = false);
1089
1094 template <int dim, int spacedim>
1095 void
1097 const unsigned int level,
1098 const Point<spacedim> &center,
1099 const bool counter = false);
1100
1106 template <int dim, int spacedim>
1107 void
1108 compute_clockwise_dg(std::vector<types::global_dof_index> &new_dof_indices,
1109 const DoFHandler<dim, spacedim> &dof_handler,
1110 const Point<spacedim> &center,
1111 const bool counter);
1112
1131 template <int dim, int spacedim>
1132 void
1134 const std::vector<bool> &selected_dofs);
1135
1146 template <int dim, int spacedim>
1147 void
1149 const std::vector<bool> &selected_dofs,
1150 const unsigned int level);
1151
1160 template <int dim, int spacedim>
1161 void
1163 std::vector<types::global_dof_index> &new_dof_indices,
1164 const DoFHandler<dim, spacedim> &dof_handler,
1165 const std::vector<bool> &selected_dofs);
1166
1176 template <int dim, int spacedim>
1177 void
1179 std::vector<types::global_dof_index> &new_dof_indices,
1180 const DoFHandler<dim, spacedim> &dof_handler,
1181 const std::vector<bool> &selected_dofs,
1182 const unsigned int level);
1183
1194 template <int dim, int spacedim>
1195 void
1196 random(DoFHandler<dim, spacedim> &dof_handler);
1197
1204 template <int dim, int spacedim>
1205 void
1206 random(DoFHandler<dim, spacedim> &dof_handler, const unsigned int level);
1207
1215 template <int dim, int spacedim>
1216 void
1217 compute_random(std::vector<types::global_dof_index> &new_dof_indices,
1218 const DoFHandler<dim, spacedim> &dof_handler);
1219
1225 template <int dim, int spacedim>
1226 void
1227 compute_random(std::vector<types::global_dof_index> &new_dof_indices,
1228 const DoFHandler<dim, spacedim> &dof_handler,
1229 const unsigned int level);
1230
1262 template <int dim, int spacedim>
1263 void
1265
1271 template <int dim, int spacedim>
1272 void
1273 compute_subdomain_wise(std::vector<types::global_dof_index> &new_dof_indices,
1274 const DoFHandler<dim, spacedim> &dof_handler);
1275
1311 template <int dim, int spacedim>
1312 void
1314
1320 template <int dim, int spacedim>
1321 void
1323 std::vector<types::global_dof_index> &new_dof_indices,
1324 const DoFHandler<dim, spacedim> &dof_handler);
1325
1340 template <int dim>
1341 void
1342 lexicographic(DoFHandler<dim> &dof_handler, const double tolerance = 1e-12);
1343
1352 template <int dim>
1353 void
1354 compute_lexicographic(std::vector<types::global_dof_index> &new_dof_indices,
1355 const DoFHandler<dim> &handler,
1356 const double tolerance = 1e-12);
1357
1399 template <int dim,
1400 int spacedim,
1401 typename Number,
1402 typename VectorizedArrayType>
1403 void
1405 DoFHandler<dim, spacedim> &dof_handler,
1407
1417 template <int dim, int spacedim, typename Number, typename AdditionalDataType>
1418 void
1420 DoFHandler<dim, spacedim> &dof_handler,
1421 const AffineConstraints<Number> &constraints,
1422 const AdditionalDataType &matrix_free_additional_data);
1423
1430 template <int dim,
1431 int spacedim,
1432 typename Number,
1433 typename VectorizedArrayType>
1434 std::vector<types::global_dof_index>
1436 const DoFHandler<dim, spacedim> &dof_handler,
1438
1445 template <int dim, int spacedim, typename Number, typename AdditionalDataType>
1446 std::vector<types::global_dof_index>
1448 const DoFHandler<dim, spacedim> &dof_handler,
1449 const AffineConstraints<Number> &constraints,
1450 const AdditionalDataType &matrix_free_additional_data);
1451
1463 "The DoFHandler on which this function should work has not "
1464 "been initialized, i.e., it doesn't appear that DoF indices "
1465 "have been distributed on it.");
1466
1473
1481} // namespace DoFRenumbering
1482
1483
1485
1486#endif
*  iterator end()
typename LevelSelector::cell_iterator level_cell_iterator
Definition point.h:111
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
unsigned int level
Definition grid_out.cc:4642
#define DeclException0(Exception0)
static ::ExceptionBase & ExcInvalidComponentOrder()
#define DeclExceptionMsg(Exception, defaulttext)
static ::ExceptionBase & ExcDoFHandlerNotInitialized()
static ::ExceptionBase & ExcNotDGFEM()
typename ActiveSelector::active_cell_iterator active_cell_iterator
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)
types::global_dof_index compute_block_wise(std::vector< types::global_dof_index > &new_dof_indices, const IteratorType &start, const EndIteratorType &end, const bool is_level_operation)
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)
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 lexicographic(DoFHandler< dim > &dof_handler, const double tolerance=1e-12)
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)
void compute_lexicographic(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim > &handler, const double tolerance=1e-12)
types::global_dof_index compute_component_wise(std::vector< types::global_dof_index > &new_dof_indices, const CellIterator &start, const std_cxx20::type_identity_t< CellIterator > &end, const std::vector< unsigned int > &target_component, const 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)
constexpr unsigned int invalid_unsigned_int
Definition types.h:228
typename type_identity< T >::type type_identity_t
Definition type_traits.h:93
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