From bcdb636ac41f31abf8bba44a42b7480f3b8f35db Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Fri, 4 Jul 2003 17:20:05 +0000 Subject: [PATCH] another attempt to multilevel renumbering git-svn-id: https://svn.dealii.org/trunk@7848 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/source/dofs/dof_renumbering.cc | 37 +++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/deal.II/deal.II/source/dofs/dof_renumbering.cc b/deal.II/deal.II/source/dofs/dof_renumbering.cc index 2582519a17..c13771225a 100644 --- a/deal.II/deal.II/source/dofs/dof_renumbering.cc +++ b/deal.II/deal.II/source/dofs/dof_renumbering.cc @@ -51,10 +51,30 @@ extern "C" long int lrand48 (void); -// The following two class is defined to be used in the compute_* +// The following two classes are defined to be used in the compute_* // functions. Using them allows to use the same function to compute // level numbering for multigrid as well as numbering for the global // system matrix. +template +class WrapDoFIterator : private T +{ + public: + WrapDoFIterator (const T& t) : T(t) {} + void get_dof_indices (std::vector& v) const + { + (*this)->get_dof_indices(v); + } + template + bool operator != (const T2& i) const + { + return (! (T::operator==(i))); + } + // Allow access to these operators of T + T::operator->; + T::operator++; + T::operator==; +}; + template class WrapMGDoFIterator : private T { @@ -62,7 +82,7 @@ class WrapMGDoFIterator : private T WrapMGDoFIterator (const T& t) : T(t) {} void get_dof_indices (std::vector& v) const { - T::get_mg_dof_indices(v); + (*this)->get_mg_dof_indices(v); } bool operator != (const WrapMGDoFIterator& i) const { @@ -484,14 +504,17 @@ DoFRenumbering::component_wise ( std::vector renumbering (dof_handler.n_dofs(), DoFHandler::invalid_dof_index); + typedef + WrapDoFIterator::active_cell_iterator> ITERATOR; + typename DoFHandler::active_cell_iterator - start = dof_handler.begin_active(); + istart = dof_handler.begin_active(); + ITERATOR start = istart; const typename DoFHandler::cell_iterator end = dof_handler.end(); unsigned int result = - compute_component_wise::active_cell_iterator, + compute_component_wise::cell_iterator>(renumbering, start, end, component_order_arg); @@ -535,7 +558,7 @@ void DoFRenumbering::component_wise ( ExcRenumberingIncomplete()); if (renumbering.size()!=0) - dof_handler.renumber_dofs (renumbering); + dof_handler.renumber_dofs (level, renumbering); } @@ -640,7 +663,7 @@ DoFRenumbering::compute_component_wise ( // on each cell: get dof indices // and insert them into the global // list using their component - start->get_dof_indices (local_dof_indices); + start.get_dof_indices (local_dof_indices); for (unsigned int i=0; i