]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
clockwise checked
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Aug 2003 16:41:48 +0000 (16:41 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Aug 2003 16:41:48 +0000 (16:41 +0000)
git-svn-id: https://svn.dealii.org/trunk@7918 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/dof_renumbering.h
deal.II/deal.II/source/dofs/dof_renumbering.cc

index ff86e725f43a61a6f90d32c308249622941a5d2a..13d570a2b283629b56251a48400987104a153dde 100644 (file)
@@ -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 <int dim>
     static void
     clockwise_dg (DoFHandler<dim>  &dof_handler,
-                  const Point<dim> &center);
+                 const Point<dim> &center,
+                 const bool counter = false);
 
                                     /**
                                      * Cell-wise clockwise numbering
@@ -492,8 +494,9 @@ class DoFRenumbering
     template <int dim>
     static void
     clockwise_dg (MGDoFHandler<dim>  &dof_handler,
-                  const unsigned int level,
-                  const Point<dim> &center);
+                 const unsigned int level,
+                 const Point<dim> &center,
+                 const bool counter = false);
 
                                     /**
                                      * Computes the renumbering
@@ -508,8 +511,9 @@ class DoFRenumbering
     template <int dim>
     static void
     compute_clockwise_dg (std::vector<unsigned int>&,
-                          const DoFHandler<dim>  &dof_handler,
-                          const Point<dim> &center);
+                         const DoFHandler<dim>  &dof_handler,
+                         const Point<dim> &center,
+                         const bool counter);
 
                                     /**
                                      * Sort those degrees of freedom
index 719d679d1c91e5c9e65b486f3bdbc255b85b9390..d9e1854d346852f619038ab63f2d668bd69c7e8e 100644 (file)
@@ -1004,14 +1004,20 @@ struct ClockCells
                                      * Center of rotation.
                                      */
     const Point<dim>& center;
+                                    /**
+                                     * Revert sorting order.
+                                     */
+    bool counter;
+    
                                     /**
                                      * Constructor.
                                      */
-    ClockCells (const Point<dim>& center) :
-                   center(center) 
+    ClockCells (const Point<dim>& center, bool counter) :
+                   center(center),
+                   counter(counter)
       {}
                                     /**
-                                     * Return true if c1 < c2.
+                                     * Comparison operator
                                      */    
     bool operator () (const typename DoFHandler<dim>::cell_iterator& c1,
                      const typename DoFHandler<dim>::cell_iterator&c2) const
@@ -1021,7 +1027,7 @@ struct ClockCells
        const Point<dim> 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 <int dim>
 void
 DoFRenumbering::clockwise_dg (DoFHandler<dim>& dof,
-                              const Point<dim>& center)
+                             const Point<dim>& center,
+                             const bool counter)
 {
   std::vector<unsigned int> 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<unsigned int>& new_indices,
   const DoFHandler<dim>& dof,
-  const Point<dim>& center)
+  const Point<dim>& center,
+  const bool counter)
 {
   std::vector<typename DoFHandler<dim>::cell_iterator>
     ordered_cells(dof.get_tria().n_active_cells());
-  ClockCells<dim> comparator(center);
+  ClockCells<dim> comparator(center, counter);
   
   typename DoFHandler<dim>::active_cell_iterator begin = dof.begin_active();
   typename DoFHandler<dim>::active_cell_iterator end = dof.end();
@@ -1062,12 +1070,13 @@ DoFRenumbering::compute_clockwise_dg (
 
 template <int dim>
 void DoFRenumbering::clockwise_dg (MGDoFHandler<dim>& dof,
-                                   const unsigned int level,
-                                   const Point<dim>& center)
+                                  const unsigned int level,
+                                  const Point<dim>& center,
+                                  const bool counter)
 {
   std::vector<typename MGDoFHandler<dim>::cell_iterator>
     ordered_cells(dof.get_tria().n_cells(level));
-  ClockCells<dim> comparator(center);
+  ClockCells<dim> comparator(center, counter);
   
   typename MGDoFHandler<dim>::cell_iterator begin = dof.begin(level);
   typename MGDoFHandler<dim>::cell_iterator end = dof.end(level);
@@ -1183,20 +1192,20 @@ template
 void
 DoFRenumbering::clockwise_dg<deal_II_dimension>
 (DoFHandler<deal_II_dimension>&,
- const Point<deal_II_dimension>&);
+ const Point<deal_II_dimension>&, bool);
 
 template
 void
 DoFRenumbering::compute_clockwise_dg<deal_II_dimension>
 (std::vector<unsigned int>&,
  const DoFHandler<deal_II_dimension>&,
- const Point<deal_II_dimension>&);
+ const Point<deal_II_dimension>&, bool);
 
 template
 void DoFRenumbering::clockwise_dg<deal_II_dimension>
 (MGDoFHandler<deal_II_dimension>&,
  const unsigned int,
- const Point<deal_II_dimension>&);
+ const Point<deal_II_dimension>&, bool);
 
 template
 void DoFRenumbering::sort_selected_dofs_back<deal_II_dimension>

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.