From: hartmann Date: Fri, 14 Jun 2002 13:23:19 +0000 (+0000) Subject: MGDoFHandler::distribute function restores user_flags after using/changing them. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45061d4750aef93dde2df34e00e9568e2eb9bb10;p=dealii-svn.git MGDoFHandler::distribute function restores user_flags after using/changing them. git-svn-id: https://svn.dealii.org/trunk@6133 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/multigrid/mg_dof_handler.cc b/deal.II/deal.II/source/multigrid/mg_dof_handler.cc index 649d2939e2..7d591498c5 100644 --- a/deal.II/deal.II/source/multigrid/mg_dof_handler.cc +++ b/deal.II/deal.II/source/multigrid/mg_dof_handler.cc @@ -1188,9 +1188,17 @@ void MGDoFHandler::distribute_dofs (const FiniteElement &fe, reserve_space (); mg_used_dofs.resize (this->tria->n_levels(), 0); - // clear user flags because we will - // need them - this->tria->clear_user_flags (); + // Clear user flags because we will + // need them. But first we save + // them and make sure that we + // restore them later such that at + // the end of this function the + // Triangulation will be in the + // same state as it was at the + // beginning of this function. + std::vector user_flags; + tria->save_user_flags(user_flags); + const_cast &>(*(this->tria)).clear_user_flags (); // now distribute indices on each level // separately @@ -1205,6 +1213,9 @@ void MGDoFHandler::distribute_dofs (const FiniteElement &fe, mg_used_dofs[level] = next_free_dof; }; + + // finally restore the user flags + const_cast &>(*(this->tria)).load_user_flags(user_flags); };