From a2a142fd6eeebe1f6ea9391e4f99cbba1b834bb7 Mon Sep 17 00:00:00 2001 From: kanschat Date: Wed, 22 Apr 2009 21:23:33 +0000 Subject: [PATCH] make downstream ordering public git-svn-id: https://svn.dealii.org/trunk@18693 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/include/dofs/dof_renumbering.h | 37 ++++++++++++++- .../deal.II/source/dofs/dof_renumbering.cc | 45 +++---------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/deal.II/deal.II/include/dofs/dof_renumbering.h b/deal.II/deal.II/include/dofs/dof_renumbering.h index 2ec7ab09d6..4ba0ebe045 100644 --- a/deal.II/deal.II/include/dofs/dof_renumbering.h +++ b/deal.II/deal.II/include/dofs/dof_renumbering.h @@ -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 + struct CompareDownstream + { + /** + * Constructor. + */ + CompareDownstream (const Point &dir) + : + dir(dir) + {} + /** + * Return true if c1 less c2. + */ + bool operator () (const Iterator &c1, const Iterator &c2) const + { + const Point diff = c2->center() - c1->center(); + return (diff*dir > 0); + } + + private: + /** + * Flow direction. + */ + const Point dir; + }; + /** * A namespace for the * implementation of some diff --git a/deal.II/deal.II/source/dofs/dof_renumbering.cc b/deal.II/deal.II/source/dofs/dof_renumbering.cc index 25db55869d..5435c21577 100644 --- a/deal.II/deal.II/source/dofs/dof_renumbering.cc +++ b/deal.II/deal.II/source/dofs/dof_renumbering.cc @@ -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 - struct CompareDownstream - { - /** - * Constructor. - */ - CompareDownstream (const Point &dir) - : - dir(dir) - {} - /** - * Return true if c1 < c2. - */ - template - bool operator () (const DHCellIterator &c1, - const DHCellIterator &c2) const - { - const Point diff = c2->center() - c1->center(); - return (diff*dir > 0); - } - - private: - /** - * Flow direction. - */ - const Point dir; - }; } namespace boost @@ -1173,7 +1138,7 @@ namespace DoFRenumbering { std::vector ordered_cells(dof.get_tria().n_active_cells()); - const internal::CompareDownstream comparator(direction); + const CompareDownstream 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 ordered_cells(dof.get_tria().n_active_cells()); - const internal::CompareDownstream comparator(direction); + const CompareDownstream 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 ordered_cells(dof.get_tria().n_active_cells()); - const internal::CompareDownstream comparator(direction); + const CompareDownstream 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::cell_iterator> ordered_cells(dof.get_tria().n_cells(level)); - const internal::CompareDownstream comparator(direction); + const CompareDownstream::cell_iterator, dim> comparator(direction); typename MGDoFHandler::cell_iterator begin = dof.begin(level); typename MGDoFHandler::cell_iterator end = dof.end(level); @@ -1295,7 +1260,7 @@ namespace DoFRenumbering { std::vector::cell_iterator> ordered_cells(dof.get_tria().n_cells(level)); - const internal::CompareDownstream comparator(direction); + const CompareDownstream::cell_iterator, dim> comparator(direction); typename MGDoFHandler::cell_iterator begin = dof.begin(level); typename MGDoFHandler::cell_iterator end = dof.end(level); -- 2.39.5