00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __deal2__dof_renumbering_h
00013 #define __deal2__dof_renumbering_h
00014
00015
00016 #include <deal.II/base/config.h>
00017 #include <deal.II/base/exceptions.h>
00018 #include <deal.II/base/point.h>
00019 #include <deal.II/dofs/dof_handler.h>
00020 #include <deal.II/hp/dof_handler.h>
00021 #include <deal.II/multigrid/mg_dof_handler.h>
00022
00023 #include <vector>
00024
00025 DEAL_II_NAMESPACE_OPEN
00026
00366 namespace DoFRenumbering
00367 {
00377 template <class Iterator, int dim>
00378 struct CompareDownstream
00379 {
00383 CompareDownstream (const Point<dim> &dir)
00384 :
00385 dir(dir)
00386 {}
00390 bool operator () (const Iterator &c1, const Iterator &c2) const
00391 {
00392 const Point<dim> diff = c2->center() - c1->center();
00393 return (diff*dir > 0);
00394 }
00395
00396 private:
00400 const Point<dim> dir;
00401 };
00402
00403
00414 template <int dim>
00415 struct ComparePointwiseDownstream
00416 {
00420 ComparePointwiseDownstream (const Point<dim> &dir)
00421 :
00422 dir(dir)
00423 {}
00427 bool operator () (const std::pair<Point<dim>,unsigned int> &c1,
00428 const std::pair<Point<dim>,unsigned int> &c2) const
00429 {
00430 const Point<dim> diff = c2.first-c1.first;
00431 return (diff*dir > 0 || (diff*dir==0 && c1.second<c2.second));
00432 }
00433
00434 private:
00438 const Point<dim> dir;
00439 };
00440
00464 namespace boost
00465 {
00486 template <class DH>
00487 void
00488 Cuthill_McKee (DH& dof_handler,
00489 const bool reversed_numbering = false,
00490 const bool use_constraints = false);
00491
00501 template <class DH>
00502 void
00503 compute_Cuthill_McKee (std::vector<unsigned int>& new_dof_indices,
00504 const DH&,
00505 const bool reversed_numbering = false,
00506 const bool use_constraints = false);
00507
00533 template <class DH>
00534 void
00535 king_ordering (DH& dof_handler,
00536 const bool reversed_numbering = false,
00537 const bool use_constraints = false);
00538
00546 template <class DH>
00547 void
00548 compute_king_ordering (std::vector<unsigned int>& new_dof_indices,
00549 const DH&,
00550 const bool reversed_numbering = false,
00551 const bool use_constraints = false);
00552
00578 template <class DH>
00579 void
00580 minimum_degree (DH& dof_handler,
00581 const bool reversed_numbering = false,
00582 const bool use_constraints = false);
00583
00592 template <class DH>
00593 void
00594 compute_minimum_degree (std::vector<unsigned int>& new_dof_indices,
00595 const DH&,
00596 const bool reversed_numbering = false,
00597 const bool use_constraints = false);
00598 }
00599
00618 template <class DH>
00619 void
00620 Cuthill_McKee (DH& dof_handler,
00621 const bool reversed_numbering = false,
00622 const bool use_constraints = false,
00623 const std::vector<unsigned int> &starting_indices = std::vector<unsigned int>());
00624
00634 template <class DH>
00635 void
00636 compute_Cuthill_McKee (std::vector<unsigned int>& new_dof_indices,
00637 const DH&,
00638 const bool reversed_numbering = false,
00639 const bool use_constraints = false,
00640 const std::vector<unsigned int> &starting_indices = std::vector<unsigned int>());
00641
00665 template <int dim>
00666 void
00667 Cuthill_McKee (MGDoFHandler<dim> &dof_handler,
00668 const unsigned int level,
00669 const bool reversed_numbering = false,
00670 const std::vector<unsigned int> &starting_indices = std::vector<unsigned int> ());
00671
00728 template <int dim, int spacedim>
00729 void
00730 component_wise (DoFHandler<dim,spacedim> &dof_handler,
00731 const std::vector<unsigned int> &target_component
00732 = std::vector<unsigned int>());
00733
00734
00740 template <int dim>
00741 void
00742 component_wise (hp::DoFHandler<dim> &dof_handler,
00743 const std::vector<unsigned int> &target_component = std::vector<unsigned int> ());
00744
00755 template <int dim>
00756 void
00757 component_wise (MGDoFHandler<dim>& dof_handler,
00758 unsigned int level,
00759 const std::vector<unsigned int>& target_component = std::vector<unsigned int>());
00760
00761
00772 template <int dim>
00773 void
00774 component_wise (MGDoFHandler<dim>& dof_handler,
00775 const std::vector<unsigned int>& target_component = std::vector<unsigned int>());
00776
00786 template <int dim, int spacedim, class ITERATOR, class ENDITERATOR>
00787 unsigned int
00788 compute_component_wise (std::vector<unsigned int>& new_dof_indices,
00789 const ITERATOR& start,
00790 const ENDITERATOR& end,
00791 const std::vector<unsigned int> &target_component);
00792
00800 template <int dim>
00801 void
00802 hierarchical (DoFHandler<dim> &dof_handler);
00803
00823 template <class DH>
00824 void
00825 cell_wise (DH &dof_handler,
00826 const std::vector<typename DH::cell_iterator> &cell_order);
00827
00833 template <class DH>
00834 void
00835 cell_wise_dg (DH &dof_handler,
00836 const std::vector<typename DH::cell_iterator> &cell_order);
00837
00847 template <class DH>
00848 void
00849 compute_cell_wise_dg (std::vector<unsigned int>& renumbering,
00850 std::vector<unsigned int>& inverse_renumbering,
00851 const DH &dof_handler,
00852 const std::vector<typename DH::cell_iterator> &cell_order);
00853
00863 template <class DH>
00864 void
00865 compute_cell_wise (std::vector<unsigned int>& renumbering,
00866 std::vector<unsigned int>& inverse_renumbering,
00867 const DH &dof_handler,
00868 const std::vector<typename DH::cell_iterator> &cell_order);
00869
00875 template <int dim>
00876 void
00877 cell_wise (MGDoFHandler<dim> &dof_handler,
00878 const unsigned int level,
00879 const std::vector<typename MGDoFHandler<dim>::cell_iterator> &cell_order);
00880
00889 template <int dim>
00890 void
00891 cell_wise_dg (MGDoFHandler<dim> &dof_handler,
00892 const unsigned int level,
00893 const std::vector<typename MGDoFHandler<dim>::cell_iterator> &cell_order);
00894
00904 template <int dim>
00905 void
00906 compute_cell_wise_dg (std::vector<unsigned int>& renumbering,
00907 std::vector<unsigned int>& inverse_renumbering,
00908 const MGDoFHandler<dim>& dof_handler,
00909 const unsigned int level,
00910 const std::vector<typename MGDoFHandler<dim>::cell_iterator>& cell_order);
00911
00912
00922 template <int dim>
00923 void
00924 compute_cell_wise (std::vector<unsigned int>& renumbering,
00925 std::vector<unsigned int>& inverse_renumbering,
00926 const MGDoFHandler<dim>& dof_handler,
00927 const unsigned int level,
00928 const std::vector<typename MGDoFHandler<dim>::cell_iterator>& cell_order);
00929
00930
00974 template <class DH, int dim>
00975 void
00976 downstream (DH& dof_handler,
00977 const Point<dim>& direction,
00978 const bool dof_wise_renumbering = false);
00979
00983 template <class DH, int dim>
00984 void
00985 downstream_dg (DH& dof_handler,
00986 const Point<dim>& direction);
00987
00995 template <int dim>
00996 void
00997 downstream (MGDoFHandler<dim> &dof_handler,
00998 const unsigned int level,
00999 const Point<dim> &direction,
01000 const bool dof_wise_renumbering = false);
01001
01006 template <int dim>
01007 void
01008 downstream_dg (MGDoFHandler<dim> &dof_handler,
01009 const unsigned int level,
01010 const Point<dim> &direction);
01011
01028 template <class DH, int dim>
01029 void
01030 compute_downstream_dg (std::vector<unsigned int>& new_dof_indices,
01031 const DH& dof_handler,
01032 const Point<dim>& direction);
01033
01043 template <class DH, int dim>
01044 void
01045 compute_downstream (std::vector<unsigned int>& new_dof_indices,
01046 std::vector<unsigned int>& reverse,
01047 const DH& dof_handler,
01048 const Point<dim>& direction,
01049 const bool dof_wise_renumbering);
01050
01055 template <class DH, int dim>
01056 void
01057 compute_downstream_dg (std::vector<unsigned int>& new_dof_indices,
01058 std::vector<unsigned int>& reverse,
01059 const DH& dof_handler,
01060 const Point<dim>& direction);
01061
01071 template <int dim>
01072 void
01073 compute_downstream (std::vector<unsigned int>& new_dof_indices,
01074 std::vector<unsigned int>& reverse,
01075 const MGDoFHandler<dim>& dof_handler,
01076 const unsigned int level,
01077 const Point<dim>& direction,
01078 const bool dof_wise_renumbering);
01079
01084 template <int dim>
01085 void
01086 compute_downstream_dg (std::vector<unsigned int>& new_dof_indices,
01087 std::vector<unsigned int>& reverse,
01088 const MGDoFHandler<dim>& dof_handler,
01089 const unsigned int level,
01090 const Point<dim>& direction);
01091
01106 template <class DH, int dim>
01107 void
01108 clockwise_dg (DH& dof_handler,
01109 const Point<dim>& center,
01110 const bool counter = false);
01111
01117 template <int dim>
01118 void
01119 clockwise_dg (MGDoFHandler<dim> &dof_handler,
01120 const unsigned int level,
01121 const Point<dim> ¢er,
01122 const bool counter = false);
01123
01133 template <class DH, int dim>
01134 void
01135 compute_clockwise_dg (std::vector<unsigned int>& new_dof_indices,
01136 const DH& dof_handler,
01137 const Point<dim>& center,
01138 const bool counter);
01139
01153 template <class DH>
01154 void
01155 sort_selected_dofs_back (DH& dof_handler,
01156 const std::vector<bool>& selected_dofs);
01157
01167 template <class DH>
01168 void
01169 compute_sort_selected_dofs_back (std::vector<unsigned int>& new_dof_indices,
01170 const DH& dof_handler,
01171 const std::vector<bool>& selected_dofs);
01172
01177 template <class DH>
01178 void
01179 random (DH& dof_handler);
01180
01189 template <class DH>
01190 void
01191 compute_random (std::vector<unsigned int> &new_dof_indices,
01192 const DH& dof_handler);
01193
01229 template <class DH>
01230 void
01231 subdomain_wise (DH &dof_handler);
01232
01242 template <class DH>
01243 void
01244 compute_subdomain_wise (std::vector<unsigned int> &new_dof_indices,
01245 const DH &dof_handler);
01246
01252 DeclException0 (ExcRenumberingIncomplete);
01258 DeclException0 (ExcInvalidComponentOrder);
01266 DeclException0 (ExcNotDGFEM);
01267 }
01268
01269 DEAL_II_NAMESPACE_CLOSE
01270
01271 #endif
01272