From 4ee65d12c4ae2999ee57165581d13a444c848e72 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 12 Jul 2019 18:00:00 +0200 Subject: [PATCH] ENH: HashTable and HashSet improvements - unfriend HashSet, HashTable IO operators - global min(), max(), minMax() functions taking a labelHashSet and an optional limit. For example, labelHashSet set = ...; Info<< "min is " << min(set) << nl; Info<< "max (non-negative) " << max(set, 0) << nl; - make HashTable iterator '->' dereferencing more consistent by also supporting non-pointer types as well. - read HashTable values in-situ to avoid copying --- applications/test/HashSet/Test-hashSet.C | 4 + .../test/HashTable2/Test-HashTable2.C | 14 +++- src/OpenFOAM/Make/files | 1 + .../containers/HashTables/HashSet/HashSet.H | 49 ++++++++----- .../HashTables/HashTable/HashTable.H | 54 +++++++------- .../HashTables/HashTable/HashTableIO.C | 73 +++++++++---------- 6 files changed, 107 insertions(+), 88 deletions(-) diff --git a/applications/test/HashSet/Test-hashSet.C b/applications/test/HashSet/Test-hashSet.C index 1f2f681cad..84b53bbc3c 100644 --- a/applications/test/HashSet/Test-hashSet.C +++ b/applications/test/HashSet/Test-hashSet.C @@ -32,6 +32,7 @@ Description #include "HashOps.H" #include "HashSet.H" #include "Map.H" +#include "MinMax.H" #include "labelPairHashes.H" #include "FlatOutput.H" @@ -184,6 +185,9 @@ int main(int argc, char *argv[]) 1, 11, 42 }; + Info<<"Set with min/max:" << minMax(setB) + << " min:" << min(setB) << " max:" << max(setB) << nl; + setB = FixedList({1, 2, 3, 4}); setB = {1, 2, 4}; setB = List