From 88be9ef5c6bef4bdfbc6b7178a19e8b59638fb82 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 20 Dec 2023 11:44:55 +0100 Subject: [PATCH] FIX: provide default uniform scotch weighting (#3063) - maintains the same code path within scotch --- .../decompose/ptscotchDecomp/ptscotchDecomp.C | 19 +++++++++++++++++++ .../decompose/scotchDecomp/scotchDecomp.C | 9 +++++++++ 2 files changed, 28 insertions(+) diff --git a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C index 7a2ec4948d..1fb105cf4f 100644 --- a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C +++ b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C @@ -295,6 +295,25 @@ Foam::label Foam::ptscotchDecomp::decompose velotab.resize(1, 1); } } + else + { + // HACK: specify uniform weights + // - seems that scotch takes different code paths internally + // if weights are not specified (issue #3063) + + if (numCells > 0) + { + velotab.resize(numCells); + } + else + { + // Locally zero cells but not globally. + // Provide some size to avoid null pointer. + velotab.resize(1); + } + + velotab = static_cast(1); + } // diff --git a/src/parallel/decompose/scotchDecomp/scotchDecomp.C b/src/parallel/decompose/scotchDecomp/scotchDecomp.C index e12252f806..c3637bd4dd 100644 --- a/src/parallel/decompose/scotchDecomp/scotchDecomp.C +++ b/src/parallel/decompose/scotchDecomp/scotchDecomp.C @@ -267,6 +267,15 @@ Foam::label Foam::scotchDecomp::decomposeSerial } } } + else + { + // HACK: specify uniform weights + // - seems that scotch takes different code paths internally + // if weights are not specified (issue #3063) + + velotab.resize(numCells); + velotab = static_cast(1); + } //