Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
dof_renumbering.h
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 
22 #include <deal.II/base/exceptions.h>
23 #include <deal.II/base/point.h>
24 
25 #include <deal.II/dofs/dof_handler.h>
26 
27 #include <deal.II/hp/dof_handler.h>
28 
29 #include <vector>
30 
31 DEAL_II_NAMESPACE_OPEN
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 
862  template <typename DoFHandlerType>
863  void
864  cell_wise(DoFHandlerType &dof_handler,
865  const std::vector<typename DoFHandlerType::active_cell_iterator>
866  &cell_order);
867 
903  template <typename DoFHandlerType>
904  void
906  std::vector<types::global_dof_index> &renumbering,
907  std::vector<types::global_dof_index> &inverse_renumbering,
908  const DoFHandlerType & dof_handler,
909  const std::vector<typename DoFHandlerType::active_cell_iterator>
910  &cell_order);
911 
916  template <typename DoFHandlerType>
917  void
918  cell_wise(DoFHandlerType & dof_handler,
919  const unsigned int level,
920  const std::vector<typename DoFHandlerType::level_cell_iterator>
921  &cell_order);
922 
927  template <typename DoFHandlerType>
928  void
930  std::vector<types::global_dof_index> &renumbering,
931  std::vector<types::global_dof_index> &inverse_renumbering,
932  const DoFHandlerType & dof_handler,
933  const unsigned int level,
934  const std::vector<typename DoFHandlerType::level_cell_iterator>
935  &cell_order);
936 
972  template <typename DoFHandlerType>
973  void
974  downstream(DoFHandlerType & dof_handler,
976  const bool dof_wise_renumbering = false);
977 
978 
984  template <typename DoFHandlerType>
985  void
986  downstream(DoFHandlerType & dof_handler,
987  const unsigned int level,
989  const bool dof_wise_renumbering = false);
990 
996  template <typename DoFHandlerType>
997  void
999  std::vector<types::global_dof_index> & new_dof_indices,
1000  std::vector<types::global_dof_index> & reverse,
1001  const DoFHandlerType & dof_handler,
1003  const bool dof_wise_renumbering);
1004 
1010  template <typename DoFHandlerType>
1011  void
1013  std::vector<types::global_dof_index> & new_dof_indices,
1014  std::vector<types::global_dof_index> & reverse,
1015  const DoFHandlerType & dof_handler,
1016  const unsigned int level,
1018  const bool dof_wise_renumbering);
1019 
1028  template <typename DoFHandlerType>
1029  void
1030  clockwise_dg(DoFHandlerType & dof_handler,
1032  const bool counter = false);
1033 
1038  template <typename DoFHandlerType>
1039  void
1040  clockwise_dg(DoFHandlerType & dof_handler,
1041  const unsigned int level,
1043  const bool counter = false);
1044 
1050  template <typename DoFHandlerType>
1051  void
1052  compute_clockwise_dg(std::vector<types::global_dof_index> &new_dof_indices,
1053  const DoFHandlerType & dof_handler,
1055  const bool counter);
1056 
1075  template <typename DoFHandlerType>
1076  void
1077  sort_selected_dofs_back(DoFHandlerType & dof_handler,
1078  const std::vector<bool> &selected_dofs);
1079 
1090  template <typename DoFHandlerType>
1091  void
1092  sort_selected_dofs_back(DoFHandlerType & dof_handler,
1093  const std::vector<bool> &selected_dofs,
1094  const unsigned int level);
1095 
1104  template <typename DoFHandlerType>
1105  void
1107  std::vector<types::global_dof_index> &new_dof_indices,
1108  const DoFHandlerType & dof_handler,
1109  const std::vector<bool> & selected_dofs);
1110 
1120  template <typename DoFHandlerType>
1121  void
1123  std::vector<types::global_dof_index> &new_dof_indices,
1124  const DoFHandlerType & dof_handler,
1125  const std::vector<bool> & selected_dofs,
1126  const unsigned int level);
1127 
1138  template <typename DoFHandlerType>
1139  void
1140  random(DoFHandlerType &dof_handler);
1141 
1148  template <typename DoFHandlerType>
1149  void
1150  random(DoFHandlerType &dof_handler, const unsigned int level);
1151 
1159  template <typename DoFHandlerType>
1160  void
1161  compute_random(std::vector<types::global_dof_index> &new_dof_indices,
1162  const DoFHandlerType & dof_handler);
1163 
1169  template <typename DoFHandlerType>
1170  void
1171  compute_random(std::vector<types::global_dof_index> &new_dof_indices,
1172  const DoFHandlerType & dof_handler,
1173  const unsigned int level);
1174 
1206  template <typename DoFHandlerType>
1207  void
1208  subdomain_wise(DoFHandlerType &dof_handler);
1209 
1215  template <typename DoFHandlerType>
1216  void
1217  compute_subdomain_wise(std::vector<types::global_dof_index> &new_dof_indices,
1218  const DoFHandlerType & dof_handler);
1219 
1232  "The DoFHandler on which this function should work has not "
1233  "been initialized, i.e., it doesn't appear that DoF indices "
1234  "have been distributed on it.");
1235 
1242 
1250 } // namespace DoFRenumbering
1251 
1252 
1253 DEAL_II_NAMESPACE_CLOSE
1254 
1255 #endif
static ::ExceptionBase & ExcInvalidComponentOrder()
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)
void downstream(DoFHandlerType &dof_handler, const Tensor< 1, DoFHandlerType::space_dimension > &direction, const bool dof_wise_renumbering=false)
void minimum_degree(DoFHandlerType &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false)
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)
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)
void sort_selected_dofs_back(DoFHandlerType &dof_handler, const std::vector< bool > &selected_dofs)
void component_wise(DoFHandlerType &dof_handler, const std::vector< unsigned int > &target_component=std::vector< unsigned int >())
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)
CompareDownstream(const Tensor< 1, dim > &dir)
static ::ExceptionBase & ExcDoFHandlerNotInitialized()
void random(DoFHandlerType &dof_handler)
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)
void Cuthill_McKee(DoFHandlerType &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false)
void compute_subdomain_wise(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandlerType &dof_handler)
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
static ::ExceptionBase & ExcNotDGFEM()
#define DeclException0(Exception0)
Definition: exceptions.h:473
bool operator()(const std::pair< Point< dim >, types::global_dof_index > &c1, const std::pair< Point< dim >, types::global_dof_index > &c2) const
void compute_random(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandlerType &dof_handler)
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)
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 >())
unsigned int global_dof_index
Definition: types.h:89
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)
void king_ordering(DoFHandlerType &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false)
void hierarchical(DoFHandlerType &dof_handler)
void block_wise(DoFHandler< dim, spacedim > &dof_handler)
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 >())
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)
ComparePointwiseDownstream(const Tensor< 1, dim > &dir)
void subdomain_wise(DoFHandlerType &dof_handler)
void clockwise_dg(DoFHandlerType &dof_handler, const Point< DoFHandlerType::space_dimension > &center, const bool counter=false)
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 cell_wise(DoFHandlerType &dof_handler, const std::vector< typename DoFHandlerType::active_cell_iterator > &cell_order)
bool operator()(const Iterator &c1, const Iterator &c2) const