From 87523acad384365d752ae9c22586b0f0332776b5 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 25 Jan 2019 11:45:03 +0100 Subject: [PATCH] ENH: add ListOps find/found accepting a unary predicate (#1182) - can also be used for other purposes. Eg, if (ListOps::found(list, matcher)) { ... } vs. if (!findStrings(matcher, list).empty()) { ... } --- applications/test/ListOps/Test-ListOps.C | 46 +++++++++++++------ .../test/stringList/Test-stringList.C | 11 ++++- .../containers/Lists/ListOps/ListOps.H | 26 +++++++++++ .../Lists/ListOps/ListOpsTemplates.C | 37 +++++++++++++++ .../primitives/ranges/MinMax/MinMax.H | 1 + .../trackingInverseDistance/voxelMeshSearch.C | 4 +- .../sampledSets/sampledSetsGrouping.C | 4 +- .../sampledSurfaces/sampledSurfacesGrouping.C | 4 +- .../surface/isoSurface/isoSurfaceTopo.C | 2 +- 9 files changed, 114 insertions(+), 21 deletions(-) diff --git a/applications/test/ListOps/Test-ListOps.C b/applications/test/ListOps/Test-ListOps.C index 64322bdf29..1f30b58530 100644 --- a/applications/test/ListOps/Test-ListOps.C +++ b/applications/test/ListOps/Test-ListOps.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,6 +32,8 @@ Description #include "List.H" #include "SubList.H" #include "ListOps.H" +#include "labelField.H" +#include "MinMax.H" #include "face.H" using namespace Foam; @@ -113,23 +115,41 @@ int main(int argc, char *argv[]) Info<< nl << "Test lambda predicates:" << nl << endl; - List