From 63f8617731c1e20cd56fc620136cc1698cbbf58c Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <dmitri.naumov@ufz.de> Date: Fri, 18 Oct 2024 15:55:16 +0200 Subject: [PATCH] [BL/MPI] Reduce ifdef range. --- BaseLib/MPI.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/BaseLib/MPI.h b/BaseLib/MPI.h index 3b37773e3e9..9a3b8b48ce0 100644 --- a/BaseLib/MPI.h +++ b/BaseLib/MPI.h @@ -5,28 +5,28 @@ * Distributed under a Modified BSD License. * See accompanying file LICENSE.txt or * http://www.opengeosys.org/project/license - * */ #pragma once +#ifdef USE_PETSC +#include <mpi.h> +#endif + namespace BaseLib::MPI { -#ifdef USE_PETSC -// Reduce operations for interprocess communications while using Petsc -static inline int reduceMin(int val) +static inline int reduceMin(int const val) { +#ifdef USE_PETSC + // Reduce operations for interprocess communications while using Petsc int result; MPI_Allreduce(&val, &result, 1, MPI_INTEGER, MPI_MIN, PETSC_COMM_WORLD); return result; -} #else -// Reduce operations for interprocess communications without using Petsc -static inline int reduceMin(int val) -{ + // Reduce operations for interprocess communications without using Petsc return val; -} #endif +} } // namespace BaseLib::MPI -- GitLab