From: Daniel Arndt Date: Thu, 25 Jan 2018 09:08:28 +0000 (+0100) Subject: Simplify Utilities::MPI::sum for *Tensor X-Git-Tag: v9.0.0-rc1~519^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5801%2Fhead;p=dealii.git Simplify Utilities::MPI::sum for *Tensor --- diff --git a/include/deal.II/base/mpi.templates.h b/include/deal.II/base/mpi.templates.h index c927d96441..15162ed41c 100644 --- a/include/deal.II/base/mpi.templates.h +++ b/include/deal.II/base/mpi.templates.h @@ -366,20 +366,9 @@ namespace Utilities sum (const Tensor &local, const MPI_Comm &mpi_communicator) { - const unsigned int n_entries = Tensor::n_independent_components; - Number entries[ Tensor::n_independent_components ]; - - for (unsigned int i=0; i< n_entries; ++i) - entries[i] = local[ local.unrolled_to_component_indices(i) ]; - - Number global_entries[ Tensor::n_independent_components ]; - dealii::Utilities::MPI::sum( entries, mpi_communicator, global_entries ); - - Tensor global; - for (unsigned int i=0; i< n_entries; ++i) - global[ global.unrolled_to_component_indices(i) ] = global_entries[i]; - - return global; + Tensor sums; + dealii::Utilities::MPI::sum(local, mpi_communicator, sums); + return sums; }