From: hartmann Date: Fri, 14 Jun 2002 13:10:22 +0000 (+0000) Subject: The DoFTools::make_flux_sparsity_pattern function restores user_flags after using... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ba14892fb7d3923eb8901e1c31ef5eb5cf46500;p=dealii-svn.git The DoFTools::make_flux_sparsity_pattern function restores user_flags after using/changing them. git-svn-id: https://svn.dealii.org/trunk@6126 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index c926fa205b..2c5542cb9e 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -311,8 +311,17 @@ DoFTools::make_flux_sparsity_pattern (const DoFHandler &dof, typename DoFHandler::active_cell_iterator cell = dof.begin_active(), endc = dof.end(); - // clear user flags for further use - const_cast&>(dof.get_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; + dof.get_tria().save_user_flags(user_flags); + const_cast &>(dof.get_tria()).clear_user_flags (); for (; cell!=endc; ++cell) { @@ -383,6 +392,9 @@ DoFTools::make_flux_sparsity_pattern (const DoFHandler &dof, } } } + + // finally restore the user flags + const_cast &>(dof.get_tria()).load_user_flags(user_flags); } @@ -490,7 +502,17 @@ DoFTools::make_flux_sparsity_pattern (const DoFHandler &dof, support_on_face(i,f) = fe.has_support_on_face(i,f); } - (const_cast& > (dof.get_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; + dof.get_tria().save_user_flags(user_flags); + const_cast &>(dof.get_tria()).clear_user_flags (); for (; cell!=endc; ++cell) { @@ -651,6 +673,9 @@ DoFTools::make_flux_sparsity_pattern (const DoFHandler &dof, } } } + + // finally restore the user flags + const_cast &>(dof.get_tria()).load_user_flags(user_flags); }