]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
make downstream ordering public
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 22 Apr 2009 21:23:33 +0000 (21:23 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 22 Apr 2009 21:23:33 +0000 (21:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@18693 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 2ec7ab09d67fad23823459ef7023ee421fac0709..4ba0ebe0453a73487276cf4b0b624163e16ee776 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -365,6 +365,41 @@ DEAL_II_NAMESPACE_OPEN
  */
 namespace DoFRenumbering 
 {
+                                  /**
+                                   * Direction based comparator for
+                                   * cell iterators: it returns @p
+                                   * true if the center of the second
+                                   * cell is downstream of the center
+                                   * of the first one with respect to
+                                   * the direction given to the
+                                   * constructor.
+                                   */
+  template <class Iterator, int dim>
+  struct CompareDownstream
+  {
+                                      /**
+                                       * Constructor.
+                                       */
+      CompareDownstream (const Point<dim> &dir)
+                     :
+                     dir(dir) 
+       {}
+                                      /**
+                                       * Return true if c1 less c2.
+                                       */
+      bool operator () (const Iterator &c1, const Iterator &c2) const
+       {
+         const Point<dim> diff = c2->center() - c1->center();
+         return (diff*dir > 0);
+       }
+      
+    private:
+                                      /**
+                                       * Flow direction.
+                                       */
+      const Point<dim> dir;
+  };
+  
                                   /**
                                    * A namespace for the
                                    * implementation of some
index 25db55869d2be99831a74165443a7d7aab4766be..5435c21577ffdc079bdc06ebd5f4c8a93e0c1d08 100644 (file)
@@ -111,41 +111,6 @@ namespace DoFRenumbering
        T::operator++;
        T::operator==;
     };
-
-
-
-/**
- * Provide comparator for DoFCellAccessors: it returns @p true if the center
- * of the second cell is downstream of the center of the first one with
- * respect to the direction given to the constructor.
- */
-    template <int dim>
-    struct CompareDownstream
-    {
-                                        /**
-                                         * Constructor.
-                                         */
-       CompareDownstream (const Point<dim> &dir)
-                       :
-                       dir(dir) 
-         {}
-                                        /**
-                                         * Return true if c1 < c2.
-                                         */
-       template <class DHCellIterator>
-       bool operator () (const DHCellIterator &c1,
-                         const DHCellIterator &c2) const
-         {
-           const Point<dim> diff = c2->center() - c1->center();
-           return (diff*dir > 0);
-         }
-
-      private:
-                                        /**
-                                         * Flow direction.
-                                         */
-       const Point<dim> dir;
-    };
   }
   
   namespace boost
@@ -1173,7 +1138,7 @@ namespace DoFRenumbering
   {
     std::vector<typename DH::cell_iterator>
       ordered_cells(dof.get_tria().n_active_cells());
-    const internal::CompareDownstream<dim> comparator(direction);
+    const CompareDownstream<typename DH::cell_iterator, dim> comparator(direction);
   
     typename DH::active_cell_iterator begin = dof.begin_active();
     typename DH::active_cell_iterator end = dof.end();
@@ -1197,7 +1162,7 @@ namespace DoFRenumbering
   {
     std::vector<typename DH::cell_iterator>
       ordered_cells(dof.get_tria().n_active_cells());
-    const internal::CompareDownstream<dim> comparator(direction);
+    const CompareDownstream<typename DH::cell_iterator, dim> comparator(direction);
   
     typename DH::active_cell_iterator begin = dof.begin_active();
     typename DH::active_cell_iterator end = dof.end();
@@ -1219,7 +1184,7 @@ namespace DoFRenumbering
   {
     std::vector<typename DH::cell_iterator>
       ordered_cells(dof.get_tria().n_active_cells());
-    const internal::CompareDownstream<dim> comparator(direction);
+    const CompareDownstream<typename DH::cell_iterator, dim> comparator(direction);
   
     typename DH::active_cell_iterator begin = dof.begin_active();
     typename DH::active_cell_iterator end = dof.end();
@@ -1271,7 +1236,7 @@ namespace DoFRenumbering
   {
     std::vector<typename MGDoFHandler<dim>::cell_iterator>
       ordered_cells(dof.get_tria().n_cells(level));
-    const internal::CompareDownstream<dim> comparator(direction);
+    const CompareDownstream<typename MGDoFHandler<dim>::cell_iterator, dim> comparator(direction);
   
     typename MGDoFHandler<dim>::cell_iterator begin = dof.begin(level);
     typename MGDoFHandler<dim>::cell_iterator end = dof.end(level);
@@ -1295,7 +1260,7 @@ namespace DoFRenumbering
   {
     std::vector<typename MGDoFHandler<dim>::cell_iterator>
       ordered_cells(dof.get_tria().n_cells(level));
-    const internal::CompareDownstream<dim> comparator(direction);
+    const CompareDownstream<typename MGDoFHandler<dim>::cell_iterator, dim> comparator(direction);
   
     typename MGDoFHandler<dim>::cell_iterator begin = dof.begin(level);
     typename MGDoFHandler<dim>::cell_iterator end = dof.end(level);

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.