From ab12185ea15a5d238dc9941bd8ac13fda91d0e1f Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Thu, 24 May 2018 13:10:10 +0200 Subject: [PATCH] Do call plain update_ghost_values()/compress() for block vector with many blocks. --- include/deal.II/matrix_free/matrix_free.h | 158 ++++++++++++++-------- 1 file changed, 99 insertions(+), 59 deletions(-) diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index dc8ce0b827..2a4652aab4 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -2919,130 +2919,155 @@ namespace internal + // if the input vector did not have ghosts imported, clear them here again + // in order to avoid subsequent operations e.g. in linear solvers to work + // with ghosts all the time template inline - void update_ghost_values_start (const VectorStruct &vec, - VectorDataExchange &exchanger, - const unsigned int channel = 0) + void reset_ghost_values (const VectorStruct &vec, + VectorDataExchange &exchanger) { - update_ghost_values_start_block(vec, channel, - std::integral_constant::value>(), - exchanger); + reset_ghost_values_block(vec, + std::integral_constant::value>(), + exchanger); } template inline - void update_ghost_values_start (const LinearAlgebra::distributed::Vector &vec, - VectorDataExchange &exchanger, - const unsigned int channel = 0) + void reset_ghost_values (const LinearAlgebra::distributed::Vector &vec, + VectorDataExchange &exchanger) { - exchanger.update_ghost_values_start(channel, vec); + exchanger.reset_ghost_values(vec); } template inline - void update_ghost_values_start (const std::vector &vec, - VectorDataExchange &exchanger) + void reset_ghost_values (const std::vector &vec, + VectorDataExchange &exchanger) { - unsigned int component_index = 0; for (unsigned int comp=0; comp inline - void update_ghost_values_start (const std::vector &vec, - VectorDataExchange &exchanger) + void reset_ghost_values (const std::vector &vec, + VectorDataExchange &exchanger) { - unsigned int component_index = 0; for (unsigned int comp=0; comp inline - void update_ghost_values_start_block (const VectorStruct &vec, - const unsigned int channel, - std::integral_constant, - VectorDataExchange &exchanger) + void reset_ghost_values_block (const VectorStruct &vec, + std::integral_constant, + VectorDataExchange &exchanger) { for (unsigned int i=0; i + constexpr unsigned int get_communication_block_size(const VectorStruct &) + { + return numbers::invalid_unsigned_int; + } + + + + // Specialized case for the block vector which as the additional member + // variable + template + constexpr unsigned int get_communication_block_size(const LinearAlgebra::distributed::BlockVector &) + { + return LinearAlgebra::distributed::BlockVector::communication_block_size; } - // if the input vector did not have ghosts imported, clear them here again - // in order to avoid subsequent operations e.g. in linear solvers to work - // with ghosts all the time template inline - void reset_ghost_values (const VectorStruct &vec, - VectorDataExchange &exchanger) + void update_ghost_values_start (const VectorStruct &vec, + VectorDataExchange &exchanger, + const unsigned int channel = 0) { - reset_ghost_values_block(vec, - std::integral_constant::value>(), - exchanger); + update_ghost_values_start_block(vec, channel, + std::integral_constant::value>(), + exchanger); } template inline - void reset_ghost_values (const LinearAlgebra::distributed::Vector &vec, - VectorDataExchange &exchanger) + void update_ghost_values_start (const LinearAlgebra::distributed::Vector &vec, + VectorDataExchange &exchanger, + const unsigned int channel = 0) { - exchanger.reset_ghost_values(vec); + exchanger.update_ghost_values_start(channel, vec); } template inline - void reset_ghost_values (const std::vector &vec, - VectorDataExchange &exchanger) + void update_ghost_values_start (const std::vector &vec, + VectorDataExchange &exchanger) { + unsigned int component_index = 0; for (unsigned int comp=0; comp inline - void reset_ghost_values (const std::vector &vec, - VectorDataExchange &exchanger) + void update_ghost_values_start (const std::vector &vec, + VectorDataExchange &exchanger) { + unsigned int component_index = 0; for (unsigned int comp=0; comp inline - void reset_ghost_values_block (const VectorStruct &vec, - std::integral_constant, - VectorDataExchange &exchanger) + void update_ghost_values_start_block (const VectorStruct &vec, + const unsigned int channel, + std::integral_constant, + VectorDataExchange &exchanger) { - for (unsigned int i=0; i, VectorDataExchange &exchanger) { - for (unsigned int i=0; i, VectorDataExchange &exchanger) { - for (unsigned int i=0; i, VectorDataExchange &exchanger) { - for (unsigned int i=0; i