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

deal.II/deal.II/source/multigrid/mg_dof_handler.cc

index 649d2939e2880e0e7026b8d13e46eb47df3be56e..7d591498c56e2cc2aeebf5a871296048d5449f4f 100644 (file)
@@ -1188,9 +1188,17 @@ void MGDoFHandler<dim>::distribute_dofs (const FiniteElement<dim> &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<bool> user_flags;
+  tria->save_user_flags(user_flags);
+  const_cast<Triangulation<dim> &>(*(this->tria)).clear_user_flags ();
 
                                   // now distribute indices on each level
                                   // separately
@@ -1205,6 +1213,9 @@ void MGDoFHandler<dim>::distribute_dofs (const FiniteElement<dim> &fe,
   
       mg_used_dofs[level] = next_free_dof;
     };
+  
+                                  // finally restore the user flags
+  const_cast<Triangulation<dim> &>(*(this->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.