functionObjectList: Improved flexibility of field argument parsing

Function object argument parsing now takes all "field", "fields" and
"objects" arguments and combines them into a single list of
fields/objects that the function should operate on. This means that the
following postProcess executions are now all equivalent and function as
expected:

    postProcess -func "
        flowRatePatch
        (
            name=outlet,
            phi,
            alphaRhoPhi.air,
            alphaRhoPhi.particles
        )"

    postProcess -func "
        flowRatePatch
        (
            name=outlet,
            fields=(phi alphaRhoPhi.air alphaRhoPhi.particles)
        )"

    postProcess -func "
        flowRatePatch
        (
            name=outlet,
            objects=(phi),
            alphaRhoPhi.air,
            field=alphaRhoPhi.particles
        )"

As are the following:

    postProcess -func "mag(U.air)"

    postProcess -func "mag(field=U.air)"
This commit is contained in:
Will Bainbridge
2020-04-07 12:43:49 +01:00
parent b7b678bceb
commit ad12d3a8c1
2 changed files with 119 additions and 72 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,6 +45,7 @@ SourceFiles
#include "SHA1Digest.H"
#include "HashTable.H"
#include "HashSet.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -104,6 +105,65 @@ class functionObjectList
);
// Private Classes
class wordOrDictName;
friend Istream& operator>>(Istream& is, wordOrDictName& w);
//- Class to facilitate reading of either a word or the name of a
// dictionary
class wordOrDictName
:
public word
{
public:
using word::word;
friend Istream& operator>>(Istream& is, wordOrDictName& w)
{
is >> static_cast<word&>(w);
token t(is);
if (t.isPunctuation() && t.pToken() == token::BEGIN_BLOCK)
{
is.putBack(t);
dictionary d(is);
}
else
{
is.putBack(t);
}
return is;
}
};
class wordOrDictNameList;
friend Istream& operator>>(Istream& is, wordOrDictNameList& l);
//- Class to facilitate reading of either a list of words or the names
// of a list of dictionaries
class wordOrDictNameList
:
public wordList
{
public:
using wordList::wordList;
friend Istream& operator>>(Istream& is, wordOrDictNameList& l)
{
static_cast<wordList&>(l) = wordList(List<wordOrDictName>(is));
return is;
}
};
public:
// Static Data Members