From 3c32605a968dd1ecda34c787a30712eb6cd27707 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Wed, 28 Nov 2018 17:55:20 +0100 Subject: [PATCH] Fix bug with ghost face detection in MatrixFree. --- .../deal.II/matrix_free/face_setup_internal.h | 38 +++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/include/deal.II/matrix_free/face_setup_internal.h b/include/deal.II/matrix_free/face_setup_internal.h index 833dea7e74..a1d90a7e96 100644 --- a/include/deal.II/matrix_free/face_setup_internal.h +++ b/include/deal.II/matrix_free/face_setup_internal.h @@ -687,8 +687,28 @@ namespace internal if (add_to_ghost) { - ghost_cells.insert(std::pair( - 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::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( + neighbor_child->level(), + neighbor_child->index())); + } + else + ghost_cells.insert( + std::pair( + 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 { -- 2.39.5