functionObjects::writeObjects: Added option to disable regular expressions

When selecting fields with complex automatically generated names it is
cumbersome to escape all the regular expression meta characters and more
convenient to specify the name as a literal string, the new regExp option
provides the ability to switch the regular expression support and defaults to
true for backward compatibility.

For example to cache and write out an intermediate temporary field generated by
the kOmegaSST model:

cacheTemporaryObjects
(
    "((interpolate(((1|((1|(1|A(U)))-H(1)))-(1|A(U))))*snGrad(p))*magSf)"
);

functions
{
    #includeFunc writeObjects(regExp=off, "((interpolate(((1|((1|(1|A(U)))-H(1)))-(1|A(U))))*snGrad(p))*magSf)")
}

The regExp option can also be specified in a writeObjects dict as

    regExp  off;

Additionally regular expression support has been added to the includeFunc
argument parsing.
This commit is contained in:
Henry Weller
2019-12-25 11:04:31 +00:00
parent 5a29562180
commit bae37a52a6
4 changed files with 24 additions and 6 deletions

View File

@ -229,7 +229,7 @@ bool Foam::functionObjectList::readFunctionObject
word funcName(funcCall);
int argLevel = 0;
wordList args;
wordReList args;
List<Tuple2<word, string>> namedArgs;
bool namedArg = false;
@ -274,10 +274,7 @@ bool Foam::functionObjectList::readFunctionObject
}
else
{
args.append
(
string::validate<word>(funcCall(start, i - start))
);
args.append(wordRe(funcCall(start, i - start)));
}
start = i+1;
}