]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Redo the hp make_flux_sparsity_pattern logic.
authorDavid Wells <wellsd2@rpi.edu>
Wed, 3 Aug 2016 02:39:17 +0000 (22:39 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Wed, 3 Aug 2016 13:34:00 +0000 (09:34 -0400)
This now the same as the non-hp version, which was changed in
9b037871bb. In brief: this function uses the total ordering of cells
instead of user flags to figure out when a face may be skipped.

source/dofs/dof_tools_sparsity.cc

index 2eb8c011d688dd64af2625a7c148f4a9d2623899..1ac28b71b617710ae4d0c22f667f59d686ec595a 100644 (file)
@@ -1024,8 +1024,6 @@ namespace DoFTools
                 {
                   const typename dealii::hp::DoFHandler<dim,spacedim>::face_iterator
                   cell_face = cell->face(face);
-                  if (cell_face->user_flag_set ())
-                    continue;
 
                   const bool periodic_neighbor = cell->has_periodic_neighbor (face);
 
@@ -1048,15 +1046,37 @@ namespace DoFTools
                       typename dealii::hp::DoFHandler<dim,spacedim>::level_cell_iterator
                       neighbor = cell->neighbor_or_periodic_neighbor(face);
 
-                      // Refinement edges are taken care of by coarser cells
-                      if ((!periodic_neighbor && cell->neighbor_is_coarser(face)) ||
-                          (periodic_neighbor && cell->periodic_neighbor_is_coarser(face)))
+                      // Like the non-hp case: If the cells are on the same
+                      // level (and both are active, locally-owned cells) then
+                      // only add to the sparsity pattern if the current cell
+                      // is 'greater' in the total ordering.
+                      if (neighbor->level () == cell->level ()
+                          &&
+                          neighbor->index () > cell->index ()
+                          &&
+                          neighbor->active ()
+                          &&
+                          neighbor->is_locally_owned ())
                         continue;
-
-                      const unsigned int
-                      neighbor_face = periodic_neighbor?
-                                      cell->periodic_neighbor_of_periodic_neighbor(face):
-                                      cell->neighbor_of_neighbor(face);
+                      // Again, like the non-hp case: If we are more refined
+                      // then the neighbor, then we will automatically find
+                      // the active neighbor cell when we call 'neighbor
+                      // (face)' above. The opposite is not true; if the
+                      // neighbor is more refined then the call 'neighbor
+                      // (face)' will *not* return an active cell. Hence,
+                      // only add things to the sparsity pattern if (when the
+                      // levels are different) the neighbor is coarser than
+                      // the current cell.
+                      //
+                      // Like above, do not use this optimization if the
+                      // neighbor is not locally owned.
+                      if (neighbor->level () != cell->level ()
+                          &&
+                          ((!periodic_neighbor && !cell->neighbor_is_coarser (face))
+                           ||(periodic_neighbor && !cell->periodic_neighbor_is_coarser (face)))
+                          &&
+                          neighbor->is_locally_owned ())
+                        continue; // (the neighbor is finer)
 
                       if (cell_face->has_children())
                         {
@@ -1114,7 +1134,6 @@ namespace DoFTools
                                         }
                                     }
                                 }
-                              sub_neighbor->face(neighbor_face)->set_user_flag ();
                             }
                         }
                       else
@@ -1162,7 +1181,6 @@ namespace DoFTools
                                     }
                                 }
                             }
-                          neighbor->face(neighbor_face)->set_user_flag ();
                         }
                     }
                 }

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.