]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix bug with ghost face detection in MatrixFree.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Wed, 28 Nov 2018 16:55:20 +0000 (17:55 +0100)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Wed, 28 Nov 2018 16:55:20 +0000 (17:55 +0100)
include/deal.II/matrix_free/face_setup_internal.h

index 833dea7e748c275b2e15a0707bf3fc32ecc1055d..a1d90a7e96683f62c119ef1ece62e4fdadaa1c27 100644 (file)
@@ -687,8 +687,28 @@ namespace internal
 
                   if (add_to_ghost)
                     {
-                      ghost_cells.insert(std::pair<unsigned int, unsigned int>(
-                        neighbor->level(), neighbor->index()));
+                      if (use_active_cells && neighbor->has_children())
+                        for (unsigned int s = 0;
+                             s < dcell->face(f)->n_children();
+                             ++s)
+                          {
+                            typename dealii::Triangulation<dim>::cell_iterator
+                              neighbor_child =
+                                dcell->at_boundary(f) ?
+                                  dcell->periodic_neighbor_child_on_subface(f,
+                                                                            s) :
+                                  dcell->neighbor_child_on_subface(f, s);
+                            if (neighbor_child->subdomain_id() !=
+                                dcell->subdomain_id())
+                              ghost_cells.insert(
+                                std::pair<unsigned int, unsigned int>(
+                                  neighbor_child->level(),
+                                  neighbor_child->index()));
+                          }
+                      else
+                        ghost_cells.insert(
+                          std::pair<unsigned int, unsigned int>(
+                            neighbor->level(), neighbor->index()));
                       at_processor_boundary[i] = true;
                     }
                 }
@@ -842,11 +862,15 @@ namespace internal
                                           cell));
                                       }
                                     else
-                                      Assert(face_is_owned[dcell->face(f)
-                                                             ->index()] ==
-                                               FaceCategory::
-                                                 locally_active_done_elsewhere,
-                                             ExcInternalError());
+                                      Assert(
+                                        face_is_owned[dcell->face(f)
+                                                        ->index()] ==
+                                            FaceCategory::
+                                              locally_active_done_elsewhere ||
+                                          face_is_owned[dcell->face(f)
+                                                          ->index()] ==
+                                            FaceCategory::ghosted,
+                                        ExcInternalError());
                                   }
                                 else
                                   {

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.