diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C index 1b29212518..e3c855894e 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C @@ -428,7 +428,7 @@ void Foam::mergeAndWrite // Renumber local ids -> global ids globalIndex(mesh.nPoints()).inplaceToGlobal(mergedIDs); - globalIndex gatherer(mergedIDs.size(), globalIndex::gatherOnly{}); + globalIndex gatherer(globalIndex::gatherOnly{}, mergedIDs.size()); gatherer.gatherInplace(mergedIDs); gatherer.gatherInplace(mergedPts); } diff --git a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracksSampler.H b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracksSampler.H index 949827254b..89fb60e095 100644 --- a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracksSampler.H +++ b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracksSampler.H @@ -144,7 +144,7 @@ public: void resetCloud(const label localCloudSize) { - cloudGather_.reset(localCloudSize, globalIndex::gatherOnly{}); + cloudGather_.reset(globalIndex::gatherOnly{}, localCloudSize); origParcelIds_.resize_nocopy(localCloudSize); origProcIds_.resize_nocopy(localCloudSize); } diff --git a/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C b/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C index 9e8d6f6be4..69fad1c6d1 100644 --- a/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C +++ b/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C @@ -194,10 +194,15 @@ triSurface triangulate // CGAL : every processor has whole surface - globalIndex globalFaceIdx(surface.size(), globalIndex::gatherOnly()); - globalIndex globalPointIdx + const globalIndex globalFaceIdx ( - surface.points().size(), globalIndex::gatherOnly() + globalIndex::gatherOnly{}, + surface.size() + ); + const globalIndex globalPointIdx + ( + globalIndex::gatherOnly{}, + surface.points().size() ); List globalSurfaceTris(globalFaceIdx.gather(surface)); diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamReduceOps.H b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamReduceOps.H index 4c16912b31..bc8dbfc965 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamReduceOps.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamReduceOps.H @@ -164,6 +164,16 @@ void reduce #undef Pstream_CommonReductions #define Pstream_CommonReductions(Native) \ \ +/*! \brief Reduce (min) multiple Native values (same size all procs!) */ \ +void reduce \ +( \ + Native values[], \ + const int size, \ + const minOp&, \ + const int tag = UPstream::msgType(), /*!< (ignored) */ \ + const label comm = UPstream::worldComm \ +); \ + \ /*! \brief Reduce (min) single Native value */ \ void reduce \ ( \ @@ -173,6 +183,29 @@ void reduce \ const label comm = UPstream::worldComm \ ); \ \ +/*! \brief Reduce (min) multiple Native values */ \ +template \ +inline void reduce \ +( \ + FixedList& values, \ + const minOp&, \ + const int tag = UPstream::msgType(), /*!< (ignored) */ \ + const label comm = UPstream::worldComm \ +) \ +{ \ + reduce(values.data(), int(values.size()), minOp(), tag, comm); \ +} \ + \ +/*! \brief Reduce (max) multiple Native values (same size all procs!) */ \ +void reduce \ +( \ + Native values[], \ + const int size, \ + const maxOp&, \ + const int tag, /*!< (ignored) */ \ + const label comm \ +); \ + \ /*! \brief Reduce (max) single Native value */ \ void reduce \ ( \ @@ -182,14 +215,18 @@ void reduce \ const label comm = UPstream::worldComm \ ); \ \ -/*! \brief Reduce (sum) single Native value */ \ -void reduce \ +/*! \brief Reduce (max) multiple Native values */ \ +template \ +inline void reduce \ ( \ - Native& value, \ - const sumOp&, \ + FixedList& values, \ + const maxOp&, \ const int tag = UPstream::msgType(), /*!< (ignored) */ \ const label comm = UPstream::worldComm \ -); \ +) \ +{ \ + reduce(values.data(), int(values.size()), maxOp(), tag, comm); \ +} \ \ /*! \brief Reduce (sum) multiple Native values (same size all procs!) */ \ void reduce \ @@ -201,6 +238,15 @@ void reduce \ const label comm \ ); \ \ +/*! \brief Reduce (sum) single Native value */ \ +void reduce \ +( \ + Native& value, \ + const sumOp&, \ + const int tag = UPstream::msgType(), /*!< (ignored) */ \ + const label comm = UPstream::worldComm \ +); \ + \ /*! \brief Reduce (sum) multiple Native values */ \ template \ inline void reduce \ @@ -224,21 +270,21 @@ inline void reduce \ \ Pstream_CommonReductions(Native); \ \ -/*! \brief Non-blocking reduce (sum) single Native value. Sets request */ \ +/*! \brief Non-blocking reduce (sum) multiple Native values. Sets request */ \ void reduce \ ( \ - Native& value, \ + Native values[], \ + const int size, \ const sumOp&, \ const int tag, /*!< (ignored) */ \ const label comm, \ label& requestID \ ); \ \ -/*! \brief Non-blocking reduce (sum) multiple Native values. Sets request */ \ +/*! \brief Non-blocking reduce (sum) single Native value. Sets request */ \ void reduce \ ( \ - Native values[], \ - const int size, \ + Native& value, \ const sumOp&, \ const int tag, /*!< (ignored) */ \ const label comm, \ diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index 862e776042..5b1670067d 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -1011,13 +1011,9 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const localTypes.resize(nonProci); // Check and report error(s) on master + // - don't need indexing on master itself - const globalIndex procAddr - ( - // Don't need to collect master itself - (Pstream::master() ? 0 : nonProci), - globalIndex::gatherOnly{} - ); + const globalIndex procAddr(globalIndex::gatherNonLocal{}, nonProci); const wordList allNames(procAddr.gather(localNames)); const wordList allTypes(procAddr.gather(localTypes)); diff --git a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C index 8ddc5dae04..9e4c191c6e 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C @@ -767,12 +767,12 @@ bool Foam::ZoneMesh::checkParallelSync const wordList localTypes(this->types()); // Check and report error(s) on master + // - don't need indexing on master itself const globalIndex procAddr ( - // Don't need to collect master itself - (Pstream::master() ? 0 : localNames.size()), - globalIndex::gatherOnly{} + globalIndex::gatherNonLocal{}, + localNames.size() ); const wordList allNames(procAddr.gather(localNames)); diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C index 074f86bdc0..d4dff1f351 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C @@ -55,13 +55,13 @@ void Foam::PatchTools::gatherAndMerge typedef typename PrimitivePatch::face_type FaceType; // Faces from all ranks - faceAddr = globalIndex(pp.size(), globalIndex::gatherOnly{}); + faceAddr.reset(globalIndex::gatherOnly{}, pp.size()); // Points from all ranks - pointAddr = globalIndex + pointAddr.reset ( - (useLocal ? pp.localPoints().size() : pp.points().size()), - globalIndex::gatherOnly{} + globalIndex::gatherOnly{}, + (useLocal ? pp.localPoints().size() : pp.points().size()) ); if (useLocal) @@ -96,14 +96,14 @@ void Foam::PatchTools::gatherAndMerge { const globalIndex localPointAddr ( - pp.localPoints().size(), - globalIndex::gatherOnly{} + globalIndex::gatherOnly{}, + pp.localPoints().size() ); const globalIndex bndPointAddr ( - pp.boundaryPoints().size(), - globalIndex::gatherOnly{} + globalIndex::gatherOnly{}, + pp.boundaryPoints().size() ); bndPointAddr.gather(pp.boundaryPoints(), boundaryPoints); diff --git a/src/OpenFOAM/parallel/globalIndex/globalIndex.C b/src/OpenFOAM/parallel/globalIndex/globalIndex.C index 518602a8ea..e4cfd48ae6 100644 --- a/src/OpenFOAM/parallel/globalIndex/globalIndex.C +++ b/src/OpenFOAM/parallel/globalIndex/globalIndex.C @@ -191,18 +191,6 @@ Foam::globalIndex::bin } -void Foam::globalIndex::reset -( - const label localSize, - const globalIndex::gatherOnly, - const label comm -) -{ - // Gather sizes (one-sided) - reset(UPstream::listGatherValues(localSize, comm)); -} - - void Foam::globalIndex::reset ( const label localSize, diff --git a/src/OpenFOAM/parallel/globalIndex/globalIndex.H b/src/OpenFOAM/parallel/globalIndex/globalIndex.H index 1be1ac216c..707dd1d3f5 100644 --- a/src/OpenFOAM/parallel/globalIndex/globalIndex.H +++ b/src/OpenFOAM/parallel/globalIndex/globalIndex.H @@ -99,11 +99,19 @@ public: //- Disambiguation tag (list construction dispatch) enum accessType : char { OFFSETS, SIZES }; - //- Dispatch tag + //- Dispatch tag. + //- Construct with a single (local size) entry, no communication. + struct gatherNone{}; + + //- Dispatch tag. + //- Construct 'one-sided' from local sizes, + //- using gather but no broadcast. struct gatherOnly{}; - //- Dispatch tag - struct gatherNone{}; + //- Dispatch tag. + //- Construct 'one-sided' from the non-master local sizes + //- using gather but no broadcast. + struct gatherNonLocal{}; // Constructors @@ -136,24 +144,37 @@ public: const bool parallel = UPstream::parRun() //!< use parallel comms ); - //- Construct by gathering local sizes without rescattering. - //- This 'one-sided' globalIndex will be empty on non-master processes. + //- Construct with a single (local size) entry, no communication + inline globalIndex + ( + const globalIndex::gatherNone, + const label localSize, + const label comm = -1 //!< no communicator needed + ); + + //- Construct 'one-sided' from local sizes. + //- Uses UPstream::listGatherValues, but no broadcast. + //- Will be empty on non-master processes. // // \note can be used when Pstream::parRun() is false. inline globalIndex ( - const label localSize, const globalIndex::gatherOnly, + const label localSize, const label comm = UPstream::worldComm //!< communicator ); - //- Construct with a single size entry. - //- No communication required + //- Construct 'one-sided' from the non-master local sizes + //- (ie, master size is treated as 0). + //- Uses UPstream::listGatherValues, but no broadcast. + //- Will be empty on non-master processes. + // + // \note can be used when Pstream::parRun() is false. inline globalIndex ( + const globalIndex::gatherNonLocal, const label localSize, - const globalIndex::gatherNone, - const label comm = -1 //!< no communicator needed + const label comm = UPstream::worldComm //!< communicator ); //- Construct from Istream. @@ -220,17 +241,6 @@ public: const bool parallel = UPstream::parRun() //!< use parallel comms ); - //- Reset by gathering local sizes without rescattering. - //- This 'one-sided' globalIndex will be empty on non-master processes. - // - // \note can be used when Pstream::parRun() is false. - void reset - ( - const label localSize, - const globalIndex::gatherOnly, - const label comm = UPstream::worldComm //!< communicator - ); - //- Reset from list of local sizes, //- with optional check for label overflow. //- No communication required @@ -240,6 +250,39 @@ public: const bool checkOverflow = false ); + //- Reset to a single (local size) entry, no communication + inline void reset + ( + const globalIndex::gatherNone, + const label localSize, + const label comm = -1 //!< no communicator needed + ); + + //- Reset as 'one-sided' from local sizes. + //- Uses UPstream::listGatherValues, but no broadcast. + //- Will be empty on non-master processes. + // + // \note can be used when Pstream::parRun() is false. + inline void reset + ( + const globalIndex::gatherOnly, + const label localSize, + const label comm = UPstream::worldComm //!< communicator + ); + + //- Reset as 'one-sided' from the non-master local sizes + //- (ie, master size is treated as 0). + //- Uses UPstream::listGatherValues, but no broadcast. + //- Will be empty on non-master processes. + // + // \note can be used when Pstream::parRun() is false. + inline void reset + ( + const globalIndex::gatherNonLocal, + const label localSize, + const label comm = UPstream::worldComm //!< communicator + ); + //- Alter local size for given processor void setLocalSize(const label proci, const label len); @@ -853,6 +896,28 @@ public: // Housekeeping + //- Construct with a single (local size) entry, no communication + globalIndex + ( + const label localSize, + const globalIndex::gatherNone, + const label comm = -1 //!< no communicator needed + ) + : + globalIndex(gatherNone{}, localSize, comm) + {} + + //- Construct 'one-sided' from local sizes. + globalIndex + ( + const label localSize, + const globalIndex::gatherOnly, + const label comm = UPstream::worldComm + ) + : + globalIndex(gatherOnly{}, localSize, comm) + {} + //- Construct from local size, using gather/broadcast //- with default/specified communicator if parallel. FOAM_DEPRECATED_FOR(2022-03, "construct without message tag") @@ -884,6 +949,20 @@ public: //- Prefer localStart() to avoid confusing with offsets() FOAM_DEPRECATED_FOR(2022-02, "use localStart()") label offset(const label proci) const { return localStart(proci); } + + //- Reset as 'one-sided' from local sizes [gather, but no broadcast] + //- Will be empty on non-master processes. + // + // \note can be used when Pstream::parRun() is false. + void reset + ( + const label localSize, + const globalIndex::gatherOnly, + const label comm = UPstream::worldComm //!< communicator + ) + { + reset(globalIndex::gatherOnly{}, localSize, comm); + } }; diff --git a/src/OpenFOAM/parallel/globalIndex/globalIndexI.H b/src/OpenFOAM/parallel/globalIndex/globalIndexI.H index 6b90865f45..8c49925c61 100644 --- a/src/OpenFOAM/parallel/globalIndex/globalIndexI.H +++ b/src/OpenFOAM/parallel/globalIndex/globalIndexI.H @@ -90,20 +90,8 @@ inline Foam::globalIndex::globalIndex inline Foam::globalIndex::globalIndex ( - const label localSize, - const globalIndex::gatherOnly, - const label comm -) -{ - // Gather sizes (one-sided) - reset(UPstream::listGatherValues(localSize, comm)); -} - - -inline Foam::globalIndex::globalIndex -( - const label localSize, const globalIndex::gatherNone, + const label localSize, const label /* comm (ignored) */ ) : @@ -114,6 +102,37 @@ inline Foam::globalIndex::globalIndex } +inline Foam::globalIndex::globalIndex +( + const globalIndex::gatherOnly, + const label localSize, + const label comm +) +{ + // one-sided + reset(UPstream::listGatherValues(localSize, comm)); +} + + +inline Foam::globalIndex::globalIndex +( + const globalIndex::gatherNonLocal, + const label localSize, + const label comm +) +{ + // one-sided: non-master only + reset + ( + UPstream::listGatherValues + ( + (UPstream::master() ? label(0) : localSize), + comm + ) + ); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // inline bool Foam::globalIndex::empty() const @@ -350,6 +369,50 @@ inline Foam::label Foam::globalIndex::whichProcID(const label i) const } +inline void Foam::globalIndex::reset +( + const globalIndex::gatherNone, + const label localSize, + const label /* comm (ignored) */ +) +{ + offsets_.resize_nocopy(2); + offsets_[0] = 0; + offsets_[1] = localSize; +} + + +inline void Foam::globalIndex::reset +( + const globalIndex::gatherOnly, + const label localSize, + const label comm +) +{ + // one-sided + reset(UPstream::listGatherValues(localSize, comm)); +} + + +inline void Foam::globalIndex::reset +( + const globalIndex::gatherNonLocal, + const label localSize, + const label comm +) +{ + // one-sided: non-master only + reset + ( + UPstream::listGatherValues + ( + (UPstream::master() ? label(0) : localSize), + comm + ) + ); +} + + // * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * // inline Foam::globalIndex::const_iterator:: diff --git a/src/OpenFOAM/parallel/globalIndex/globalIndexTemplates.C b/src/OpenFOAM/parallel/globalIndex/globalIndexTemplates.C index 9d594ffd5c..f1b60ac033 100644 --- a/src/OpenFOAM/parallel/globalIndex/globalIndexTemplates.C +++ b/src/OpenFOAM/parallel/globalIndex/globalIndexTemplates.C @@ -697,7 +697,7 @@ void Foam::globalIndex::mpiGatherOp if (UPstream::parRun()) { // Gather sizes - only needed on master - globalIndex(sendData.size(), globalIndex::gatherOnly{}, comm) + globalIndex(globalIndex::gatherOnly{}, sendData.size(), comm) .mpiGather(sendData, allData, comm, commsType, tag); } else @@ -765,7 +765,7 @@ void Foam::globalIndex::gatherOp if (UPstream::parRun()) { // Gather sizes - only needed on master - globalIndex(sendData.size(), globalIndex::gatherOnly{}, comm) + globalIndex(globalIndex::gatherOnly{}, sendData.size(), comm) .gather(sendData, allData, tag, commsType, comm); } else @@ -789,7 +789,7 @@ void Foam::globalIndex::gatherOp if (UPstream::parRun()) { // Gather sizes - only needed on master - globalIndex(sendData.size(), globalIndex::gatherOnly{}, comm) + globalIndex(globalIndex::gatherOnly{}, sendData.size(), comm) .gather(sendData, allData, tag, commsType, comm); } else @@ -842,7 +842,7 @@ void Foam::globalIndex::gatherInplaceOp if (UPstream::parRun()) { // Gather sizes - only needed on master - globalIndex(fld.size(), globalIndex::gatherOnly{}, comm) + globalIndex(globalIndex::gatherOnly{}, fld.size(), comm) .gather(fld, tag, commsType, comm); } // Serial: (no-op) diff --git a/src/Pstream/dummy/UPstreamReduce.C b/src/Pstream/dummy/UPstreamReduce.C index a4f19cd7d7..00dda3899f 100644 --- a/src/Pstream/dummy/UPstreamReduce.C +++ b/src/Pstream/dummy/UPstreamReduce.C @@ -66,6 +66,36 @@ void Foam::reduce #define Pstream_CommonReductions(Native) \ \ void Foam::reduce \ +( \ + Native values[], \ + const int size, \ + const minOp&, \ + const int tag, \ + const label comm \ +) \ +{} \ + \ +void Foam::reduce \ +( \ + Native values[], \ + const int size, \ + const maxOp&, \ + const int tag, \ + const label comm \ +) \ +{} \ + \ +void Foam::reduce \ +( \ + Native values[], \ + const int size, \ + const sumOp&, \ + const int tag, \ + const label comm \ +) \ +{} \ + \ +void Foam::reduce \ ( \ Native& value, \ const minOp&, \ @@ -90,16 +120,6 @@ void Foam::reduce \ const int tag, \ const label comm \ ) \ -{} \ - \ -void Foam::reduce \ -( \ - Native values[], \ - const int size, \ - const sumOp&, \ - const int tag, \ - const label comm \ -) \ {} @@ -114,7 +134,8 @@ Pstream_CommonReductions(Native); \ \ void Foam::reduce \ ( \ - Native& value, \ + Native values[], \ + const int size, \ const sumOp&, \ const int tag, \ const label comm, \ @@ -124,8 +145,7 @@ void Foam::reduce \ \ void Foam::reduce \ ( \ - Native values[], \ - const int size, \ + Native& value, \ const sumOp&, \ const int tag, \ const label comm, \ diff --git a/src/Pstream/mpi/UPstreamReduce.C b/src/Pstream/mpi/UPstreamReduce.C index b8837a89a7..dafa6d42c2 100644 --- a/src/Pstream/mpi/UPstreamReduce.C +++ b/src/Pstream/mpi/UPstreamReduce.C @@ -80,6 +80,51 @@ void Foam::reduce #define Pstream_CommonReductions(Native, TaggedType) \ \ void Foam::reduce \ +( \ + Native values[], \ + const int size, \ + const minOp&, \ + const int tag, /* (unused) */ \ + const label comm \ +) \ +{ \ + PstreamDetail::allReduce \ + ( \ + values, size, TaggedType, MPI_MIN, comm \ + ); \ +} \ + \ +void Foam::reduce \ +( \ + Native values[], \ + const int size, \ + const maxOp&, \ + const int tag, /* (unused) */ \ + const label comm \ +) \ +{ \ + PstreamDetail::allReduce \ + ( \ + values, size, TaggedType, MPI_MAX, comm \ + ); \ +} \ + \ +void Foam::reduce \ +( \ + Native values[], \ + const int size, \ + const sumOp&, \ + const int tag, /* (unused) */ \ + const label comm \ +) \ +{ \ + PstreamDetail::allReduce \ + ( \ + values, size, TaggedType, MPI_SUM, comm \ + ); \ +} \ + \ +void Foam::reduce \ ( \ Native& value, \ const minOp&, \ @@ -119,21 +164,6 @@ void Foam::reduce \ ( \ &value, 1, TaggedType, MPI_SUM, comm \ ); \ -} \ - \ -void Foam::reduce \ -( \ - Native values[], \ - const int size, \ - const sumOp&, \ - const int tag, /* (unused) */ \ - const label comm \ -) \ -{ \ - PstreamDetail::allReduce \ - ( \ - values, size, TaggedType, MPI_SUM, comm \ - ); \ } @@ -147,21 +177,6 @@ void Foam::reduce \ Pstream_CommonReductions(Native, TaggedType); \ \ void Foam::reduce \ -( \ - Native& value, \ - const sumOp&, \ - const int tag, /* (unused) */ \ - const label comm, \ - label& requestID \ -) \ -{ \ - PstreamDetail::allReduce \ - ( \ - &value, 1, TaggedType, MPI_SUM, comm, &requestID \ - ); \ -} \ - \ -void Foam::reduce \ ( \ Native values[], \ const int size, \ @@ -177,6 +192,21 @@ void Foam::reduce \ ); \ } \ \ +void Foam::reduce \ +( \ + Native& value, \ + const sumOp&, \ + const int tag, /* (unused) */ \ + const label comm, \ + label& requestID \ +) \ +{ \ + PstreamDetail::allReduce \ + ( \ + &value, 1, TaggedType, MPI_SUM, comm, &requestID \ + ); \ +} \ + \ void Foam::sumReduce \ ( \ Native& value, \ diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C index 65208da7d3..7ba8162ff3 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C @@ -398,13 +398,9 @@ void Foam::fvMeshDistribute::getFieldNames if (syncPar && Pstream::parRun()) { // Check and report error(s) on master + // - don't need indexing on master itself - const globalIndex procAddr - ( - // Don't need to collect master itself - (Pstream::master() ? 0 : list.size()), - globalIndex::gatherOnly{} - ); + const globalIndex procAddr(globalIndex::gatherNonLocal{}, list.size()); const wordList allNames(procAddr.gather(list)); diff --git a/src/fileFormats/ensight/output/ensightOutputTemplates.C b/src/fileFormats/ensight/output/ensightOutputTemplates.C index 8a2eb9364f..13b15daaeb 100644 --- a/src/fileFormats/ensight/output/ensightOutputTemplates.C +++ b/src/fileFormats/ensight/output/ensightOutputTemplates.C @@ -93,8 +93,8 @@ void Foam::ensightOutput::Detail::writeFieldContent const globalIndex procAddr ( parallel - ? globalIndex(fld.size(), globalIndex::gatherOnly{}) - : globalIndex(fld.size(), globalIndex::gatherNone{}) + ? globalIndex(globalIndex::gatherOnly{}, fld.size()) + : globalIndex(globalIndex::gatherNone{}, fld.size()) ); diff --git a/src/fileFormats/vtk/file/foamVtkFileWriter.C b/src/fileFormats/vtk/file/foamVtkFileWriter.C index a5a4533c3e..123a69e321 100644 --- a/src/fileFormats/vtk/file/foamVtkFileWriter.C +++ b/src/fileFormats/vtk/file/foamVtkFileWriter.C @@ -567,8 +567,8 @@ bool Foam::vtk::fileWriter::writeProcIDs(const label nValues) const globalIndex procAddr ( parallel_ - ? globalIndex(nValues, globalIndex::gatherOnly{}) - : globalIndex(nValues, globalIndex::gatherNone{}) + ? globalIndex(globalIndex::gatherOnly{}, nValues) + : globalIndex(globalIndex::gatherNone{}, nValues) ); const label totalCount = procAddr.totalSize(); diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C index 5d5aca4d9e..dee21f5617 100644 --- a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C +++ b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C @@ -689,13 +689,9 @@ bool Foam::faBoundaryMesh::checkParallelSync(const bool report) const localTypes.resize(nonProci); // Check and report error(s) on master + // - don't need indexing on master itself - const globalIndex procAddr - ( - // Don't need to collect master itself - (Pstream::master() ? 0 : nonProci), - globalIndex::gatherOnly{} - ); + const globalIndex procAddr(globalIndex::gatherNonLocal{}, nonProci); const wordList allNames(procAddr.gather(localNames)); const wordList allTypes(procAddr.gather(localTypes)); diff --git a/src/functionObjects/field/externalCoupled/externalCoupled.C b/src/functionObjects/field/externalCoupled/externalCoupled.C index 4b45fb5df1..d2a16eeb98 100644 --- a/src/functionObjects/field/externalCoupled/externalCoupled.C +++ b/src/functionObjects/field/externalCoupled/externalCoupled.C @@ -108,7 +108,7 @@ void Foam::functionObjects::externalCoupled::readColumns ) const { // Get sizes for all processors - const globalIndex globalFaces(nRows, globalIndex::gatherOnly{}); + const globalIndex globalFaces(globalIndex::gatherOnly{}, nRows); PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking); @@ -179,7 +179,7 @@ void Foam::functionObjects::externalCoupled::readLines ) const { // Get sizes for all processors - const globalIndex globalFaces(nRows, globalIndex::gatherOnly{}); + const globalIndex globalFaces(globalIndex::gatherOnly{}, nRows); PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking); diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C index 64751857bd..8f4603abe9 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.C +++ b/src/sampling/sampledSet/sampledSets/sampledSets.C @@ -164,7 +164,7 @@ void Foam::sampledSets::gatherAllSets() { const coordSet& coords = localSets[seti]; - globalIndices_[seti].reset(coords.size(), globalIndex::gatherOnly{}); + globalIndices_[seti].reset(globalIndex::gatherOnly{}, coords.size()); gatheredSets_.set(seti, coords.gatherSort(gatheredSorting_[seti])); } }