diff --git a/applications/utilities/postProcessing/postProcess/postProcess.C b/applications/utilities/postProcessing/postProcess/postProcess.C index 44fe8a951c..335006d17c 100644 --- a/applications/utilities/postProcessing/postProcess/postProcess.C +++ b/applications/utilities/postProcessing/postProcess/postProcess.C @@ -129,6 +129,13 @@ int main(int argc, char *argv[]) #include "addFunctionObjectOptions.H" #include "setRootCase.H" + + if (args.optionFound("list")) + { + functionObjectList::list(); + return 0; + } + #include "createTime.H" Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args); #include "createNamedMesh.H" diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 9edd6a9953..a4d5340230 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -71,6 +71,37 @@ Foam::functionObject* Foam::functionObjectList::remove } +void Foam::functionObjectList::list() +{ + HashSet foMap; + + fileNameList etcDirs(findEtcDirs(functionObjectDictPath)); + + forAll(etcDirs, ed) + { + fileNameList foDirs(readDir(etcDirs[ed], fileName::DIRECTORY)); + forAll(foDirs, fd) + { + fileNameList foFiles(readDir(etcDirs[ed]/foDirs[fd])); + { + forAll(foFiles, f) + { + if (foFiles[f].ext().empty()) + { + foMap.insert(foFiles[f]); + } + } + } + } + } + + Info<< nl + << "Available configured functionObjects:" + << foMap.sortedToc() + << nl; +} + + Foam::fileName Foam::functionObjectList::findDict(const word& funcName) { // First check if there is a functionObject dictionary file in the diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H index 788b4b8884..10406c1038 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H @@ -167,6 +167,23 @@ 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 + // user/group/shipped directories. + // The search scheme allows for version-specific and + // version-independent files using the following hierarchy: + // - \b user settings: + // - ~/.OpenFOAM/\/caseDicts/postProcessing + // - ~/.OpenFOAM/caseDicts/postProcessing + // - \b group (site) settings (when $WM_PROJECT_SITE is set): + // - $WM_PROJECT_SITE/\/caseDicts/postProcessing + // - $WM_PROJECT_SITE/caseDicts/postProcessing + // - \b group (site) settings (when $WM_PROJECT_SITE is not set): + // - $WM_PROJECT_INST_DIR/site/\/caseDicts/postProcessing + // - $WM_PROJECT_INST_DIR/site/caseDicts/postProcessing + // - \b other (shipped) settings: + // - $WM_PROJECT_DIR/etc/caseDicts/postProcessing + static void list(); + //- Search for functionObject dictionary file in // user/group/shipped directories. // The search scheme allows for version-specific and diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H index 1660712961..d264ebf491 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H @@ -74,6 +74,13 @@ if (argList::postProcess(argc, argv)) #include "addFunctionObjectOptions.H" #include "setRootCase.H" + + if (args.optionFound("list")) + { + functionObjectList::list(); + return 0; + } + #include INCLUDE_FILE(CREATE_TIME) Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args); #include INCLUDE_FILE(CREATE_MESH) diff --git a/src/OpenFOAM/include/addFunctionObjectOptions.H b/src/OpenFOAM/include/addFunctionObjectOptions.H index cacca9d5fb..7747c16d4f 100644 --- a/src/OpenFOAM/include/addFunctionObjectOptions.H +++ b/src/OpenFOAM/include/addFunctionObjectOptions.H @@ -3,24 +3,29 @@ Foam::argList::addOption ( "field", "name", - "specify the name of the field to be processed, e.g. U" + "Specify the name of the field to be processed, e.g. U" ); Foam::argList::addOption ( "fields", "list", - "specify a list of fields to be processed, e.g. '(U T p)' - " + "Specify a list of fields to be processed, e.g. '(U T p)' - " "regular expressions not currently supported" ); Foam::argList::addOption ( "func", "name", - "specify the name of the functionObject to execute, e.g. Q" + "Specify the name of the functionObject to execute, e.g. Q" ); Foam::argList::addOption ( "funcs", "list", - "specify the names of the functionObjects to execute, e.g. '(Q div(U))'" + "Specify the names of the functionObjects to execute, e.g. '(Q div(U))'" +); +Foam::argList::addBoolOption +( + "list", + "List the available configured functionObjects" );