From: Spencer Patty Date: Fri, 5 Feb 2016 04:39:30 +0000 (-0600) Subject: add the user_flag saving and restoring so that dof_handler is truly unchanged (const) X-Git-Tag: v8.4.0-rc2~19^2~5 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3dd867abddd69d8db0626938928ab6adbded6f9;p=dealii.git add the user_flag saving and restoring so that dof_handler is truly unchanged (const) --- diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 6511c18b2e..508867e6bb 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -3075,8 +3075,15 @@ next_cell: std::map lines_to_parent_lines_map; if (MeshType::dimension == 3) { + + // save user flags as they will be modified and then later restored + std::vector user_flags; + dof_handler.get_triangulation().save_user_flags(user_flags); + const_cast &>(dof_handler.get_triangulation()).clear_user_flags (); + + typename MeshType::active_cell_iterator cell = dof_handler.begin_active(), - endc = dof_handler.end(); + endc = dof_handler.end(); for (; cell!=endc; ++cell) { // We only want lines that are locally_relevant @@ -3267,12 +3274,7 @@ next_cell: dof_to_set_of_cells_map[local_line_dof_indices[i]].insert(cell); } - // clear up user flags set from earlier - // denoting that a 3d line has an active - // parent and so an entry exists in the - // lines_to_parent_lines_map map for that - // line pointing to it's parent. - cell->line(l)->clear_user_flag(); + } } // for lines l }// if MeshType::dimension == 3 @@ -3280,6 +3282,14 @@ next_cell: }// for cells + if (MeshType::dimension == 3) + { + // finally, restore user flags that were changed above + // to when we constructed the pointers to parent of lines + // Since dof_handler is const, we must leave it unchanged. + const_cast &>(dof_handler.get_triangulation()).load_user_flags (user_flags); + } + // Finally, we copy map of sets to // map of vectors using assign() std::map< types::global_dof_index, std::vector > dof_to_cell_patches;