From a34357b1a639d32ceaee5d99c9551118f4a03524 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 4 May 2022 00:33:53 +0200 Subject: [PATCH] ENH: additional IndirectList static methods - uniq() : creates an IndirectList with duplicated entries filtered out - subset() : creates an IndirectList with positions that satisfy a condition predicate. - subset_if() : creates an IndirectList with values that satisfy a given predicate. An indirect subset will be cheaper than creating a subset copy of the original data, and also allows modification. STYLE: combine UIndirectList.H into UIndirectList.H (reduce file clutter) --- applications/test/ListOps/Test-ListOps.C | 4 + .../test/UIndirectList/Test-UIndirectList.C | 2 +- applications/test/minMax1/Test-minMax1.C | 4 +- applications/test/sort/Test-sortList.C | 16 ++- .../IndirectLists/IndirectList/IndirectList.H | 115 +++++++++++++++++- .../IndirectList/IndirectListI.H | 109 ++++++++++++++++- .../IndirectList/UIndirectList.H | 16 +++ .../IndirectListBase/IndirectListAddressing.H | 8 +- .../UIndirectList/UIndirectList.H | 108 ---------------- .../containers/Lists/ListOps/ListOps.H | 5 + .../meshes/meshShapes/cell/cellIndList.H | 5 +- .../meshes/meshShapes/cellShape/cellShapeI.H | 2 +- .../meshes/meshShapes/edge/edgeIndList.H | 5 +- .../meshes/meshShapes/face/faceIndList.H | 5 +- .../primitiveShapes/point/pointIndList.H | 5 +- .../primitives/Scalar/lists/scalarIndList.H | 5 +- .../primitives/Vector/lists/vectorIndList.H | 5 +- .../primitives/ints/lists/labelIndList.H | 3 +- .../primitives/strings/lists/stringListOps.H | 4 +- src/finiteArea/faMatrices/faMatrix/faMatrix.C | 2 +- .../faMesh/faMeshBoundaryHaloTemplates.C | 2 +- .../mappedFixedInternalValueFvPatchField.C | 2 +- ...ppedFixedPushedInternalValueFvPatchField.C | 2 +- .../fvMatrices/fvMatrix/fvMatrix.C | 2 +- .../utilities/areaWrite/areaWrite.C | 2 +- .../sampledSet/sampledSets/sampledSets.C | 2 +- .../sampledSurfaces/sampledSurfaces.C | 2 +- 27 files changed, 292 insertions(+), 150 deletions(-) create mode 100644 src/OpenFOAM/containers/IndirectLists/IndirectList/UIndirectList.H delete mode 100644 src/OpenFOAM/containers/IndirectLists/UIndirectList/UIndirectList.H diff --git a/applications/test/ListOps/Test-ListOps.C b/applications/test/ListOps/Test-ListOps.C index ea034e57b5..e3db28c7ff 100644 --- a/applications/test/ListOps/Test-ListOps.C +++ b/applications/test/ListOps/Test-ListOps.C @@ -151,6 +151,10 @@ int main(int argc, char *argv[]) << subsetList(test6, evenNonZero) << nl << endl; + Info<< "Subset of non-zero, even values: " + << IndirectList