functionObjectList: Search for functions in multi-region cases in a more logical order
When operating on multi-region cases, function files are now searched for in the following order: - First the $FOAM_CASE/system/<region> directory is searched - Second the $FOAM_CASE/system directory is searched - Finally a search is done through the preconfigured functions in $WM_PROJECT_DIR/etc Previously, in a multi-region case, preconfigured objects were considered before those in the case's (non-region) system directory. This was considered counter-intuitive. Functions residing in the system directory should always take precedence, whether they are in the region subdirectory or not.
This commit is contained in:
@ -119,30 +119,49 @@ void Foam::functionObjectList::list()
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::functionObjectList::findRegionDict
|
||||
Foam::fileName Foam::functionObjectList::findDict
|
||||
(
|
||||
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"/region/funcName
|
||||
);
|
||||
// region system directory
|
||||
{
|
||||
const fileName dictFile
|
||||
(
|
||||
stringOps::expand("$FOAM_CASE")/"system"/region/funcName
|
||||
);
|
||||
|
||||
if (isFile(dictFile))
|
||||
{
|
||||
return dictFile;
|
||||
if (isFile(dictFile))
|
||||
{
|
||||
return dictFile;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
// Next, if the region is specified, check if there is a functionObject
|
||||
// dictionary file in the global system directory
|
||||
if (region != word::null)
|
||||
{
|
||||
fileNameList etcDirs(findEtcDirs(functionObjectDictPath));
|
||||
const fileName dictFile
|
||||
(
|
||||
stringOps::expand("$FOAM_CASE")/"system"/funcName
|
||||
);
|
||||
|
||||
if (isFile(dictFile))
|
||||
{
|
||||
return dictFile;
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, check etc directories
|
||||
{
|
||||
const fileNameList etcDirs(findEtcDirs(functionObjectDictPath));
|
||||
|
||||
forAll(etcDirs, i)
|
||||
{
|
||||
dictFile = search(funcName, etcDirs[i]);
|
||||
const fileName dictFile(search(funcName, etcDirs[i]));
|
||||
|
||||
if (!dictFile.empty())
|
||||
{
|
||||
return dictFile;
|
||||
@ -154,32 +173,6 @@ Foam::fileName Foam::functionObjectList::findRegionDict
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectList::checkUnsetEntries
|
||||
(
|
||||
const string& funcCall,
|
||||
|
||||
Reference in New Issue
Block a user