diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C index d100ad3fe8..b4a681fafa 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -49,25 +49,11 @@ void Foam::PatchTools::gatherAndMerge // Collect points from all processors labelList pointSizes; { - List> gatheredPoints(Pstream::nProcs()); - gatheredPoints[Pstream::myProcNo()] = p.points(); + const globalIndex gi(p.points().size()); - Pstream::gatherList(gatheredPoints); + gi.gather(p.points(), mergedPoints); - if (Pstream::master()) - { - pointSizes = ListListOps::subSizes - ( - gatheredPoints, - accessOp>() - ); - - mergedPoints = ListListOps::combine> - ( - gatheredPoints, - accessOp>() - ); - } + pointSizes = gi.sizes(); } // Collect faces from all processors and renumber using sizes of diff --git a/src/sampling/sampledSet/sampledSet/sampledSet.C b/src/sampling/sampledSet/sampledSet/sampledSet.C index 3cedcda0f9..b5fbf66e3c 100644 --- a/src/sampling/sampledSet/sampledSet/sampledSet.C +++ b/src/sampling/sampledSet/sampledSet/sampledSet.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,6 +29,7 @@ License #include "meshSearch.H" #include "writer.H" #include "particle.H" +#include "globalIndex.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -427,40 +428,13 @@ Foam::autoPtr Foam::sampledSet::gather // ordering in indexSet. // Note: only master results are valid - // Collect data from all processors - List> gatheredPts(Pstream::nProcs()); - gatheredPts[Pstream::myProcNo()] = *this; - Pstream::gatherList(gatheredPts); + List allPts; + globalIndex::gatherOp(*this, allPts); - List gatheredSegments(Pstream::nProcs()); - gatheredSegments[Pstream::myProcNo()] = segments(); - Pstream::gatherList(gatheredSegments); + globalIndex::gatherOp(segments(), allSegments); - List gatheredDist(Pstream::nProcs()); - gatheredDist[Pstream::myProcNo()] = curveDist(); - Pstream::gatherList(gatheredDist); - - - // Combine processor lists into one big list. - List allPts - ( - ListListOps::combine> - ( - gatheredPts, accessOp>() - ) - ); - allSegments = - ListListOps::combine - ( - gatheredSegments, accessOp() - ); - scalarList allCurveDist - ( - ListListOps::combine - ( - gatheredDist, accessOp() - ) - ); + scalarList allCurveDist; + globalIndex::gatherOp(curveDist(), allCurveDist); if (Pstream::master() && allCurveDist.empty()) diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C index 7589d5b3df..be531b0886 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.C +++ b/src/sampling/sampledSet/sampledSets/sampledSets.C @@ -27,7 +27,6 @@ License #include "dictionary.H" #include "Time.H" #include "volFields.H" -#include "ListListOps.H" #include "volPointInterpolation.H" #include "mapPolyMesh.H" #include "addToRunTimeSelectionTable.H" diff --git a/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C index c8855bf828..01082f648b 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C +++ b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -25,7 +25,7 @@ License #include "sampledSets.H" #include "volFields.H" -#include "ListListOps.H" +#include "globalIndex.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -182,21 +182,12 @@ void Foam::sampledSets::combineSampledValues forAll(indexSets, setI) { // Collect data from all processors - List> gatheredData(Pstream::nProcs()); - gatheredData[Pstream::myProcNo()] = sampledFields[fieldi][setI]; - Pstream::gatherList(gatheredData); + + Field allData; + globalIndex::gatherOp(sampledFields[fieldi][setI], allData); if (Pstream::master()) { - Field allData - ( - ListListOps::combine> - ( - gatheredData, - Foam::accessOp>() - ) - ); - masterValues[setI] = UIndirectList ( allData, diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index 5a028345af..71afcb9f78 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -26,7 +26,7 @@ License #include "sampledSurfaces.H" #include "volFields.H" #include "surfaceFields.H" -#include "ListListOps.H" +#include "globalIndex.H" #include "stringListOps.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -51,29 +51,19 @@ void Foam::sampledSurfaces::writeSurface if (Pstream::parRun()) { - // Collect values from all processors - List> gatheredValues(Pstream::nProcs()); - gatheredValues[Pstream::myProcNo()] = values; - Pstream::gatherList(gatheredValues); + // Gather all values into single field + Field allValues; + + globalIndex::gatherOp(values, allValues); fileName sampleFile; if (Pstream::master()) { - // Combine values into single field - Field allValues - ( - ListListOps::combine> - ( - gatheredValues, - accessOp>() - ) - ); - // Renumber (point data) to correspond to merged points if (mergedList_[surfi].pointsMap().size() == allValues.size()) { inplaceReorder(mergedList_[surfi].pointsMap(), allValues); - allValues.setSize(mergedList_[surfi].points().size()); + allValues.resize(mergedList_[surfi].points().size()); } // Write to time directory under outputPath_ diff --git a/src/surfMesh/mergedSurf/mergedSurf.C b/src/surfMesh/mergedSurf/mergedSurf.C index 65ca1e06c3..0c5984f006 100644 --- a/src/surfMesh/mergedSurf/mergedSurf.C +++ b/src/surfMesh/mergedSurf/mergedSurf.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ License #include "mergedSurf.H" #include "PatchTools.H" -#include "ListListOps.H" +#include "globalIndex.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -140,20 +140,10 @@ bool Foam::mergedSurf::merge pointsMap_ ); - // Now handle zone/region information - List allZones(Pstream::nProcs()); - allZones[Pstream::myProcNo()] = originalIds; - Pstream::gatherList(allZones); - if (Pstream::master()) - { - zones_ = ListListOps::combine - ( - allZones, - accessOp() - ); - } - allZones.clear(); + // Now handle zone/region information + + globalIndex::gatherOp(originalIds, zones_); return true; }