From ec4265343a3216bad516e76f954550daee69fe80 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 22 Jul 2021 10:16:49 +0200 Subject: [PATCH] ENH: use multi-world connection object for managing mappedPatches --- .../mappedPolyPatch/mappedPatchBase.C | 360 +++++++++--------- .../mappedPolyPatch/mappedPatchBase.H | 62 +-- .../mappedPolyPatch/mappedPatchBaseI.H | 49 ++- .../mappedPatchBaseTemplates.C | 57 +-- 4 files changed, 289 insertions(+), 239 deletions(-) diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C index d5b19a4b33..e02312a911 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,6 +30,7 @@ License #include "addToRunTimeSelectionTable.H" #include "ListListOps.H" #include "meshSearchMeshObject.H" +#include "multiWorldConnectionsObject.H" #include "meshTools.H" #include "OFstream.H" #include "Random.H" @@ -48,7 +49,7 @@ License #include "faceAreaWeightAMI.H" #include "OTstream.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { @@ -119,53 +120,31 @@ Foam::autoPtr Foam::mappedPatchBase::readDatabase } -Foam::label Foam::mappedPatchBase::communicator -( - const word& sampleWorld -) +bool Foam::mappedPatchBase::addWorldConnection() { - // Start off with local world - label comm = UPstream::worldComm; - - if (!sampleWorld.empty() && Pstream::parRun()) + if (sameWorld()) { - if (!UPstream::allWorlds().found(sampleWorld)) - { - FatalErrorInFunction << "Cannot find sampleWorld " << sampleWorld - << " in set of worlds " << UPstream::allWorlds() - << exit(FatalError); - } - - const labelList& worldIDs = UPstream::worldIDs(); - - DynamicList