From 195a468777ae0b922023dac8d20f9fe2c1dd83fa Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Tue, 10 Nov 2020 12:54:45 +0100 Subject: [PATCH] Improve VectorDataExchange::Full::reset_ghost_values --- source/matrix_free/vector_data_exchange.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/source/matrix_free/vector_data_exchange.cc b/source/matrix_free/vector_data_exchange.cc index 17939f8416..e127111cd6 100644 --- a/source/matrix_free/vector_data_exchange.cc +++ b/source/matrix_free/vector_data_exchange.cc @@ -1344,10 +1344,18 @@ namespace internal void Full::reset_ghost_values_impl(const ArrayView &ghost_array) const { - // TODO - std::memset(ghost_array.data(), - 0.0, - ghost_array.size() * sizeof(Number)); + // reset ghost values coming from shared-memory neighbors + // TODO: only needed if values are buffered + for (const auto &i : sm_export_data_this.second) + std::memset(ghost_array.data() + (i.first - n_local_elements), + 0, + sizeof(Number) * i.second); + + // reset ghost values coming from remote neighbors + for (const auto &i : ghost_indices_subset_data.second) + std::memset(ghost_array.data() + i.first, + 0, + sizeof(Number) * i.second); } -- 2.39.5