mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: allow top-level definition of function object name scoping
- this refines commit c233961d45, which added prefix scoping.
Default is now off (v2106 behaviour).
The 'useNamePrefix' keyword can be specified on a per function basis
or at the top-level of "functions".
```
functions
{
errors warn;
useNamePrefix true;
func1
{
type ...;
useNamePrefix false;
}
func2
{
type ...;
// Uses current default for useNamePrefix
}
}
```
This commit is contained in:
@ -34,6 +34,7 @@ License
|
||||
#include "timeControlFunctionObject.H"
|
||||
#include "dictionaryEntry.H"
|
||||
#include "stringOps.H"
|
||||
#include "Switch.H"
|
||||
#include "Tuple2.H"
|
||||
#include "etcFiles.H"
|
||||
#include "IOdictionary.H"
|
||||
@ -1009,10 +1010,27 @@ bool Foam::functionObjectList::read()
|
||||
|
||||
if (!dEntry.isDict())
|
||||
{
|
||||
if (key != "errors" && key != "libs")
|
||||
// Handle or ignore some known/expected keywords
|
||||
|
||||
if (key == "useNamePrefix") // As per functionObject
|
||||
{
|
||||
Switch sw(dEntry.stream().peekFirst());
|
||||
if (sw.good())
|
||||
{
|
||||
functionObject::defaultUseNamePrefix = sw;
|
||||
}
|
||||
else
|
||||
{
|
||||
IOWarningInFunction(parentDict_)
|
||||
<< "Entry '" << key << "' is not a valid switch"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
else if (key != "errors" && key != "libs")
|
||||
{
|
||||
IOWarningInFunction(parentDict_)
|
||||
<< "Entry " << key << " is not a dictionary" << endl;
|
||||
<< "Entry '" << key << "' is not a dictionary"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user