From adcf41bd13e5d341807200e134ff122520045517 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 25 Nov 2021 15:41:32 +0100 Subject: [PATCH] ENH: add Function1 wrapping for functionObject trigger Returns a 0/1 value corresponding to function object trigger levels. Usage: \verbatim functionObjectTrigger; Coeffs { triggers (1 3 5); defaultValue false; // Default when no triggers activated } \endverbatim ENH: add reset() method for Constant Function1 ENH: allow forced change of trigger index - the triggers are normally increase only, but can now override this optionally --- .../functionObjectList/functionObjectList.C | 2 +- .../functionObjectProperties.C | 40 ++-- .../functionObjectProperties.H | 13 +- .../stateFunctionObject/stateFunctionObject.C | 17 +- .../stateFunctionObject/stateFunctionObject.H | 13 +- .../timeControl/timeControlFunctionObject.H | 9 +- .../functions/Function1/Constant/Constant.H | 3 + .../functions/Function1/Constant/ConstantI.H | 9 +- .../FunctionObjectTrigger.C | 106 +++++++++++ .../FunctionObjectTrigger.H | 178 ++++++++++++++++++ .../FunctionObjectTriggerI.H | 89 +++++++++ .../FunctionObjectValue/FunctionObjectValue.H | 8 +- .../functions/Function1/makeFunction1s.C | 5 + 13 files changed, 458 insertions(+), 34 deletions(-) create mode 100644 src/OpenFOAM/primitives/functions/Function1/FunctionObjectTrigger/FunctionObjectTrigger.C create mode 100644 src/OpenFOAM/primitives/functions/Function1/FunctionObjectTrigger/FunctionObjectTrigger.H create mode 100644 src/OpenFOAM/primitives/functions/Function1/FunctionObjectTrigger/FunctionObjectTriggerI.H diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 8aa4168d6d..6558b2543e 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -509,7 +509,7 @@ Foam::autoPtr Foam::functionObjectList::New Foam::label Foam::functionObjectList::triggerIndex() const { - return propsDict().getOrDefault