mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add simplified gather methods for globalIndex with default communicator
- when combining lists in processor order this simplifies code and
reduces memory overhead.
Write this:
----
labelList collected;
const globalIndex sizing(input.size());
sizing.gather(input, collected);
----
OR
----
labelList collected;
globalIndex::gatherOp(input, collected);
----
Instead of this:
----
labelList collected;
List<labelList> scratch(Pstream::nProcs());
scratch[Pstream::myProcNo()] = input;
Pstream::gatherList(scratch);
if (Pstream::master())
{
collected = ListListOps::combine<labelList>
(
scratch,
accessOp<labelList>()
);
}
scratch.clear();
----
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -237,17 +237,7 @@ void Foam::functionObjects::AMIWeights::writeWeightField
|
||||
|
||||
// Collect field
|
||||
scalarField mergedWeights;
|
||||
globalFaces().gather
|
||||
(
|
||||
UPstream::worldComm,
|
||||
ListOps::create<label>
|
||||
(
|
||||
UPstream::procID(UPstream::worldComm),
|
||||
labelOp<int>() // int -> label
|
||||
),
|
||||
weightSum,
|
||||
mergedWeights
|
||||
);
|
||||
globalFaces().gather(weightSum, mergedWeights);
|
||||
|
||||
const bool isACMI = isA<cyclicACMIPolyPatch>(cpp);
|
||||
|
||||
@ -256,17 +246,7 @@ void Foam::functionObjects::AMIWeights::writeWeightField
|
||||
{
|
||||
const cyclicACMIPolyPatch& pp = refCast<const cyclicACMIPolyPatch>(cpp);
|
||||
|
||||
globalFaces().gather
|
||||
(
|
||||
UPstream::worldComm,
|
||||
ListOps::create<label>
|
||||
(
|
||||
UPstream::procID(UPstream::worldComm),
|
||||
labelOp<int>() // int -> label
|
||||
),
|
||||
pp.mask(),
|
||||
mergedMask
|
||||
);
|
||||
globalFaces().gather(pp.mask(), mergedMask);
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
|
||||
Reference in New Issue
Block a user