mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
functionObjectList::findDict: Added support for region-specific functionObject specification
e.g. postProcess -func sample -region bottomWater will now search for the system/bottomWater/sample dictionary before searching for system/sample so that the fields and type of sampling can optionally be specified differently for the particular region. Resolves feature request https://bugs.openfoam.org/view.php?id=2807
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,7 +28,6 @@ License
|
||||
#include "mapPolyMesh.H"
|
||||
#include "argList.H"
|
||||
#include "timeControlFunctionObject.H"
|
||||
//#include "IFstream.H"
|
||||
#include "dictionaryEntry.H"
|
||||
#include "stringOps.H"
|
||||
#include "Tuple2.H"
|
||||
@ -120,11 +119,18 @@ void Foam::functionObjectList::list()
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::functionObjectList::findDict(const word& funcName)
|
||||
Foam::fileName Foam::functionObjectList::findRegionDict
|
||||
(
|
||||
const word& funcName,
|
||||
const word& region
|
||||
)
|
||||
{
|
||||
// First check if there is a functionObject dictionary file in the
|
||||
// case system directory
|
||||
fileName dictFile = stringOps::expand("$FOAM_CASE")/"system"/funcName;
|
||||
fileName dictFile
|
||||
(
|
||||
stringOps::expand("$FOAM_CASE")/"system"/region/funcName
|
||||
);
|
||||
|
||||
if (isFile(dictFile))
|
||||
{
|
||||
@ -148,6 +154,32 @@ Foam::fileName Foam::functionObjectList::findDict(const word& funcName)
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::functionObjectList::findDict
|
||||
(
|
||||
const word& funcName,
|
||||
const word& region
|
||||
)
|
||||
{
|
||||
if (region == word::null)
|
||||
{
|
||||
return findRegionDict(funcName);
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName dictFile(findRegionDict(funcName, region));
|
||||
|
||||
if (dictFile != fileName::null)
|
||||
{
|
||||
return dictFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
return findRegionDict(funcName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjectList::readFunctionObject
|
||||
(
|
||||
const string& funcNameArgs,
|
||||
@ -239,7 +271,7 @@ bool Foam::functionObjectList::readFunctionObject
|
||||
}
|
||||
|
||||
// Search for the functionObject dictionary
|
||||
fileName path = findDict(funcName);
|
||||
fileName path = findDict(funcName, region);
|
||||
|
||||
if (path == fileName::null)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -188,7 +188,32 @@ public:
|
||||
// - $WM_PROJECT_DIR/etc/caseDicts/postProcessing
|
||||
static void list();
|
||||
|
||||
//- Search for functionObject dictionary file in
|
||||
//- Search for functionObject dictionary file for given region
|
||||
// and the 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
|
||||
//
|
||||
// \return The path of the functionObject dictionary file if found
|
||||
// otherwise null
|
||||
static fileName findRegionDict
|
||||
(
|
||||
const word& funcPath,
|
||||
const word& region = word::null
|
||||
);
|
||||
|
||||
//- Search for functionObject dictionary file for given region
|
||||
// and if not present also search the case directory as well as the
|
||||
// user/group/shipped directories.
|
||||
// The search scheme allows for version-specific and
|
||||
// version-independent files using the following hierarchy:
|
||||
@ -206,7 +231,11 @@ public:
|
||||
//
|
||||
// \return The path of the functionObject dictionary file if found
|
||||
// otherwise null
|
||||
static fileName findDict(const word& funcName);
|
||||
static fileName findDict
|
||||
(
|
||||
const word& funcName,
|
||||
const word& region = word::null
|
||||
);
|
||||
|
||||
//- Read the specified functionObject configuration dictionary parsing
|
||||
// the optional arguments included in the name 'funcNameArgs0',
|
||||
|
||||
Reference in New Issue
Block a user