From 19d40a23bd667dfb0981af84a0a84727d0d95c88 Mon Sep 17 00:00:00 2001 From: bangerth Date: Fri, 19 Jul 2013 16:18:48 +0000 Subject: [PATCH] Remove last_active(level) and last(level), as suggested by bug report 2. git-svn-id: https://svn.dealii.org/trunk@30061 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/grid/tria.h | 12 ---------- deal.II/source/grid/tria.cc | 37 ++++------------------------- 2 files changed, 4 insertions(+), 45 deletions(-) diff --git a/deal.II/include/deal.II/grid/tria.h b/deal.II/include/deal.II/grid/tria.h index c15be6032f..72b71db88f 100644 --- a/deal.II/include/deal.II/grid/tria.h +++ b/deal.II/include/deal.II/grid/tria.h @@ -2655,23 +2655,11 @@ public: */ cell_iterator last () const; - /** - * Return an iterator pointing to the - * last used cell on level @p level. - */ - cell_iterator last (const unsigned int level) const; - /** * Return an iterator pointing to the * last active cell. */ active_cell_iterator last_active () const; - - /** - * Return an iterator pointing to the - * last active cell on level @p level. - */ - active_cell_iterator last_active (const unsigned int level) const; /*@}*/ /*---------------------------------------*/ diff --git a/deal.II/source/grid/tria.cc b/deal.II/source/grid/tria.cc index 4a9ba696f2..620f40017e 100644 --- a/deal.II/source/grid/tria.cc +++ b/deal.II/source/grid/tria.cc @@ -10999,15 +10999,8 @@ template typename Triangulation::cell_iterator Triangulation::last () const { - return last (levels.size()-1); -} - - + const unsigned int level = levels.size()-1; -template -typename Triangulation::cell_iterator -Triangulation::last (const unsigned int level) const -{ Assert (levelcells.cells.size() ==0) return end(level); @@ -11050,27 +11043,6 @@ Triangulation::last_active () const -template -typename Triangulation::active_cell_iterator -Triangulation::last_active (const unsigned int level) const -{ - // get the last used cell on this level - cell_iterator cell = last(level); - - if (cell != end(level)) - { - // then move to the last active one - if (cell->active()==true) - return cell; - while ((--cell).state() == IteratorState::valid) - if (cell->active()==true) - return cell; - } - return cell; -} - - - template typename Triangulation::cell_iterator Triangulation::end () const @@ -12234,10 +12206,9 @@ void Triangulation::execute_coarsening () // deleted (if the latter are on a // higher level for example) // - // if there is only one level, - // there can not be anything to do - if (levels.size() >= 2) - for (cell = last(levels.size()-2); cell!=endc; --cell) + // cells on level 0 are never coarsened, so we can skip it + for (unsigned int level = n_levels()-1; level>=1; --level) + for (cell = begin(level); cell!=end(level); --cell) if (cell->user_flag_set()) // use a separate function, // since this is dimension -- 2.39.5