diff --git a/applications/utilities/postProcessing/postProcess/postProcess.C b/applications/utilities/postProcessing/postProcess/postProcess.C index a557dbe14a..24127e7e32 100644 --- a/applications/utilities/postProcessing/postProcess/postProcess.C +++ b/applications/utilities/postProcessing/postProcess/postProcess.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -148,7 +148,10 @@ int main(int argc, char *argv[]) if (args.optionFound("list")) { - functionObjectList::list(); + Info<< nl + << "Available configured functionObjects:" + << functionObjectList::list() + << endl; return 0; } diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C index 8878dc618e..7529abd0c5 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -89,7 +89,7 @@ Foam::autoPtr Foam::functionObject::New FatalErrorInFunction << "Unknown function type " << functionType << nl << nl - << "Table of functionObjects is empty" << endl + << "Table of functionObjects is empty" << exit(FatalError); } @@ -102,7 +102,7 @@ Foam::autoPtr Foam::functionObject::New << "Unknown function type " << functionType << nl << nl << "Valid functions are : " << nl - << dictionaryConstructorTablePtr_->sortedToc() << endl + << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); } diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 2687448290..dd94984cac 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -99,7 +99,7 @@ void Foam::functionObjectList::listDir } -void Foam::functionObjectList::list() +Foam::wordList Foam::functionObjectList::list() { HashSet foMap; @@ -110,10 +110,7 @@ void Foam::functionObjectList::list() listDir(etcDirs[ed], foMap); } - Info<< nl - << "Available configured functionObjects:" - << foMap.sortedToc() - << nl; + return foMap.sortedToc(); } @@ -250,8 +247,12 @@ bool Foam::functionObjectList::readFunctionObject if (path == fileName::null) { - WarningInFunction - << "Cannot find functionObject file " << funcType << endl; + FatalIOErrorInFunction(functionsDict) + << "Cannot find functionObject configuration file " + << funcType << nl << nl + << "Available configured functionObjects:" + << list() + << exit(FatalIOError); return false; } @@ -759,7 +760,7 @@ bool Foam::functionObjectList::read() } const dictionary& dict = iter().dict(); - bool enabled = dict.lookupOrDefault("enabled", true); + const bool enabled = dict.lookupOrDefault("enabled", true); newDigs[nFunc] = dict.digest(); @@ -788,38 +789,21 @@ bool Foam::functionObjectList::read() { autoPtr foPtr; - FatalError.throwExceptions(); - FatalIOError.throwExceptions(); - try + if + ( + dict.found("writeControl") + || dict.found("outputControl") + ) { - if + foPtr.set ( - dict.found("writeControl") - || dict.found("outputControl") - ) - { - foPtr.set - ( - new functionObjects::timeControl(key, time_, dict) - ); - } - else - { - foPtr = functionObject::New(key, time_, dict); - } + new functionObjects::timeControl(key, time_, dict) + ); } - catch (Foam::IOerror& ioErr) + else { - Info<< ioErr << nl << endl; - ::exit(1); + foPtr = functionObject::New(key, time_, dict); } - catch (Foam::error& err) - { - WarningInFunction - << "Caught FatalError " << err << nl << endl; - } - FatalError.dontThrowExceptions(); - FatalIOError.dontThrowExceptions(); if (foPtr.valid()) { diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H index 7308e5c678..34f6e7d994 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -174,7 +174,7 @@ public: //- Find the ID of a given function object by name label findObjectID(const word& name) const; - //- Print a list of functionObject configuration files in + //- Return the list of functionObject configuration files in // user/group/shipped directories. // The search scheme allows for version-specific and // version-independent files using the following hierarchy: @@ -190,7 +190,7 @@ public: // - $WM_PROJECT_INST_DIR/site/etc/caseDicts/postProcessing // - \b other (shipped) settings: // - $WM_PROJECT_DIR/etc/caseDicts/postProcessing - static void list(); + static wordList list(); //- Search for functionObject dictionary file for given region // and if not present also search the case directory as well as the diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H index 325bf381dc..f13caaad1a 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -76,7 +76,10 @@ if (argList::postProcess(argc, argv)) if (args.optionFound("list")) { - functionObjectList::list(); + Info<< nl + << "Available configured functionObjects:" + << functionObjectList::list() + << endl; return 0; }