]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
DoFHandler::distribute function restores user_flags after using/changing them.
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Jun 2002 13:04:20 +0000 (13:04 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Jun 2002 13:04:20 +0000 (13:04 +0000)
git-svn-id: https://svn.dealii.org/trunk@6124 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/dofs/dof_handler.cc

index b800e1ffd5d0efcd0f4d8c01a79dfa5faa4fd12d..92579f38f2f237fcf2d77c5847859cf360bcf88a 100644 (file)
@@ -1315,9 +1315,17 @@ void DoFHandler<dim>::distribute_dofs (const FiniteElement<dim> &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<bool> user_flags;
+  tria->save_user_flags(user_flags);
+  const_cast<Triangulation<dim> &>(*tria).clear_user_flags ();
   
   unsigned int next_free_dof = offset;   
   active_cell_iterator cell = begin_active(),
@@ -1325,8 +1333,11 @@ void DoFHandler<dim>::distribute_dofs (const FiniteElement<dim> &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<Triangulation<dim> &>(*tria).load_user_flags(user_flags);
 };
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.