diff --git a/src/finiteArea/faMesh/faMeshTools/faMeshTools.cxx b/src/finiteArea/faMesh/faMeshTools/faMeshTools.cxx index 42dc91ce10..33360518ff 100644 --- a/src/finiteArea/faMesh/faMeshTools/faMeshTools.cxx +++ b/src/finiteArea/faMesh/faMeshTools/faMeshTools.cxx @@ -32,7 +32,6 @@ License #include "edgeFields.H" #include "fileOperation.H" #include "BitOps.H" -#include "ListOps.H" #include "polyMesh.H" #include "processorFaPatch.H" @@ -432,12 +431,12 @@ Foam::faMeshTools::loadOrCreateMesh_impl } else if (readHandlerPtr && haveLocalMesh) { - const label numProcs = UPstream::nProcs(UPstream::worldComm); + const label numWorldProcs = UPstream::nProcs(UPstream::worldComm); + const label realWorldComm = UPstream::worldComm; const labelList meshProcIds(BitOps::sortedToc(haveMesh)); UPstream::communicator newCommunicator; - const label oldWorldComm = UPstream::commWorld(); auto& readHandler = *readHandlerPtr; auto oldHandler = fileOperation::fileHandler(readHandler); @@ -447,13 +446,13 @@ Foam::faMeshTools::loadOrCreateMesh_impl // Instead allocate a new communicator for everyone with a mesh // Comparing global ranks in the communicator. - - if (ListOps::equal(meshProcIds, UPstream::procID(fileHandler().comm()))) + if (UPstream::sameProcs(fileHandler().comm(), meshProcIds)) { + const_cast(fileHandler()).nProcs(numWorldProcs); // Can use the handler communicator as is. UPstream::commWorld(fileHandler().comm()); } - else if (UPstream::nProcs(fileHandler().comm()) != numProcs) + else if (UPstream::nProcs(fileHandler().comm()) != numWorldProcs) { // Need a new communicator for the fileHandler. @@ -468,10 +467,10 @@ Foam::faMeshTools::loadOrCreateMesh_impl meshPtr = autoPtr::New(areaName, pMesh, false); readHandler = fileOperation::fileHandler(oldHandler); - UPstream::commWorld(oldWorldComm); + UPstream::commWorld(realWorldComm); // Reset mesh communicator to the real world comm - meshPtr().comm() = UPstream::commWorld(); + meshPtr().comm() = realWorldComm; } diff --git a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldMapperPatchRef.H b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldMapperPatchRef.H deleted file mode 100644 index ba6e52aa05..0000000000 --- a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldMapperPatchRef.H +++ /dev/null @@ -1,100 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2016-2017 Wikki Ltd -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::faPatchFieldMapperPatchRef - -Description - -\*---------------------------------------------------------------------------*/ - -#ifndef faPatchFieldMapperPatchRef_H -#define faPatchFieldMapperPatchRef_H - -#include "faPatchFieldMapper.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class faPatchFieldMapperPatchRef Declaration -\*---------------------------------------------------------------------------*/ - -class faPatchFieldMapperPatchRef -: - public faPatchFieldMapper -{ - // Private Data - - const faPatch& sourcePatch_; - const faPatch& targetPatch_; - - - // Private Member Functions - - //- No copy construct - faPatchFieldMapperPatchRef(const faPatchFieldMapperPatchRef&) = delete; - - //- No copy assignment - void operator=(const faPatchFieldMapperPatchRef&) = delete; - - -public: - - // Constructors - - //- Construct from components - faPatchFieldMapperPatchRef(const faPatch& source, const faPatch& target) - : - sourcePatch_(source), - targetPatch_(target) - {} - - - // Member functions - - const faPatch& sourcePatch() const - { - return sourcePatch_; - } - - const faPatch& targetPatch() const - { - return targetPatch_; - } -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvMeshTools/fvMeshTools.C b/src/finiteVolume/fvMesh/fvMeshTools/fvMeshTools.C index aa794581a8..b20e9faddf 100644 --- a/src/finiteVolume/fvMesh/fvMeshTools/fvMeshTools.C +++ b/src/finiteVolume/fvMesh/fvMeshTools/fvMeshTools.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2015-2023 OpenCFD Ltd. + Copyright (C) 2015-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -390,7 +390,7 @@ Foam::labelList Foam::fvMeshTools::removeEmptyPatches if (keepPatches.found(pp.name())) { newToOld[newI] = patchI; - oldToNew[patchI] = newI++; + oldToNew[patchI] = newI++; } else { @@ -777,7 +777,7 @@ Foam::fvMeshTools::loadOrCreateMeshImpl // Patch types // ~~~~~~~~~~~ - // Read and scatter master patches (without reading master mesh!) + // Read and broadcast master patches (without reading master mesh!) PtrList patchEntries; if (UPstream::master()) @@ -951,10 +951,12 @@ Foam::fvMeshTools::loadOrCreateMeshImpl } else if (readHandlerPtr && haveLocalMesh) { + const label numWorldProcs = UPstream::nProcs(UPstream::worldComm); + const label realWorldComm = UPstream::worldComm; + const labelList meshProcIds(BitOps::sortedToc(haveMesh)); UPstream::communicator newCommunicator; - const label oldWorldComm = UPstream::commWorld(); auto& readHandler = *readHandlerPtr; auto oldHandler = fileOperation::fileHandler(readHandler); @@ -963,31 +965,14 @@ Foam::fvMeshTools::loadOrCreateMeshImpl // only include the ranks for the current IO rank. // Instead allocate a new communicator for everyone with a mesh - const auto& handlerProcIds = UPstream::procID(fileHandler().comm()); - // Comparing global ranks in the communicator. - // Use std::equal for the List