postProcess: Added '-list' option to list the available configured functionObjects
This commit is contained in:
@ -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"
|
||||
|
||||
@ -71,6 +71,37 @@ Foam::functionObject* Foam::functionObjectList::remove
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectList::list()
|
||||
{
|
||||
HashSet<word> 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
|
||||
|
||||
@ -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/\<VERSION\>/caseDicts/postProcessing
|
||||
// - ~/.OpenFOAM/caseDicts/postProcessing
|
||||
// - \b group (site) settings (when $WM_PROJECT_SITE is set):
|
||||
// - $WM_PROJECT_SITE/\<VERSION\>/caseDicts/postProcessing
|
||||
// - $WM_PROJECT_SITE/caseDicts/postProcessing
|
||||
// - \b group (site) settings (when $WM_PROJECT_SITE is not set):
|
||||
// - $WM_PROJECT_INST_DIR/site/\<VERSION\>/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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user