Reference documentation for deal.II version Git e413cbf8ac 2021-08-02 21:56:02 +0200
\(\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 - 2020 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 
342 namespace DoFRenumbering
343 {
349  template <class Iterator, int dim>
351  {
356  : dir(dir)
357  {}
361  bool
362  operator()(const Iterator &c1, const Iterator &c2) const
363  {
364  const Tensor<1, dim> diff = c2->center() - c1->center();
365  return (diff * dir > 0);
366  }
367 
368  private:
373  };
374 
375 
383  template <int dim>
385  {
390  : dir(dir)
391  {}
395  bool
397  const std::pair<Point<dim>, types::global_dof_index> &c2) const
398  {
399  const Tensor<1, dim> diff = c2.first - c1.first;
400  return (diff * dir > 0 || (diff * dir == 0 && c1.second < c2.second));
401  }
402 
403  private:
408  };
409 
410 
411 
425  namespace boost
426  {
438  template <int dim, int spacedim>
439  void
441  const bool reversed_numbering = false,
442  const bool use_constraints = false);
443 
449  template <int dim, int spacedim>
450  void
451  compute_Cuthill_McKee(std::vector<types::global_dof_index> &new_dof_indices,
453  const bool reversed_numbering = false,
454  const bool use_constraints = false);
455 
468  template <int dim, int spacedim>
469  void
471  const bool reversed_numbering = false,
472  const bool use_constraints = false);
473 
478  template <int dim, int spacedim>
479  void
480  compute_king_ordering(std::vector<types::global_dof_index> &new_dof_indices,
482  const bool reversed_numbering = false,
483  const bool use_constraints = false);
484 
496  template <int dim, int spacedim>
497  void
499  const bool reversed_numbering = false,
500  const bool use_constraints = false);
501 
506  template <int dim, int spacedim>
507  void
509  std::vector<types::global_dof_index> &new_dof_indices,
511  const bool reversed_numbering = false,
512  const bool use_constraints = false);
513  } // namespace boost
514 
579  template <int dim, int spacedim>
580  void
582  const bool reversed_numbering = false,
583  const bool use_constraints = false,
584  const std::vector<types::global_dof_index> &starting_indices =
585  std::vector<types::global_dof_index>());
586 
596  template <int dim, int spacedim>
597  void
599  std::vector<types::global_dof_index> &new_dof_indices,
601  const bool reversed_numbering = false,
602  const bool use_constraints = false,
603  const std::vector<types::global_dof_index> &starting_indices =
604  std::vector<types::global_dof_index>(),
605  const unsigned int level = numbers::invalid_unsigned_int);
606 
620  template <int dim, int spacedim>
621  void
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 <int dim, int spacedim>
660  void
662  const std::vector<unsigned int> &target_component =
663  std::vector<unsigned int>());
664 
665 
672  template <int dim, int spacedim>
673  void
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 
720  template <int dim, int spacedim>
721  void
723 
730  template <int dim, int spacedim>
731  void
732  block_wise(DoFHandler<dim, spacedim> &dof_handler, const unsigned int level);
733 
739  template <int dim, int spacedim, class ITERATOR, class ENDITERATOR>
741  compute_block_wise(std::vector<types::global_dof_index> &new_dof_indices,
742  const ITERATOR & start,
743  const ENDITERATOR & end,
744  bool is_level_operation);
745 
827  template <int dim, int spacedim>
828  void
830 
855  template <int dim, int spacedim>
856  void
857  cell_wise(
858  DoFHandler<dim, spacedim> &dof_handler,
859  const std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
860  &cell_order);
861 
897  template <int dim, int spacedim>
898  void
900  std::vector<types::global_dof_index> &renumbering,
901  std::vector<types::global_dof_index> &inverse_renumbering,
902  const DoFHandler<dim, spacedim> & dof_handler,
903  const std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
904  &cell_order);
905 
910  template <int dim, int spacedim>
911  void
912  cell_wise(
913  DoFHandler<dim, spacedim> &dof_handler,
914  const unsigned int level,
915  const std::vector<typename DoFHandler<dim, spacedim>::level_cell_iterator>
916  &cell_order);
917 
922  template <int dim, int spacedim>
923  void
925  std::vector<types::global_dof_index> &renumbering,
926  std::vector<types::global_dof_index> &inverse_renumbering,
927  const DoFHandler<dim, spacedim> & dof_handler,
928  const unsigned int level,
929  const std::vector<typename DoFHandler<dim, spacedim>::level_cell_iterator>
930  &cell_order);
931 
967  template <int dim, int spacedim>
968  void
970  const Tensor<1, spacedim> &direction,
971  const bool dof_wise_renumbering = false);
972 
973 
979  template <int dim, int spacedim>
980  void
982  const unsigned int level,
983  const Tensor<1, spacedim> &direction,
984  const bool dof_wise_renumbering = false);
985 
991  template <int dim, int spacedim>
992  void
993  compute_downstream(std::vector<types::global_dof_index> &new_dof_indices,
994  std::vector<types::global_dof_index> &reverse,
995  const DoFHandler<dim, spacedim> & dof_handler,
996  const Tensor<1, spacedim> & direction,
997  const bool dof_wise_renumbering);
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 unsigned int level,
1010  const Tensor<1, spacedim> & direction,
1011  const bool dof_wise_renumbering);
1012 
1021  template <int dim, int spacedim>
1022  void
1024  const Point<spacedim> & center,
1025  const bool counter = false);
1026 
1031  template <int dim, int spacedim>
1032  void
1034  const unsigned int level,
1035  const Point<spacedim> & center,
1036  const bool counter = false);
1037 
1043  template <int dim, int spacedim>
1044  void
1045  compute_clockwise_dg(std::vector<types::global_dof_index> &new_dof_indices,
1046  const DoFHandler<dim, spacedim> & dof_handler,
1047  const Point<spacedim> & center,
1048  const bool counter);
1049 
1068  template <int dim, int spacedim>
1069  void
1071  const std::vector<bool> & selected_dofs);
1072 
1083  template <int dim, int spacedim>
1084  void
1086  const std::vector<bool> & selected_dofs,
1087  const unsigned int level);
1088 
1097  template <int dim, int spacedim>
1098  void
1100  std::vector<types::global_dof_index> &new_dof_indices,
1101  const DoFHandler<dim, spacedim> & dof_handler,
1102  const std::vector<bool> & selected_dofs);
1103 
1113  template <int dim, int spacedim>
1114  void
1116  std::vector<types::global_dof_index> &new_dof_indices,
1117  const DoFHandler<dim, spacedim> & dof_handler,
1118  const std::vector<bool> & selected_dofs,
1119  const unsigned int level);
1120 
1131  template <int dim, int spacedim>
1132  void
1133  random(DoFHandler<dim, spacedim> &dof_handler);
1134 
1141  template <int dim, int spacedim>
1142  void
1143  random(DoFHandler<dim, spacedim> &dof_handler, const unsigned int level);
1144 
1152  template <int dim, int spacedim>
1153  void
1154  compute_random(std::vector<types::global_dof_index> &new_dof_indices,
1155  const DoFHandler<dim, spacedim> & dof_handler);
1156 
1162  template <int dim, int spacedim>
1163  void
1164  compute_random(std::vector<types::global_dof_index> &new_dof_indices,
1165  const DoFHandler<dim, spacedim> & dof_handler,
1166  const unsigned int level);
1167 
1199  template <int dim, int spacedim>
1200  void
1202 
1208  template <int dim, int spacedim>
1209  void
1210  compute_subdomain_wise(std::vector<types::global_dof_index> &new_dof_indices,
1211  const DoFHandler<dim, spacedim> & dof_handler);
1212 
1225  "The DoFHandler on which this function should work has not "
1226  "been initialized, i.e., it doesn't appear that DoF indices "
1227  "have been distributed on it.");
1228 
1235 
1243 } // namespace DoFRenumbering
1244 
1245 
1247 
1248 #endif
static ::ExceptionBase & ExcInvalidComponentOrder()
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)
static const unsigned int invalid_unsigned_int
Definition: types.h:196
void cell_wise(DoFHandler< dim, spacedim > &dof_handler, const std::vector< typename DoFHandler< dim, spacedim >::active_cell_iterator > &cell_order)
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)
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)
CompareDownstream(const Tensor< 1, dim > &dir)
void minimum_degree(DoFHandler< dim, spacedim > &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false)
static ::ExceptionBase & ExcDoFHandlerNotInitialized()
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 subdomain_wise(DoFHandler< dim, spacedim > &dof_handler)
void compute_subdomain_wise(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &dof_handler)
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:493
static ::ExceptionBase & ExcNotDGFEM()
#define DeclException0(Exception0)
Definition: exceptions.h:470
bool operator()(const std::pair< Point< dim >, types::global_dof_index > &c1, const std::pair< Point< dim >, types::global_dof_index > &c2) const
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:401
unsigned int level
Definition: grid_out.cc:4589
VectorType::value_type * end(VectorType &V)
typename LevelSelector::cell_iterator level_cell_iterator
Definition: dof_handler.h:502
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 clockwise_dg(DoFHandler< dim, spacedim > &dof_handler, const Point< spacedim > &center, const bool counter=false)
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)
void king_ordering(DoFHandler< dim, spacedim > &dof_handler, const bool reversed_numbering=false, const bool use_constraints=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)
unsigned int global_dof_index
Definition: types.h:76
void hierarchical(DoFHandler< dim, spacedim > &dof_handler)
void sort_selected_dofs_back(DoFHandler< dim, spacedim > &dof_handler, const std::vector< bool > &selected_dofs)
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:400
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 >())
Point< 3 > center
ComparePointwiseDownstream(const Tensor< 1, dim > &dir)
typename ActiveSelector::active_cell_iterator active_cell_iterator
Definition: dof_handler.h:438
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_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)
bool operator()(const Iterator &c1, const Iterator &c2) const