From: guido Date: Wed, 13 Aug 2003 16:41:48 +0000 (+0000) Subject: clockwise checked X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7b7bdd19a5eca17228bb699269f862dd507336b;p=dealii-svn.git clockwise checked git-svn-id: https://svn.dealii.org/trunk@7918 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/dofs/dof_renumbering.h b/deal.II/deal.II/include/dofs/dof_renumbering.h index ff86e725f4..13d570a2b2 100644 --- a/deal.II/deal.II/include/dofs/dof_renumbering.h +++ b/deal.II/deal.II/include/dofs/dof_renumbering.h @@ -470,8 +470,9 @@ class DoFRenumbering * Cell-wise clockwise numbering. * * This function produces a - * clockwise ordering of the - * mesh cells and calls + * (counter)clockwise ordering of + * the mesh cells with respect to + * the hub @p{center} and calls * @ref{cell_wise_dg}. * Therefore, it only works with * Discontinuous Galerkin Finite @@ -482,7 +483,8 @@ class DoFRenumbering template static void clockwise_dg (DoFHandler &dof_handler, - const Point ¢er); + const Point ¢er, + const bool counter = false); /** * Cell-wise clockwise numbering @@ -492,8 +494,9 @@ class DoFRenumbering template static void clockwise_dg (MGDoFHandler &dof_handler, - const unsigned int level, - const Point ¢er); + const unsigned int level, + const Point ¢er, + const bool counter = false); /** * Computes the renumbering @@ -508,8 +511,9 @@ class DoFRenumbering template static void compute_clockwise_dg (std::vector&, - const DoFHandler &dof_handler, - const Point ¢er); + const DoFHandler &dof_handler, + const Point ¢er, + const bool counter); /** * Sort those degrees of freedom diff --git a/deal.II/deal.II/source/dofs/dof_renumbering.cc b/deal.II/deal.II/source/dofs/dof_renumbering.cc index 719d679d1c..d9e1854d34 100644 --- a/deal.II/deal.II/source/dofs/dof_renumbering.cc +++ b/deal.II/deal.II/source/dofs/dof_renumbering.cc @@ -1004,14 +1004,20 @@ struct ClockCells * Center of rotation. */ const Point& center; + /** + * Revert sorting order. + */ + bool counter; + /** * Constructor. */ - ClockCells (const Point& center) : - center(center) + ClockCells (const Point& center, bool counter) : + center(center), + counter(counter) {} /** - * Return true if c1 < c2. + * Comparison operator */ bool operator () (const typename DoFHandler::cell_iterator& c1, const typename DoFHandler::cell_iterator&c2) const @@ -1021,7 +1027,7 @@ struct ClockCells const Point v2 = c2->center() - center; const double s1 = atan2(v1(0), v1(1)); const double s2 = atan2(v2(0), v2(1)); - return (s1>s2); + return ( counter ? (s1>s2) : (s2>s1)); } }; @@ -1029,10 +1035,11 @@ struct ClockCells template void DoFRenumbering::clockwise_dg (DoFHandler& dof, - const Point& center) + const Point& center, + const bool counter) { std::vector renumbering(dof.n_dofs()); - compute_clockwise_dg(renumbering, dof, center); + compute_clockwise_dg(renumbering, dof, center, counter); dof.renumber_dofs(renumbering); } @@ -1044,11 +1051,12 @@ void DoFRenumbering::compute_clockwise_dg ( std::vector& new_indices, const DoFHandler& dof, - const Point& center) + const Point& center, + const bool counter) { std::vector::cell_iterator> ordered_cells(dof.get_tria().n_active_cells()); - ClockCells comparator(center); + ClockCells comparator(center, counter); typename DoFHandler::active_cell_iterator begin = dof.begin_active(); typename DoFHandler::active_cell_iterator end = dof.end(); @@ -1062,12 +1070,13 @@ DoFRenumbering::compute_clockwise_dg ( template void DoFRenumbering::clockwise_dg (MGDoFHandler& dof, - const unsigned int level, - const Point& center) + const unsigned int level, + const Point& center, + const bool counter) { std::vector::cell_iterator> ordered_cells(dof.get_tria().n_cells(level)); - ClockCells comparator(center); + ClockCells comparator(center, counter); typename MGDoFHandler::cell_iterator begin = dof.begin(level); typename MGDoFHandler::cell_iterator end = dof.end(level); @@ -1183,20 +1192,20 @@ template void DoFRenumbering::clockwise_dg (DoFHandler&, - const Point&); + const Point&, bool); template void DoFRenumbering::compute_clockwise_dg (std::vector&, const DoFHandler&, - const Point&); + const Point&, bool); template void DoFRenumbering::clockwise_dg (MGDoFHandler&, const unsigned int, - const Point&); + const Point&, bool); template void DoFRenumbering::sort_selected_dofs_back