Reference documentation for deal.II version 9.5.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\}}\)
Loading...
Searching...
No Matches
dof_renumbering.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2003 - 2023 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 <vector>
28
30
31#ifndef DOXYGEN
32// forward declaration
33template <int, typename, typename>
34class MatrixFree;
35#endif
36
356{
362 template <class Iterator, int dim>
364 {
369 : dir(dir)
370 {}
374 bool
375 operator()(const Iterator &c1, const Iterator &c2) const
376 {
377 const Tensor<1, dim> diff = c2->center() - c1->center();
378 return (diff * dir > 0);
379 }
380
381 private:
386 };
387
388
396 template <int dim>
398 {
403 : dir(dir)
404 {}
408 bool
410 const std::pair<Point<dim>, types::global_dof_index> &c2) const
411 {
412 const Tensor<1, dim> diff = c2.first - c1.first;
413 return (diff * dir > 0 || (diff * dir == 0 && c1.second < c2.second));
414 }
415
416 private:
421 };
422
423
424
438 namespace boost
439 {
451 template <int dim, int spacedim>
452 void
454 const bool reversed_numbering = false,
455 const bool use_constraints = false);
456
462 template <int dim, int spacedim>
463 void
464 compute_Cuthill_McKee(std::vector<types::global_dof_index> &new_dof_indices,
466 const bool reversed_numbering = false,
467 const bool use_constraints = false);
468
481 template <int dim, int spacedim>
482 void
484 const bool reversed_numbering = false,
485 const bool use_constraints = false);
486
491 template <int dim, int spacedim>
492 void
493 compute_king_ordering(std::vector<types::global_dof_index> &new_dof_indices,
495 const bool reversed_numbering = false,
496 const bool use_constraints = false);
497
509 template <int dim, int spacedim>
510 void
512 const bool reversed_numbering = false,
513 const bool use_constraints = false);
514
519 template <int dim, int spacedim>
520 void
522 std::vector<types::global_dof_index> &new_dof_indices,
524 const bool reversed_numbering = false,
525 const bool use_constraints = false);
526 } // namespace boost
527
592 template <int dim, int spacedim>
593 void
595 const bool reversed_numbering = false,
596 const bool use_constraints = false,
597 const std::vector<types::global_dof_index> &starting_indices =
598 std::vector<types::global_dof_index>());
599
609 template <int dim, int spacedim>
610 void
612 std::vector<types::global_dof_index> &new_dof_indices,
614 const bool reversed_numbering = false,
615 const bool use_constraints = false,
616 const std::vector<types::global_dof_index> &starting_indices =
617 std::vector<types::global_dof_index>(),
618 const unsigned int level = numbers::invalid_unsigned_int);
619
633 template <int dim, int spacedim>
634 void
636 const unsigned int level,
637 const bool reversed_numbering = false,
638 const std::vector<types::global_dof_index> &starting_indices =
639 std::vector<types::global_dof_index>());
640
672 template <int dim, int spacedim>
673 void
675 const std::vector<unsigned int> &target_component =
676 std::vector<unsigned int>());
677
678
685 template <int dim, int spacedim>
686 void
688 const unsigned int level,
689 const std::vector<unsigned int> &target_component =
690 std::vector<unsigned int>());
691
697 template <int dim, int spacedim, typename CellIterator>
699 compute_component_wise(std::vector<types::global_dof_index> &new_dof_indices,
700 const CellIterator & start,
702 const std::vector<unsigned int> &target_component,
703 const bool is_level_operation);
704
733 template <int dim, int spacedim>
734 void
736
743 template <int dim, int spacedim>
744 void
745 block_wise(DoFHandler<dim, spacedim> &dof_handler, const unsigned int level);
746
752 template <int dim, int spacedim, class ITERATOR, class ENDITERATOR>
754 compute_block_wise(std::vector<types::global_dof_index> &new_dof_indices,
755 const ITERATOR & start,
756 const ENDITERATOR & end,
757 bool is_level_operation);
758
840 template <int dim, int spacedim>
841 void
843
868 template <int dim, int spacedim>
869 void
870 cell_wise(
871 DoFHandler<dim, spacedim> &dof_handler,
872 const std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
873 &cell_order);
874
910 template <int dim, int spacedim>
911 void
913 std::vector<types::global_dof_index> &renumbering,
914 std::vector<types::global_dof_index> &inverse_renumbering,
915 const DoFHandler<dim, spacedim> & dof_handler,
916 const std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
917 &cell_order);
918
923 template <int dim, int spacedim>
924 void
926 DoFHandler<dim, spacedim> &dof_handler,
927 const unsigned int level,
928 const std::vector<typename DoFHandler<dim, spacedim>::level_cell_iterator>
929 &cell_order);
930
935 template <int dim, int spacedim>
936 void
938 std::vector<types::global_dof_index> &renumbering,
939 std::vector<types::global_dof_index> &inverse_renumbering,
940 const DoFHandler<dim, spacedim> & dof_handler,
941 const unsigned int level,
942 const std::vector<typename DoFHandler<dim, spacedim>::level_cell_iterator>
943 &cell_order);
944
980 template <int dim, int spacedim>
981 void
983 const Tensor<1, spacedim> &direction,
984 const bool dof_wise_renumbering = false);
985
986
992 template <int dim, int spacedim>
993 void
995 const unsigned int level,
996 const Tensor<1, spacedim> &direction,
997 const bool dof_wise_renumbering = false);
998
1004 template <int dim, int spacedim>
1005 void
1006 compute_downstream(std::vector<types::global_dof_index> &new_dof_indices,
1007 std::vector<types::global_dof_index> &reverse,
1008 const DoFHandler<dim, spacedim> & dof_handler,
1009 const Tensor<1, spacedim> & direction,
1010 const bool dof_wise_renumbering);
1011
1017 template <int dim, int spacedim>
1018 void
1019 compute_downstream(std::vector<types::global_dof_index> &new_dof_indices,
1020 std::vector<types::global_dof_index> &reverse,
1021 const DoFHandler<dim, spacedim> & dof_handler,
1022 const unsigned int level,
1023 const Tensor<1, spacedim> & direction,
1024 const bool dof_wise_renumbering);
1025
1034 template <int dim, int spacedim>
1035 void
1037 const Point<spacedim> & center,
1038 const bool counter = false);
1039
1044 template <int dim, int spacedim>
1045 void
1047 const unsigned int level,
1048 const Point<spacedim> & center,
1049 const bool counter = false);
1050
1056 template <int dim, int spacedim>
1057 void
1058 compute_clockwise_dg(std::vector<types::global_dof_index> &new_dof_indices,
1059 const DoFHandler<dim, spacedim> & dof_handler,
1060 const Point<spacedim> & center,
1061 const bool counter);
1062
1081 template <int dim, int spacedim>
1082 void
1084 const std::vector<bool> & selected_dofs);
1085
1096 template <int dim, int spacedim>
1097 void
1099 const std::vector<bool> & selected_dofs,
1100 const unsigned int level);
1101
1110 template <int dim, int spacedim>
1111 void
1113 std::vector<types::global_dof_index> &new_dof_indices,
1114 const DoFHandler<dim, spacedim> & dof_handler,
1115 const std::vector<bool> & selected_dofs);
1116
1126 template <int dim, int spacedim>
1127 void
1129 std::vector<types::global_dof_index> &new_dof_indices,
1130 const DoFHandler<dim, spacedim> & dof_handler,
1131 const std::vector<bool> & selected_dofs,
1132 const unsigned int level);
1133
1144 template <int dim, int spacedim>
1145 void
1146 random(DoFHandler<dim, spacedim> &dof_handler);
1147
1154 template <int dim, int spacedim>
1155 void
1156 random(DoFHandler<dim, spacedim> &dof_handler, const unsigned int level);
1157
1165 template <int dim, int spacedim>
1166 void
1167 compute_random(std::vector<types::global_dof_index> &new_dof_indices,
1168 const DoFHandler<dim, spacedim> & dof_handler);
1169
1175 template <int dim, int spacedim>
1176 void
1177 compute_random(std::vector<types::global_dof_index> &new_dof_indices,
1178 const DoFHandler<dim, spacedim> & dof_handler,
1179 const unsigned int level);
1180
1212 template <int dim, int spacedim>
1213 void
1215
1221 template <int dim, int spacedim>
1222 void
1223 compute_subdomain_wise(std::vector<types::global_dof_index> &new_dof_indices,
1224 const DoFHandler<dim, spacedim> & dof_handler);
1225
1261 template <int dim, int spacedim>
1262 void
1264
1270 template <int dim, int spacedim>
1271 void
1273 std::vector<types::global_dof_index> &new_dof_indices,
1274 const DoFHandler<dim, spacedim> & dof_handler);
1275
1317 template <int dim,
1318 int spacedim,
1319 typename Number,
1320 typename VectorizedArrayType>
1321 void
1323 DoFHandler<dim, spacedim> & dof_handler,
1325
1335 template <int dim, int spacedim, typename Number, typename AdditionalDataType>
1336 void
1338 DoFHandler<dim, spacedim> & dof_handler,
1339 const AffineConstraints<Number> &constraints,
1340 const AdditionalDataType & matrix_free_additional_data);
1341
1348 template <int dim,
1349 int spacedim,
1350 typename Number,
1351 typename VectorizedArrayType>
1352 std::vector<types::global_dof_index>
1354 const DoFHandler<dim, spacedim> & dof_handler,
1356
1363 template <int dim, int spacedim, typename Number, typename AdditionalDataType>
1364 std::vector<types::global_dof_index>
1366 const DoFHandler<dim, spacedim> &dof_handler,
1367 const AffineConstraints<Number> &constraints,
1368 const AdditionalDataType & matrix_free_additional_data);
1369
1381 "The DoFHandler on which this function should work has not "
1382 "been initialized, i.e., it doesn't appear that DoF indices "
1383 "have been distributed on it.");
1384
1391
1399} // namespace DoFRenumbering
1400
1401
1403
1404#endif
typename LevelSelector::cell_iterator level_cell_iterator
Definition point.h:112
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
Point< 3 > center
unsigned int level
Definition grid_out.cc:4618
#define DeclException0(Exception0)
Definition exceptions.h:465
static ::ExceptionBase & ExcInvalidComponentOrder()
#define DeclExceptionMsg(Exception, defaulttext)
Definition exceptions.h:488
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)
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 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_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)
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)
static const unsigned int invalid_unsigned_int
Definition types.h:213
typename type_identity< T >::type type_identity_t
Definition type_traits.h:96
unsigned int global_dof_index
Definition types.h:82
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