Reference documentation for deal.II version 9.2.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 - 2019 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 
345 namespace DoFRenumbering
346 {
352  template <class Iterator, int dim>
354  {
359  : dir(dir)
360  {}
364  bool
365  operator()(const Iterator &c1, const Iterator &c2) const
366  {
367  const Tensor<1, dim> diff = c2->center() - c1->center();
368  return (diff * dir > 0);
369  }
370 
371  private:
376  };
377 
378 
386  template <int dim>
388  {
393  : dir(dir)
394  {}
398  bool
400  const std::pair<Point<dim>, types::global_dof_index> &c2) const
401  {
402  const Tensor<1, dim> diff = c2.first - c1.first;
403  return (diff * dir > 0 || (diff * dir == 0 && c1.second < c2.second));
404  }
405 
406  private:
411  };
412 
413 
414 
428  namespace boost
429  {
441  template <typename DoFHandlerType>
442  void
443  Cuthill_McKee(DoFHandlerType &dof_handler,
444  const bool reversed_numbering = false,
445  const bool use_constraints = false);
446 
452  template <typename DoFHandlerType>
453  void
454  compute_Cuthill_McKee(std::vector<types::global_dof_index> &new_dof_indices,
455  const DoFHandlerType &,
456  const bool reversed_numbering = false,
457  const bool use_constraints = false);
458 
471  template <typename DoFHandlerType>
472  void
473  king_ordering(DoFHandlerType &dof_handler,
474  const bool reversed_numbering = false,
475  const bool use_constraints = false);
476 
481  template <typename DoFHandlerType>
482  void
483  compute_king_ordering(std::vector<types::global_dof_index> &new_dof_indices,
484  const DoFHandlerType &,
485  const bool reversed_numbering = false,
486  const bool use_constraints = false);
487 
499  template <typename DoFHandlerType>
500  void
501  minimum_degree(DoFHandlerType &dof_handler,
502  const bool reversed_numbering = false,
503  const bool use_constraints = false);
504 
509  template <typename DoFHandlerType>
510  void
512  std::vector<types::global_dof_index> &new_dof_indices,
513  const DoFHandlerType &,
514  const bool reversed_numbering = false,
515  const bool use_constraints = false);
516  } // namespace boost
517 
582  template <typename DoFHandlerType>
583  void
584  Cuthill_McKee(DoFHandlerType &dof_handler,
585  const bool reversed_numbering = false,
586  const bool use_constraints = false,
587  const std::vector<types::global_dof_index> &starting_indices =
588  std::vector<types::global_dof_index>());
589 
597  template <typename DoFHandlerType>
598  void
600  std::vector<types::global_dof_index> &new_dof_indices,
601  const DoFHandlerType &,
602  const bool reversed_numbering = false,
603  const bool use_constraints = false,
604  const std::vector<types::global_dof_index> &starting_indices =
605  std::vector<types::global_dof_index>());
606 
620  template <typename DoFHandlerType>
621  void
622  Cuthill_McKee(DoFHandlerType & dof_handler,
623  const unsigned int level,
624  const bool reversed_numbering = false,
625  const std::vector<types::global_dof_index> &starting_indices =
626  std::vector<types::global_dof_index>());
627 
659  template <typename DoFHandlerType>
660  void
661  component_wise(DoFHandlerType & dof_handler,
662  const std::vector<unsigned int> &target_component =
663  std::vector<unsigned int>());
664 
665 
672  template <typename DoFHandlerType>
673  void
674  component_wise(DoFHandlerType & dof_handler,
675  const unsigned int level,
676  const std::vector<unsigned int> &target_component =
677  std::vector<unsigned int>());
678 
684  template <int dim, int spacedim, typename CellIterator>
686  compute_component_wise(std::vector<types::global_dof_index> &new_dof_indices,
687  const CellIterator & start,
688  const typename identity<CellIterator>::type &end,
689  const std::vector<unsigned int> &target_component,
690  const bool is_level_operation);
691 
708  template <int dim, int spacedim>
709  void
711 
718  template <int dim, int spacedim>
719  void
720  block_wise(DoFHandler<dim, spacedim> &dof_handler, const unsigned int level);
721 
738  template <int dim, int spacedim>
739  void
741 
747  template <int dim, int spacedim, class ITERATOR, class ENDITERATOR>
749  compute_block_wise(std::vector<types::global_dof_index> &new_dof_indices,
750  const ITERATOR & start,
751  const ENDITERATOR & end,
752  bool is_level_operation);
753 
835  template <typename DoFHandlerType>
836  void
837  hierarchical(DoFHandlerType &dof_handler);
838 
863  template <typename DoFHandlerType>
864  void
865  cell_wise(DoFHandlerType &dof_handler,
866  const std::vector<typename DoFHandlerType::active_cell_iterator>
867  &cell_order);
868 
904  template <typename DoFHandlerType>
905  void
907  std::vector<types::global_dof_index> &renumbering,
908  std::vector<types::global_dof_index> &inverse_renumbering,
909  const DoFHandlerType & dof_handler,
910  const std::vector<typename DoFHandlerType::active_cell_iterator>
911  &cell_order);
912 
917  template <typename DoFHandlerType>
918  void
919  cell_wise(DoFHandlerType & dof_handler,
920  const unsigned int level,
921  const std::vector<typename DoFHandlerType::level_cell_iterator>
922  &cell_order);
923 
928  template <typename DoFHandlerType>
929  void
931  std::vector<types::global_dof_index> &renumbering,
932  std::vector<types::global_dof_index> &inverse_renumbering,
933  const DoFHandlerType & dof_handler,
934  const unsigned int level,
935  const std::vector<typename DoFHandlerType::level_cell_iterator>
936  &cell_order);
937 
973  template <typename DoFHandlerType>
974  void
975  downstream(DoFHandlerType & dof_handler,
977  const bool dof_wise_renumbering = false);
978 
979 
985  template <typename DoFHandlerType>
986  void
987  downstream(DoFHandlerType & dof_handler,
988  const unsigned int level,
990  const bool dof_wise_renumbering = false);
991 
997  template <typename DoFHandlerType>
998  void
1000  std::vector<types::global_dof_index> & new_dof_indices,
1001  std::vector<types::global_dof_index> & reverse,
1002  const DoFHandlerType & dof_handler,
1004  const bool dof_wise_renumbering);
1005 
1011  template <typename DoFHandlerType>
1012  void
1014  std::vector<types::global_dof_index> & new_dof_indices,
1015  std::vector<types::global_dof_index> & reverse,
1016  const DoFHandlerType & dof_handler,
1017  const unsigned int level,
1019  const bool dof_wise_renumbering);
1020 
1029  template <typename DoFHandlerType>
1030  void
1031  clockwise_dg(DoFHandlerType & dof_handler,
1033  const bool counter = false);
1034 
1039  template <typename DoFHandlerType>
1040  void
1041  clockwise_dg(DoFHandlerType & dof_handler,
1042  const unsigned int level,
1044  const bool counter = false);
1045 
1051  template <typename DoFHandlerType>
1052  void
1053  compute_clockwise_dg(std::vector<types::global_dof_index> &new_dof_indices,
1054  const DoFHandlerType & dof_handler,
1056  const bool counter);
1057 
1076  template <typename DoFHandlerType>
1077  void
1078  sort_selected_dofs_back(DoFHandlerType & dof_handler,
1079  const std::vector<bool> &selected_dofs);
1080 
1091  template <typename DoFHandlerType>
1092  void
1093  sort_selected_dofs_back(DoFHandlerType & dof_handler,
1094  const std::vector<bool> &selected_dofs,
1095  const unsigned int level);
1096 
1105  template <typename DoFHandlerType>
1106  void
1108  std::vector<types::global_dof_index> &new_dof_indices,
1109  const DoFHandlerType & dof_handler,
1110  const std::vector<bool> & selected_dofs);
1111 
1121  template <typename DoFHandlerType>
1122  void
1124  std::vector<types::global_dof_index> &new_dof_indices,
1125  const DoFHandlerType & dof_handler,
1126  const std::vector<bool> & selected_dofs,
1127  const unsigned int level);
1128 
1139  template <typename DoFHandlerType>
1140  void
1141  random(DoFHandlerType &dof_handler);
1142 
1149  template <typename DoFHandlerType>
1150  void
1151  random(DoFHandlerType &dof_handler, const unsigned int level);
1152 
1160  template <typename DoFHandlerType>
1161  void
1162  compute_random(std::vector<types::global_dof_index> &new_dof_indices,
1163  const DoFHandlerType & dof_handler);
1164 
1170  template <typename DoFHandlerType>
1171  void
1172  compute_random(std::vector<types::global_dof_index> &new_dof_indices,
1173  const DoFHandlerType & dof_handler,
1174  const unsigned int level);
1175 
1207  template <typename DoFHandlerType>
1208  void
1209  subdomain_wise(DoFHandlerType &dof_handler);
1210 
1216  template <typename DoFHandlerType>
1217  void
1218  compute_subdomain_wise(std::vector<types::global_dof_index> &new_dof_indices,
1219  const DoFHandlerType & dof_handler);
1220 
1233  "The DoFHandler on which this function should work has not "
1234  "been initialized, i.e., it doesn't appear that DoF indices "
1235  "have been distributed on it.");
1236 
1243 
1251 } // namespace DoFRenumbering
1252 
1253 
1255 
1256 #endif
identity::type
T type
Definition: template_constraints.h:270
DeclExceptionMsg
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
DoFRenumbering::compute_random
void compute_random(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandlerType &dof_handler)
Definition: dof_renumbering.cc:2133
DoFRenumbering::subdomain_wise
void subdomain_wise(DoFHandlerType &dof_handler)
Definition: dof_renumbering.cc:2200
DoFRenumbering::compute_Cuthill_McKee
void compute_Cuthill_McKee(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandlerType &, 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 >())
Definition: dof_renumbering.cc:393
DoFRenumbering::random
void random(DoFHandlerType &dof_handler)
Definition: dof_renumbering.cc:2102
DoFRenumbering::compute_downstream
void compute_downstream(std::vector< types::global_dof_index > &new_dof_indices, std::vector< types::global_dof_index > &reverse, const DoFHandlerType &dof_handler, const Tensor< 1, DoFHandlerType::space_dimension > &direction, const bool dof_wise_renumbering)
Definition: dof_renumbering.cc:1751
DoFRenumbering::boost::king_ordering
void king_ordering(DoFHandlerType &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false)
Definition: dof_renumbering.cc:190
DoFRenumbering::ComparePointwiseDownstream::operator()
bool operator()(const std::pair< Point< dim >, types::global_dof_index > &c1, const std::pair< Point< dim >, types::global_dof_index > &c2) const
Definition: dof_renumbering.h:399
DoFRenumbering::CompareDownstream::operator()
bool operator()(const Iterator &c1, const Iterator &c2) const
Definition: dof_renumbering.h:365
DoFRenumbering::downstream
void downstream(DoFHandlerType &dof_handler, const Tensor< 1, DoFHandlerType::space_dimension > &direction, const bool dof_wise_renumbering=false)
Definition: dof_renumbering.cc:1735
DoFRenumbering::compute_clockwise_dg
void compute_clockwise_dg(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandlerType &dof_handler, const Point< DoFHandlerType::space_dimension > &center, const bool counter)
Definition: dof_renumbering.cc:2047
DoFRenumbering::boost::compute_minimum_degree
void compute_minimum_degree(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandlerType &, const bool reversed_numbering=false, const bool use_constraints=false)
Definition: dof_renumbering.cc:266
DoFRenumbering::ComparePointwiseDownstream::dir
const Tensor< 1, dim > dir
Definition: dof_renumbering.h:410
boost
Definition: bounding_box.h:28
DoFRenumbering::compute_component_wise
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)
Definition: dof_renumbering.cc:702
DoFRenumbering::boost::Cuthill_McKee
void Cuthill_McKee(DoFHandlerType &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false)
Definition: dof_renumbering.cc:128
DoFRenumbering::hierarchical
void hierarchical(DoFHandlerType &dof_handler)
Definition: dof_renumbering.cc:1350
DoFRenumbering::ExcDoFHandlerNotInitialized
static ::ExceptionBase & ExcDoFHandlerNotInitialized()
hp::DoFHandler
Definition: dof_handler.h:203
DoFHandler
Definition: dof_handler.h:205
DoFRenumbering::compute_cell_wise
void compute_cell_wise(std::vector< types::global_dof_index > &renumbering, std::vector< types::global_dof_index > &inverse_renumbering, const DoFHandlerType &dof_handler, const std::vector< typename DoFHandlerType::active_cell_iterator > &cell_order)
DoFRenumbering::sort_selected_dofs_back
void sort_selected_dofs_back(DoFHandlerType &dof_handler, const std::vector< bool > &selected_dofs)
Definition: dof_renumbering.cc:1455
level
unsigned int level
Definition: grid_out.cc:4355
DoFRenumbering::ExcNotDGFEM
static ::ExceptionBase & ExcNotDGFEM()
DoFRenumbering::compute_block_wise
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)
Definition: dof_renumbering.cc:1058
TransposeTableIterators::Iterator
MatrixTableIterators::Iterator< TransposeTable< T >, Constness, MatrixTableIterators::Storage::column_major > Iterator
Definition: table.h:1913
DoFRenumbering::boost::compute_king_ordering
void compute_king_ordering(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandlerType &, const bool reversed_numbering=false, const bool use_constraints=false)
Definition: dof_renumbering.cc:210
DoFRenumbering::ComparePointwiseDownstream::ComparePointwiseDownstream
ComparePointwiseDownstream(const Tensor< 1, dim > &dir)
Definition: dof_renumbering.h:392
DoFRenumbering::CompareDownstream::dir
const Tensor< 1, dim > dir
Definition: dof_renumbering.h:375
types::global_dof_index
unsigned int global_dof_index
Definition: types.h:76
Tensor< 1, dim >
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
DoFRenumbering::CompareDownstream
Definition: dof_renumbering.h:353
TrilinosWrappers::internal::end
VectorType::value_type * end(VectorType &V)
Definition: trilinos_sparse_matrix.cc:65
DoFRenumbering::block_wise
void block_wise(DoFHandler< dim, spacedim > &dof_handler)
Definition: dof_renumbering.cc:951
exceptions.h
DoFRenumbering::compute_subdomain_wise
void compute_subdomain_wise(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandlerType &dof_handler)
Definition: dof_renumbering.cc:2221
DoFRenumbering
Definition: dof_renumbering.h:345
unsigned int
DoFRenumbering::clockwise_dg
void clockwise_dg(DoFHandlerType &dof_handler, const Point< DoFHandlerType::space_dimension > &center, const bool counter=false)
Definition: dof_renumbering.cc:2033
DoFRenumbering::cell_wise
void cell_wise(DoFHandlerType &dof_handler, const std::vector< typename DoFHandlerType::active_cell_iterator > &cell_order)
Definition: dof_renumbering.cc:1570
DoFRenumbering::CompareDownstream::CompareDownstream
CompareDownstream(const Tensor< 1, dim > &dir)
Definition: dof_renumbering.h:358
dof_handler.h
DeclException0
#define DeclException0(Exception0)
Definition: exceptions.h:473
Point< dim >
DoFRenumbering::Cuthill_McKee
void Cuthill_McKee(DoFHandlerType &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 >())
Definition: dof_renumbering.cc:369
DoFRenumbering::boost::minimum_degree
void minimum_degree(DoFHandlerType &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false)
Definition: dof_renumbering.cc:246
config.h
DoFRenumbering::ComparePointwiseDownstream
Definition: dof_renumbering.h:387
DoFRenumbering::compute_sort_selected_dofs_back
void compute_sort_selected_dofs_back(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandlerType &dof_handler, const std::vector< bool > &selected_dofs)
Definition: dof_renumbering.cc:1490
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
DoFRenumbering::component_wise
void component_wise(DoFHandlerType &dof_handler, const std::vector< unsigned int > &target_component=std::vector< unsigned int >())
Definition: dof_renumbering.cc:633
center
Point< 3 > center
Definition: data_out_base.cc:169
DoFRenumbering::boost::compute_Cuthill_McKee
void compute_Cuthill_McKee(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandlerType &, const bool reversed_numbering=false, const bool use_constraints=false)
Definition: dof_renumbering.cc:148
DoFRenumbering::ExcInvalidComponentOrder
static ::ExceptionBase & ExcInvalidComponentOrder()
dof_handler.h
point.h