From 3ecf7074fe152a8465e97c5348e105ff37edf2f1 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 20 Sep 2016 22:12:22 +0100 Subject: [PATCH] Exclude processors outside of comm from gatherScatter without failure --- src/foam/db/IOstreams/Pstreams/gatherScatter.C | 14 ++++++++++++++ src/foam/db/IOstreams/Pstreams/gatherScatterList.C | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/foam/db/IOstreams/Pstreams/gatherScatter.C b/src/foam/db/IOstreams/Pstreams/gatherScatter.C index 24bab91a5..d232c0e02 100644 --- a/src/foam/db/IOstreams/Pstreams/gatherScatter.C +++ b/src/foam/db/IOstreams/Pstreams/gatherScatter.C @@ -50,6 +50,13 @@ void Pstream::gather const label comm ) { + // Return if not active in this comm + // HJ, 12/Sep/2016 + if (Pstream::myProcNo(comm) == -1) + { + return; + } + if (Pstream::nProcs(comm) > 1) { // Get my communication order @@ -149,6 +156,13 @@ void Pstream::scatter const label comm ) { + // Return if not active in this comm + // HJ, 12/Sep/2016 + if (Pstream::myProcNo(comm) == -1) + { + return; + } + if (Pstream::nProcs(comm) > 1) { // Get my communication order diff --git a/src/foam/db/IOstreams/Pstreams/gatherScatterList.C b/src/foam/db/IOstreams/Pstreams/gatherScatterList.C index a017ecb55..8f872e384 100644 --- a/src/foam/db/IOstreams/Pstreams/gatherScatterList.C +++ b/src/foam/db/IOstreams/Pstreams/gatherScatterList.C @@ -54,6 +54,13 @@ void Pstream::gatherList const label comm ) { + // Return if not active in this comm + // HJ, 12/Sep/2016 + if (Pstream::myProcNo(comm) == -1) + { + return; + } + if (Pstream::nProcs(comm) > 1) { if (Values.size() != Pstream::nProcs(comm)) @@ -218,6 +225,13 @@ void Pstream::scatterList const label comm ) { + // Return if not active in this comm + // HJ, 12/Sep/2016 + if (Pstream::myProcNo(comm) == -1) + { + return; + } + if (Pstream::nProcs(comm) > 1) { if (Values.size() != Pstream::nProcs(comm))