]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Rename a function; also make it run faster. 3220/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Sun, 9 Oct 2016 15:38:02 +0000 (09:38 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 10 Oct 2016 19:50:22 +0000 (13:50 -0600)
The new name is dimension independent. The speed is gained because we do not need
to search a list from the top every time, but it is enough to start searching where
we left off previously.

source/grid/grid_reordering.cc

index 1b6c80397cf7d7640839fee8b7f95dc60dba00cc..d7db823bc57310bb58ca5bd1e7af1dd971d48a5e 100644 (file)
@@ -463,10 +463,11 @@ namespace internal
      */
     template <int dim>
     unsigned int
-    get_next_unoriented_quad(const std::vector<Cell<dim> > &cells,
-                             const std::vector<Edge<dim> > &edges)
+    get_next_unoriented_cell(const std::vector<Cell<dim> > &cells,
+                             const std::vector<Edge<dim> > &edges,
+                             const unsigned int             current_cell)
     {
-      for (unsigned int c=0; c<cells.size(); ++c)
+      for (unsigned int c=current_cell; c<cells.size(); ++c)
         for (unsigned int l=0; l<GeometryInfo<dim>::lines_per_cell; ++l)
           if (edges[cells[c].edge_indices[l]].orientation_status == Edge<dim>::not_oriented)
             return c;
@@ -704,8 +705,10 @@ namespace internal
 
       // then loop over all cells and start orienting parallel edge sets
       // of cells that still have non-oriented edges
-      unsigned int next_cell_with_unoriented_edge;
-      while ((next_cell_with_unoriented_edge = get_next_unoriented_quad(cell_list, edge_list)) !=
+      unsigned int next_cell_with_unoriented_edge = 0;
+      while ((next_cell_with_unoriented_edge = get_next_unoriented_cell(cell_list,
+                                               edge_list,
+                                               next_cell_with_unoriented_edge)) !=
              numbers::invalid_unsigned_int)
         {
           // see which edge sets are still not oriented

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.