functionObjectList: Improved flexibility of field argument parsing
Additional flexibility for handling of field arguments has been extended
to dictionary lists of field settings, as well as word lists of field
names. This means that the following syntax is now supported:
postProcess -func "fieldAverage(p, U { prime2Mean on; }, T)"
postProcess -func "fieldAverage(fields=(p U { prime2Mean on; } T))"
This commit is contained in:
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "fieldAverageItem.H"
|
||||
#include "fieldAverage.H"
|
||||
#include "wordAndDictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -46,25 +47,13 @@ Foam::functionObjects::fieldAverageItem::fieldAverageItem
|
||||
"(Foam::Istream&, Foam::functionObjects::fieldAverageItem&)"
|
||||
);
|
||||
|
||||
token fieldNameToken(is);
|
||||
fieldName_ = fieldNameToken.wordToken();
|
||||
wordAndDictionary wd(is);
|
||||
|
||||
token nextToken(is);
|
||||
is.putBack(nextToken);
|
||||
fieldName_ = wd.first();
|
||||
|
||||
if (nextToken.isPunctuation() && nextToken.pToken() == token::BEGIN_BLOCK)
|
||||
{
|
||||
const dictionary entry(dictionary::null, is);
|
||||
|
||||
mean_ = entry.lookupOrDefault<Switch>("mean", fa.mean_);
|
||||
prime2Mean_ =
|
||||
entry.lookupOrDefault<Switch>("prime2Mean", fa.prime2Mean_);
|
||||
}
|
||||
else
|
||||
{
|
||||
mean_ = fa.mean_;
|
||||
prime2Mean_ = fa.prime2Mean_;
|
||||
}
|
||||
mean_ = wd.second().lookupOrDefault<Switch>("mean", fa.mean_);
|
||||
prime2Mean_ =
|
||||
wd.second().lookupOrDefault<Switch>("prime2Mean", fa.prime2Mean_);
|
||||
|
||||
meanFieldName_ = IOobject::groupName
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user