diff --git a/applications/test/HashSet/Test-hashSet.C b/applications/test/HashSet/Test-hashSet.C index 425320bc39..eeae7ff0d0 100644 --- a/applications/test/HashSet/Test-hashSet.C +++ b/applications/test/HashSet/Test-hashSet.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,13 +27,50 @@ Description #include "hashedWordList.H" #include "nil.H" +#include "HashOps.H" #include "HashSet.H" #include "Map.H" #include "labelPairHashes.H" #include "FlatOutput.H" +#include + using namespace Foam; +template +void printIf(const Iter& iter) +{ + if (iter.found()) + { + Info<< *iter; + } + else + { + Info<<"(null)"; + } +} + + +template +void printMinMax(const HashSet& set) +{ + const auto first = set.cbegin(); + const auto last = set.cend(); + + const auto min = std::min_element(first, last); + const auto max = std::max_element(first, last); + + Info<< "set: " << flatOutput(set) << nl; + Info<< " min="; + printIf(min); + Info<< nl; + + Info<< " max="; + printIf(max); + Info<< nl; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: @@ -131,9 +168,14 @@ int main(int argc, char *argv[]) Info<< "create from Map