]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify GridTools::get_face_connectivity_of_cells 10732/head
authorPeter Munch <peterrmuench@gmail.com>
Tue, 21 Jul 2020 06:58:23 +0000 (08:58 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Tue, 21 Jul 2020 06:58:23 +0000 (08:58 +0200)
source/grid/grid_tools.cc

index ad2d211ef091a64f8947f7c6dd68a5b2f94b2e37..62212f88816fe1f5ab1c0bf3486bf8c434aff0fa 100644 (file)
@@ -2475,18 +2475,7 @@ namespace GridTools
     cell_connectivity.reinit(triangulation.n_active_cells(),
                              triangulation.n_active_cells());
 
-    // create a map pair<lvl,idx> -> SparsityPattern index
-    // TODO: we are no longer using user_indices for this because we can get
-    // pointer/index clashes when saving/restoring them. The following approach
-    // works, but this map can get quite big. Not sure about more efficient
-    // solutions.
-    std::map<std::pair<unsigned int, unsigned int>, unsigned int> indexmap;
-    for (const auto &cell : triangulation.active_cell_iterators())
-      indexmap[std::pair<unsigned int, unsigned int>(cell->level(),
-                                                     cell->index())] =
-        cell->active_cell_index();
-
-    // next loop over all cells and their neighbors to build the sparsity
+    // loop over all cells and their neighbors to build the sparsity
     // pattern. note that it's a bit hard to enter all the connections when a
     // neighbor has children since we would need to find out which of its
     // children is adjacent to the current cell. this problem can be omitted
@@ -2502,10 +2491,7 @@ namespace GridTools
               (cell->neighbor(f)->has_children() == false))
             {
               const unsigned int other_index =
-                indexmap
-                  .find(std::pair<unsigned int, unsigned int>(
-                    cell->neighbor(f)->level(), cell->neighbor(f)->index()))
-                  ->second;
+                cell->neighbor(f)->active_cell_index();
               cell_connectivity.add(index, other_index);
               cell_connectivity.add(other_index, 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.