From: Wolfgang Bangerth Date: Fri, 15 Dec 2023 05:48:10 +0000 (-0700) Subject: Correct a condition. X-Git-Tag: relicensing~242^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=964935dc0ef8df8bb1447d2ba6456f2d5c756625;p=dealii.git Correct a condition. --- diff --git a/include/deal.II/lac/sparse_matrix_tools.h b/include/deal.II/lac/sparse_matrix_tools.h index c4832c3107..f5002984e8 100644 --- a/include/deal.II/lac/sparse_matrix_tools.h +++ b/include/deal.II/lac/sparse_matrix_tools.h @@ -151,23 +151,25 @@ namespace SparseMatrixTools (void)comm; return {0, value}; # else - if (comm == MPI_COMM_SELF) - return {0, value}; // serial triangulation - - T prefix = {}; + if (Utilities::MPI::n_mpi_processes(comm) == 1) + return {0, value}; + else + { + T prefix = {}; - int ierr = - MPI_Exscan(&value, - &prefix, - 1, - Utilities::MPI::mpi_type_id_for_type, - MPI_SUM, - comm); - AssertThrowMPI(ierr); + int ierr = + MPI_Exscan(&value, + &prefix, + 1, + Utilities::MPI::mpi_type_id_for_type, + MPI_SUM, + comm); + AssertThrowMPI(ierr); - T sum = Utilities::MPI::sum(value, comm); + T sum = Utilities::MPI::sum(value, comm); - return {prefix, sum}; + return {prefix, sum}; + } # endif }