From: Denis Davydov Date: Wed, 6 Mar 2019 12:43:08 +0000 (+0100) Subject: add LA::d::Vector::set_ghost_state() and use it in VectorDataExchange::update_ghost_v... X-Git-Tag: v9.1.0-rc1~302^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74685cc3082336d0aff9560c43ba01dd6337a7ab;p=dealii.git add LA::d::Vector::set_ghost_state() and use it in VectorDataExchange::update_ghost_values_finish() to allow reading from ghosts in LA::d::Vector::local_element() const --- diff --git a/include/deal.II/lac/la_parallel_vector.h b/include/deal.II/lac/la_parallel_vector.h index 840a5ca031..8b7cbb9119 100644 --- a/include/deal.II/lac/la_parallel_vector.h +++ b/include/deal.II/lac/la_parallel_vector.h @@ -1192,6 +1192,13 @@ namespace LinearAlgebra bool partitioners_are_globally_compatible( const Utilities::MPI::Partitioner &part) const; + + /** + * Change the ghost state of this vector to @p ghosted. + */ + void + set_ghost_state(const bool ghosted) const; + //@} /** @@ -1812,6 +1819,15 @@ namespace LinearAlgebra return partitioner; } + + + template + inline void + Vector::set_ghost_state(const bool ghosted) const + { + vector_is_ghosted = ghosted; + } + #endif } // namespace distributed diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index a0134ebfe7..e1d18fc083 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -2805,6 +2805,10 @@ namespace internal matrix_free.release_scratch_data_non_threadsafe( tmp_data[component_in_block_vector]); tmp_data[component_in_block_vector] = nullptr; + + // let vector know that ghosts are being updated and we can read from + // them + vec.set_ghost_state(true); # endif } } @@ -2938,6 +2942,9 @@ namespace internal .local_element(j + part.local_size()) = 0.; } } + + // let vector know that it's not ghosted anymore + vec.set_ghost_state(false); # endif } }