ENH: rationalize some globalIndex gather routines

- replace gatherValues() with listGatherValues(), which returns the
  gathered values instead of passing by argument. This makes it less
  fragile and more convenient. Naming as per
  Pstream::listGatherValues(), but still retaining the original
  parameter order.

- rename inplace 'gather' variant as 'gatherInplace' for clarity.

- changed signature of lowest-level globalIndex::gather routines from
  List<Type> to UList<Type> for the output and removed any resizing.
  This means that the caller is responsible for ensuring that the
  receiving field is adequately sized (on master). This change allows
  potential reuse of 'work' arrays etc.

  The only code change for using this low-level gather was in
  GAMGAgglomeration.
This commit is contained in:
Mark Olesen
2025-02-06 18:45:39 +01:00
parent 3e8b0a2c73
commit 512ec01328
7 changed files with 364 additions and 290 deletions

View File

@ -238,8 +238,7 @@ void Foam::functionObjects::AMIWeights::writeWeightField
);
// Collect field
scalarField mergedWeights;
globalFaces().gather(weightSum, mergedWeights);
scalarField mergedWeights = globalFaces().gather(weightSum);
const bool isACMI = isA<cyclicACMIPolyPatch>(cpp);
@ -248,7 +247,7 @@ void Foam::functionObjects::AMIWeights::writeWeightField
{
const cyclicACMIPolyPatch& pp = refCast<const cyclicACMIPolyPatch>(cpp);
globalFaces().gather(pp.mask(), mergedMask);
mergedMask = globalFaces().gather(pp.mask());
}
if (Pstream::master())