]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Replace a double loop over cells and indices by a single loop and the use of cell...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 15 Apr 2015 12:46:24 +0000 (07:46 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 15 Apr 2015 12:47:39 +0000 (07:47 -0500)
source/numerics/error_estimator_1d.cc

index 6e95f5dad454b3030e88c4019960f5b5830661df..74e8aae9a0622bb0e6f02f2648421b83f734aa7c 100644 (file)
@@ -330,9 +330,9 @@ estimate (const Mapping<1,spacedim>                    &mapping,
   // loop over all cells and do something on the cells which we're told to
   // work on. note that the error indicator is only a sum over the two
   // contributions from the two vertices of each cell.
-  typename DH::active_cell_iterator cell = dof_handler.begin_active();
-  for (unsigned int cell_index=0; cell != dof_handler.end();
-       ++cell, ++cell_index)
+  for (typename DH::active_cell_iterator cell = dof_handler.begin_active();
+       cell != dof_handler.end();
+       ++cell)
     if (((subdomain_id == numbers::invalid_subdomain_id)
          ||
          (cell->subdomain_id() == subdomain_id))
@@ -342,7 +342,7 @@ estimate (const Mapping<1,spacedim>                    &mapping,
          (cell->material_id() == material_id)))
       {
         for (unsigned int n=0; n<n_solution_vectors; ++n)
-          (*errors[n])(cell_index) = 0;
+          (*errors[n])(cell->active_cell_index()) = 0;
 
         // loop over the two points bounding this line. n==0 is left point,
         // n==1 is right point
@@ -429,12 +429,12 @@ estimate (const Mapping<1,spacedim>                    &mapping,
 
                     const double jump = ((grad_here - grad_neighbor[s](component)) *
                                          coefficient_values(component));
-                    (*errors[s])(cell_index) += jump*jump * cell->diameter();
+                    (*errors[s])(cell->active_cell_index()) += jump*jump * cell->diameter();
                   }
           }
 
         for (unsigned int s=0; s<n_solution_vectors; ++s)
-          (*errors[s])(cell_index) = std::sqrt((*errors[s])(cell_index));
+          (*errors[s])(cell->active_cell_index()) = std::sqrt((*errors[s])(cell->active_cell_index()));
       }
 }
 

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.