]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
The DoFTools::make_flux_sparsity_pattern function restores user_flags after using...
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Jun 2002 13:10:22 +0000 (13:10 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Jun 2002 13:10:22 +0000 (13:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@6126 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/dofs/dof_tools.cc

index c926fa205ba094ff995c81192c990b1f84d1da35..2c5542cb9e72d122a3a10c15eaeb5a7cda88fc8a 100644 (file)
@@ -311,8 +311,17 @@ DoFTools::make_flux_sparsity_pattern (const DoFHandler<dim> &dof,
   typename DoFHandler<dim>::active_cell_iterator cell = dof.begin_active(),
                                                 endc = dof.end();
 
-                                  // clear user flags for further use
-  const_cast<Triangulation<dim>&>(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<bool> user_flags;
+  dof.get_tria().save_user_flags(user_flags);
+  const_cast<Triangulation<dim> &>(dof.get_tria()).clear_user_flags ();
   
   for (; cell!=endc; ++cell)
     {
@@ -383,6 +392,9 @@ DoFTools::make_flux_sparsity_pattern (const DoFHandler<dim> &dof,
            } 
        }
     }
+
+                                  // finally restore the user flags
+  const_cast<Triangulation<dim> &>(dof.get_tria()).load_user_flags(user_flags);
 }
 
 
@@ -490,7 +502,17 @@ DoFTools::make_flux_sparsity_pattern (const DoFHandler<dim> &dof,
        support_on_face(i,f) = fe.has_support_on_face(i,f);
     }
   
-  (const_cast<Triangulation<dim>& > (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<bool> user_flags;
+  dof.get_tria().save_user_flags(user_flags);
+  const_cast<Triangulation<dim> &>(dof.get_tria()).clear_user_flags ();
   
   for (; cell!=endc; ++cell)
     {
@@ -651,6 +673,9 @@ DoFTools::make_flux_sparsity_pattern (const DoFHandler<dim> &dof,
            } 
        }
     }
+
+                                  // finally restore the user flags
+  const_cast<Triangulation<dim> &>(dof.get_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.