From 8101d12bb27d4d1766fd37f677bd1cf8b5dc331a Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Fri, 5 May 2006 07:37:55 +0000 Subject: [PATCH] make iterator definitions more visible and document the template git-svn-id: https://svn.dealii.org/trunk@13054 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/dofs/dof_handler.h | 2 +- .../include/dofs/dof_iterator_selector.h | 192 +++++++++++------- deal.II/deal.II/include/dofs/hp_dof_handler.h | 2 +- 3 files changed, 123 insertions(+), 73 deletions(-) diff --git a/deal.II/deal.II/include/dofs/dof_handler.h b/deal.II/deal.II/include/dofs/dof_handler.h index 2d66793722..1fa25a8685 100644 --- a/deal.II/deal.II/include/dofs/dof_handler.h +++ b/deal.II/deal.II/include/dofs/dof_handler.h @@ -104,7 +104,7 @@ namespace internal template class DoFHandler : public Subscriptor { - typedef internal::DoFIteratorSelector > IteratorSelector; + typedef DoFIterators > IteratorSelector; public: typedef typename IteratorSelector::raw_line_iterator raw_line_iterator; typedef typename IteratorSelector::line_iterator line_iterator; diff --git a/deal.II/deal.II/include/dofs/dof_iterator_selector.h b/deal.II/deal.II/include/dofs/dof_iterator_selector.h index 7e02a53831..959349044a 100644 --- a/deal.II/deal.II/include/dofs/dof_iterator_selector.h +++ b/deal.II/deal.II/include/dofs/dof_iterator_selector.h @@ -10,8 +10,16 @@ // further information on this license. // //---------------------------- dof_iterator_selector.h --------------------------- -#ifndef __deal2__dof_iterator_selector_h -#define __deal2__dof_iterator_selector_h +#ifndef __deal2__dof_iterators_h +#define __deal2__dof_iterators_h + +//TODO: Rename this file to dof_iterators.h +//TODO: Can we avoid the specializations? + +// To consider for the second TODO: +// 1. Define accessors for unreasonable dimensions +// 2. Can cell_iterator and quad_iterator in 2D be different (or hex +// in 3D)? template class DoFAccessor; template class DoFCellAccessor; @@ -24,22 +32,65 @@ template class Triangulation; template class DoFHandler; -namespace internal -{ /** - * Define some types which differ between the dimensions. This class - * is analogous to the TriaDimensionInfo class hierarchy. - * - * @ref DoFIteratorSelector<1> - * @ref DoFIteratorSelector<2> - * @ref DoFIteratorSelector<3> + * A pseudo class defining the iterator types used by DoFHandler and + * hp::DoFHandler. The typedefs in this class are synonymous with + * those in the handler classes, such that this class can be used in + * order to avoid including the complete header files of the handler. + * + * The class template is not used, but only its specializations with + * respect to the dimension. These differ from the template in two + * points: first, the iterator to objects of the same dimension as the + * handler is aliased to the #cell_iterator. Second, #face_iterator is + * aliased to objects of codimension one. * - * @author Wolfgang Bangerth, 1998; Oliver Kayser-Herold and Wolfgang Bangerth, 2003 + * + * @warning This raw iterators are not normally used in application + * programs. + * + * @ingroup dofs + * @ingroup Accessors + * @author W. Bangerth, G. Kanschat, O. Kayser-Herold, 1998, 2003, 2006 */ - template - struct DoFIteratorSelector - { - }; +template +struct DoFIterators +{ + /// The dof handler class. + typedef DH DoFHandler_type; + /// The topological dimension of the dof handler. + static const unsigned int dim = DH::dimension; + + /// Iterator for raw lines. + typedef TriaRawIterator > raw_line_iterator; + /// Iterator for usual lines. + typedef TriaIterator > line_iterator; + /// Iterator for active lines. + typedef TriaActiveIterator > active_line_iterator; + /// Iterator for raw quadrilaterals + typedef TriaRawIterator > raw_quad_iterator; + /// Iterator for quadrilaterals + typedef TriaIterator > quad_iterator; + /// Iterator for active quadrilaterals + typedef TriaActiveIterator > active_quad_iterator; + /// Iterator for raw hexahedra + typedef TriaRawIterator > raw_hex_iterator; + /// Iterator for hexahedra + typedef TriaIterator > hex_iterator; + /// Iterator for active hexahedra + typedef TriaActiveIterator > active_hex_iterator; + /// Iterator for raw cells + typedef TriaRawIterator > raw_cell_iterator; + /// Iterator for cells + typedef TriaIterator > cell_iterator; + /// Iterator for active cells + typedef TriaActiveIterator > active_cell_iterator; + /// Iterator for raw faces + typedef TriaRawIterator > raw_face_iterator; + /// Iterator for faces + typedef TriaIterator > face_iterator; + /// Iterator for active faces + typedef TriaActiveIterator > active_face_iterator; +}; @@ -51,34 +102,34 @@ namespace internal * little more complicated since the @p DoFAccessor classes want a * template template argument. * - * @author Wolfgang Bangerth, 1998; Oliver Kayser-Herold and Wolfgang Bangerth, 2003 + * @author Wolfgang Bangerth, Oliver Kayser-Herold, 1998, 2003 */ - template