From e8fa46230a8dd07979e012a271183bf55d2b24ae Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 5 Nov 2019 13:08:21 +0100 Subject: [PATCH] ENH: add min/max compare/reduction operators for Tuple2 first() - min/max ops that only compare the first element --- applications/test/Tuple2/Test-Tuple2.C | 38 +++++++++++ src/OpenFOAM/primitives/Tuple2/Tuple2.H | 84 ++++++++++++++++++++++++- 2 files changed, 120 insertions(+), 2 deletions(-) diff --git a/applications/test/Tuple2/Test-Tuple2.C b/applications/test/Tuple2/Test-Tuple2.C index 27b0fbf6d0..4f02359f03 100644 --- a/applications/test/Tuple2/Test-Tuple2.C +++ b/applications/test/Tuple2/Test-Tuple2.C @@ -39,6 +39,7 @@ Description #include "List.H" #include "ListOps.H" #include "ops.H" +#include "PstreamCombineReduceOps.H" #include using namespace Foam; @@ -121,6 +122,43 @@ int main() Info<< "Unsorted tuples:" << nl << list1 << nl; + // Test minFirst, maxFirst functors + { + indexedScalar minIndexed(labelMax, Zero); + indexedScalar maxIndexed(labelMin, Zero); + + for (const auto& item : list1) + { + minFirstEqOp