From d6cb26242a7c63dd25c3c38e8bdf55f4bfe7aa09 Mon Sep 17 00:00:00 2001 From: hartmann Date: Fri, 14 Jun 2002 13:04:20 +0000 Subject: [PATCH] DoFHandler::distribute function restores user_flags after using/changing them. git-svn-id: https://svn.dealii.org/trunk@6124 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/dofs/dof_handler.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/deal.II/deal.II/source/dofs/dof_handler.cc b/deal.II/deal.II/source/dofs/dof_handler.cc index b800e1ffd5..92579f38f2 100644 --- a/deal.II/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/deal.II/source/dofs/dof_handler.cc @@ -1315,9 +1315,17 @@ void DoFHandler::distribute_dofs (const FiniteElement &ff, reserve_space (); - // clear user flags because we will - // need them - 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 &>(*tria).clear_user_flags (); unsigned int next_free_dof = offset; active_cell_iterator cell = begin_active(), @@ -1325,8 +1333,11 @@ void DoFHandler::distribute_dofs (const FiniteElement &ff, for (; cell != endc; ++cell) next_free_dof = distribute_dofs_on_cell (cell, next_free_dof); - + used_dofs = next_free_dof; + + // finally restore the user flags + const_cast &>(*tria).load_user_flags(user_flags); }; -- 2.39.5