diff --git a/applications/utilities/postProcessing/postProcess/postProcess.C b/applications/utilities/postProcessing/postProcess/postProcess.C index 9741bd855f..7e3e8c3d05 100644 --- a/applications/utilities/postProcessing/postProcess/postProcess.C +++ b/applications/utilities/postProcessing/postProcess/postProcess.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -164,17 +164,22 @@ int main(int argc, char *argv[]) functionObjects::fileFieldSelection fields(mesh); if (args.found("fields")) { - fields.insert(args.getList("fields")); + fields.resetFieldFilters + ( + HashSet(args.getList("fields")) + ); } if (args.found("field")) { - fields.insert(args.opt("field")); + fields.resetFieldFilters(args.opt("field")); } // Externally stored dictionary for functionObjectList // if not constructed from runTime dictionary functionsDict; + HashSet fieldFilters(fields.filters()); + // Construct functionObjectList autoPtr functionsPtr ( @@ -183,7 +188,7 @@ int main(int argc, char *argv[]) args, runTime, functionsDict, - fields + fieldFilters // include any additional command-line fields ) ); @@ -193,8 +198,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << endl; - fields.updateSelection(); - if (mesh.readUpdate() != polyMesh::UNCHANGED) { // Update functionObjectList if mesh changes @@ -205,10 +208,14 @@ int main(int argc, char *argv[]) args, runTime, functionsDict, - fields + fieldFilters ); } + fields.resetFieldFilters(fieldFilters); + + fields.updateSelection(); + const bool throwingIOErr = FatalIOError.throwExceptions(); try @@ -218,7 +225,7 @@ int main(int argc, char *argv[]) args, runTime, mesh, - fields.selection(), + fields.selectionNames(), functionsPtr(), timei == timeDirs.size()-1 ); diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 612fedb177..8da391cc8d 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -458,6 +458,15 @@ Foam::autoPtr Foam::functionObjectList::New // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::label Foam::functionObjectList::triggerIndex() const +{ + label triggeri = labelMin; + stateDict().readIfPresent("triggerIndex", triggeri); + + return triggeri; +} + + void Foam::functionObjectList::resetState() { // Reset (re-read) the state dictionary diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H index 6be997b516..5cb135612f 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H @@ -174,6 +174,9 @@ public: //- Access to the functionObjects using PtrList::operator[]; + //- Return the current trigger index (read from the stateDict) + label triggerIndex() const; + //- Reset/read state dictionary for current time void resetState(); diff --git a/src/OpenFOAM/db/functionObjects/stateFunctionObject/stateFunctionObject.C b/src/OpenFOAM/db/functionObjects/stateFunctionObject/stateFunctionObject.C index 1bfe099f0a..b716f50af7 100644 --- a/src/OpenFOAM/db/functionObjects/stateFunctionObject/stateFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/stateFunctionObject/stateFunctionObject.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -78,6 +78,34 @@ Foam::dictionary& Foam::functionObjects::stateFunctionObject::propertyDict() } +bool Foam::functionObjects::stateFunctionObject::setTrigger +( + const label triggeri +) +{ + IOdictionary& stateDict = this->stateDict(); + + label oldTriggeri = + stateDict.lookupOrDefault