]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify Utilities::MPI::sum for *Tensor 5801/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 25 Jan 2018 09:08:28 +0000 (10:08 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 25 Jan 2018 23:10:39 +0000 (00:10 +0100)
include/deal.II/base/mpi.templates.h

index c927d9644128f244f28d4166cd9cd034db8fcd78..15162ed41c88805cbb54b37245f59d4b1ff7c23e 100644 (file)
@@ -366,20 +366,9 @@ namespace Utilities
     sum (const Tensor<rank,dim,Number> &local,
          const MPI_Comm &mpi_communicator)
     {
-      const unsigned int n_entries = Tensor<rank,dim,Number>::n_independent_components;
-      Number entries[ Tensor<rank,dim,Number>::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<rank,dim,Number>::n_independent_components ];
-      dealii::Utilities::MPI::sum( entries, mpi_communicator, global_entries );
-
-      Tensor<rank,dim,Number> global;
-      for (unsigned int i=0; i< n_entries; ++i)
-        global[ global.unrolled_to_component_indices(i) ] = global_entries[i];
-
-      return global;
+      Tensor<rank, dim, Number> sums;
+      dealii::Utilities::MPI::sum(local, mpi_communicator, sums);
+      return sums;
     }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.