Reference documentation for deal.II version 9.0.0
dof_renumbering.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2003 - 2018 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 at
12 // the top level of the deal.II distribution.
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 #include <deal.II/base/exceptions.h>
22 #include <deal.II/base/point.h>
23 #include <deal.II/dofs/dof_handler.h>
24 #include <deal.II/hp/dof_handler.h>
25 
26 #include <vector>
27 
28 DEAL_II_NAMESPACE_OPEN
29 
342 namespace DoFRenumbering
343 {
349  template <class Iterator, int dim>
351  {
356  :
357  dir(dir)
358  {}
362  bool 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  :
391  dir(dir)
392  {}
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 <typename DoFHandlerType>
439  void
440  Cuthill_McKee (DoFHandlerType &dof_handler,
441  const bool reversed_numbering = false,
442  const bool use_constraints = false);
443 
449  template <typename DoFHandlerType>
450  void
451  compute_Cuthill_McKee (std::vector<types::global_dof_index> &new_dof_indices,
452  const DoFHandlerType &,
453  const bool reversed_numbering = false,
454  const bool use_constraints = false);
455 
468  template <typename DoFHandlerType>
469  void
470  king_ordering (DoFHandlerType &dof_handler,
471  const bool reversed_numbering = false,
472  const bool use_constraints = false);
473 
478  template <typename DoFHandlerType>
479  void
480  compute_king_ordering (std::vector<types::global_dof_index> &new_dof_indices,
481  const DoFHandlerType &,
482  const bool reversed_numbering = false,
483  const bool use_constraints = false);
484 
496  template <typename DoFHandlerType>
497  void
498  minimum_degree (DoFHandlerType &dof_handler,
499  const bool reversed_numbering = false,
500  const bool use_constraints = false);
501 
506  template <typename DoFHandlerType>
507  void
508  compute_minimum_degree (std::vector<types::global_dof_index> &new_dof_indices,
509  const DoFHandlerType &,
510  const bool reversed_numbering = false,
511  const bool use_constraints = false);
512  }
513 
578  template <typename DoFHandlerType>
579  void
580  Cuthill_McKee (DoFHandlerType &dof_handler,
581  const bool reversed_numbering = false,
582  const bool use_constraints = false,
583  const std::vector<types::global_dof_index> &starting_indices
584  = std::vector<types::global_dof_index>());
585 
593  template <typename DoFHandlerType>
594  void
595  compute_Cuthill_McKee (std::vector<types::global_dof_index> &new_dof_indices,
596  const DoFHandlerType &,
597  const bool reversed_numbering = false,
598  const bool use_constraints = false,
599  const std::vector<types::global_dof_index> &starting_indices
600  = std::vector<types::global_dof_index>());
601 
615  template <typename DoFHandlerType>
616  void
617  Cuthill_McKee (DoFHandlerType &dof_handler,
618  const unsigned int level,
619  const bool reversed_numbering = false,
620  const std::vector<types::global_dof_index> &starting_indices
621  = std::vector<types::global_dof_index> ());
622 
654  template <typename DoFHandlerType>
655  void
656  component_wise (DoFHandlerType &dof_handler,
657  const std::vector<unsigned int> &target_component
658  = std::vector<unsigned int>());
659 
660 
667  template <typename DoFHandlerType>
668  void
669  component_wise (DoFHandlerType &dof_handler,
670  const unsigned int level,
671  const std::vector<unsigned int> &target_component
672  = std::vector<unsigned int>());
673 
679  template <int dim, int spacedim, typename CellIterator>
681  compute_component_wise (std::vector<types::global_dof_index> &new_dof_indices,
682  const CellIterator &start,
683  const typename identity<CellIterator>::type &end,
684  const std::vector<unsigned int> &target_component,
685  const bool is_level_operation);
686 
703  template <int dim, int spacedim>
704  void
705  block_wise (DoFHandler<dim,spacedim> &dof_handler);
706 
713  template <int dim, int spacedim>
714  void
715  block_wise (DoFHandler<dim,spacedim> &dof_handler, const unsigned int level);
716 
733  template <int dim, int spacedim>
734  void
736 
742  template <int dim, int spacedim, class ITERATOR, class ENDITERATOR>
744  compute_block_wise (std::vector<types::global_dof_index> &new_dof_indices,
745  const ITERATOR &start,
746  const ENDITERATOR &end,
747  bool is_level_operation);
748 
830  template <int dim>
831  void
832  hierarchical (DoFHandler<dim> &dof_handler);
833 
855  template <typename DoFHandlerType>
856  void
857  cell_wise (DoFHandlerType &dof_handler,
858  const std::vector<typename DoFHandlerType::active_cell_iterator> &cell_order);
859 
891  template <typename DoFHandlerType>
892  void
894  (std::vector<types::global_dof_index> &renumbering,
895  std::vector<types::global_dof_index> &inverse_renumbering,
896  const DoFHandlerType &dof_handler,
897  const std::vector<typename DoFHandlerType::active_cell_iterator> &cell_order);
898 
903  template <typename DoFHandlerType>
904  void
905  cell_wise (DoFHandlerType &dof_handler,
906  const unsigned int level,
907  const std::vector<typename DoFHandlerType::level_cell_iterator> &cell_order);
908 
913  template <typename DoFHandlerType>
914  void
916  (std::vector<types::global_dof_index> &renumbering,
917  std::vector<types::global_dof_index> &inverse_renumbering,
918  const DoFHandlerType &dof_handler,
919  const unsigned int level,
920  const std::vector<typename DoFHandlerType::level_cell_iterator> &cell_order);
921 
956  template <typename DoFHandlerType>
957  void
958  downstream (DoFHandlerType &dof_handler,
960  const bool dof_wise_renumbering = false);
961 
962 
967  template <typename DoFHandlerType>
968  void
969  downstream (DoFHandlerType &dof_handler,
970  const unsigned int level,
972  const bool dof_wise_renumbering = false);
973 
979  template <typename DoFHandlerType>
980  void
981  compute_downstream (std::vector<types::global_dof_index> &new_dof_indices,
982  std::vector<types::global_dof_index> &reverse,
983  const DoFHandlerType &dof_handler,
985  const bool dof_wise_renumbering);
986 
992  template <typename DoFHandlerType>
993  void
994  compute_downstream (std::vector<types::global_dof_index> &new_dof_indices,
995  std::vector<types::global_dof_index> &reverse,
996  const DoFHandlerType &dof_handler,
997  const unsigned int level,
999  const bool dof_wise_renumbering);
1000 
1009  template <typename DoFHandlerType>
1010  void
1011  clockwise_dg (DoFHandlerType &dof_handler,
1013  const bool counter = false);
1014 
1019  template <typename DoFHandlerType>
1020  void
1021  clockwise_dg (DoFHandlerType &dof_handler,
1022  const unsigned int level,
1024  const bool counter = false);
1025 
1031  template <typename DoFHandlerType>
1032  void
1033  compute_clockwise_dg (std::vector<types::global_dof_index> &new_dof_indices,
1034  const DoFHandlerType &dof_handler,
1036  const bool counter);
1037 
1056  template <typename DoFHandlerType>
1057  void
1058  sort_selected_dofs_back (DoFHandlerType &dof_handler,
1059  const std::vector<bool> &selected_dofs);
1060 
1071  template <typename DoFHandlerType>
1072  void
1073  sort_selected_dofs_back (DoFHandlerType &dof_handler,
1074  const std::vector<bool> &selected_dofs,
1075  const unsigned int level);
1076 
1085  template <typename DoFHandlerType>
1086  void
1087  compute_sort_selected_dofs_back (std::vector<types::global_dof_index> &new_dof_indices,
1088  const DoFHandlerType &dof_handler,
1089  const std::vector<bool> &selected_dofs);
1090 
1100  template <typename DoFHandlerType>
1101  void
1102  compute_sort_selected_dofs_back (std::vector<types::global_dof_index> &new_dof_indices,
1103  const DoFHandlerType &dof_handler,
1104  const std::vector<bool> &selected_dofs,
1105  const unsigned int level);
1106 
1117  template <typename DoFHandlerType>
1118  void
1119  random (DoFHandlerType &dof_handler);
1120 
1128  template <typename DoFHandlerType>
1129  void
1130  compute_random (std::vector<types::global_dof_index> &new_dof_indices,
1131  const DoFHandlerType &dof_handler);
1132 
1164  template <typename DoFHandlerType>
1165  void
1166  subdomain_wise (DoFHandlerType &dof_handler);
1167 
1173  template <typename DoFHandlerType>
1174  void
1175  compute_subdomain_wise (std::vector<types::global_dof_index> &new_dof_indices,
1176  const DoFHandlerType &dof_handler);
1177 
1190  "The DoFHandler on which this function should work has not "
1191  "been initialized, i.e., it doesn't appear that DoF indices "
1192  "have been distributed on it.");
1193 
1200 
1208 }
1209 
1210 
1211 DEAL_II_NAMESPACE_CLOSE
1212 
1213 #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 hierarchical(DoFHandler< dim > &dof_handler)
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)
unsigned int global_dof_index
Definition: types.h:88
void compute_subdomain_wise(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandlerType &dof_handler)
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:335
static ::ExceptionBase & ExcNotDGFEM()
#define DeclException0(Exception0)
Definition: exceptions.h:323
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 >())
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 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