mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
functionObjectList::readFunctionObject: Added support for region specification
Now the postProcess utility '-region' option works correctly, e.g. for the chtMultiRegionSimpleFoam/heatExchanger case postProcess -region air -func "mag(U)" calculates 'mag(U)' for all the time steps in region 'air'.
This commit is contained in:
@ -151,7 +151,8 @@ bool Foam::functionObjectList::readFunctionObject
|
|||||||
(
|
(
|
||||||
const string& funcNameArgs,
|
const string& funcNameArgs,
|
||||||
dictionary& functionsDict,
|
dictionary& functionsDict,
|
||||||
HashSet<word>& requiredFields
|
HashSet<word>& requiredFields,
|
||||||
|
const word& region
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Parse the optional functionObject arguments:
|
// Parse the optional functionObject arguments:
|
||||||
@ -291,6 +292,12 @@ bool Foam::functionObjectList::readFunctionObject
|
|||||||
funcDict.set(entry::New(entryStream).ptr());
|
funcDict.set(entry::New(entryStream).ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Insert the region name if specified
|
||||||
|
if (region != word::null)
|
||||||
|
{
|
||||||
|
funcDict.set("region", region);
|
||||||
|
}
|
||||||
|
|
||||||
// Merge this functionObject dictionary into functionsDict
|
// Merge this functionObject dictionary into functionsDict
|
||||||
dictionary funcArgsDict;
|
dictionary funcArgsDict;
|
||||||
funcArgsDict.add(string::validate<word>(funcNameArgs), funcDict);
|
funcArgsDict.add(string::validate<word>(funcNameArgs), funcDict);
|
||||||
@ -352,6 +359,14 @@ Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
|
|||||||
|
|
||||||
dictionary& functionsDict = controlDict.subDict("functions");
|
dictionary& functionsDict = controlDict.subDict("functions");
|
||||||
|
|
||||||
|
word region = word::null;
|
||||||
|
|
||||||
|
// Set the region name if specified
|
||||||
|
if (args.optionFound("region"))
|
||||||
|
{
|
||||||
|
region = args["region"];
|
||||||
|
}
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
args.optionFound("dict")
|
args.optionFound("dict")
|
||||||
@ -377,7 +392,13 @@ Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
|
|||||||
|
|
||||||
if (args.optionFound("func"))
|
if (args.optionFound("func"))
|
||||||
{
|
{
|
||||||
readFunctionObject(args["func"], functionsDict, requiredFields);
|
readFunctionObject
|
||||||
|
(
|
||||||
|
args["func"],
|
||||||
|
functionsDict,
|
||||||
|
requiredFields,
|
||||||
|
region
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.optionFound("funcs"))
|
if (args.optionFound("funcs"))
|
||||||
@ -386,7 +407,13 @@ Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
|
|||||||
|
|
||||||
forAll(funcs, i)
|
forAll(funcs, i)
|
||||||
{
|
{
|
||||||
readFunctionObject(funcs[i], functionsDict, requiredFields);
|
readFunctionObject
|
||||||
|
(
|
||||||
|
funcs[i],
|
||||||
|
functionsDict,
|
||||||
|
requiredFields,
|
||||||
|
region
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -218,7 +218,8 @@ public:
|
|||||||
(
|
(
|
||||||
const string& funcNameArgs0,
|
const string& funcNameArgs0,
|
||||||
dictionary& functionsDict,
|
dictionary& functionsDict,
|
||||||
HashSet<word>& requiredFields
|
HashSet<word>& requiredFields,
|
||||||
|
const word& region = word::null
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Read and set the function objects if their data have changed
|
//- Read and set the function objects if their data have changed
|
||||||
|
|||||||
Reference in New Issue
Block a user