mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: change wordRes to be a List of wordRe instead of a wrapper (issue #259)
- this permits direct storage of a list with additional matcher capabilities - provide wordRes::matcher class for similar behaviour as previously
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -70,10 +70,8 @@ bool Foam::functionObjects::zeroGradient::checkFormatName(const word& str)
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -108,22 +106,15 @@ Foam::functionObjects::zeroGradient::zeroGradient
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::zeroGradient::~zeroGradient()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::zeroGradient::read(const dictionary& dict)
|
||||
{
|
||||
fvMeshFunctionObject::read(dict);
|
||||
|
||||
selectFields_ = wordRes::uniq
|
||||
(
|
||||
wordReList(dict.lookup("fields"))
|
||||
);
|
||||
dict.lookup("fields") >> selectFields_;
|
||||
selectFields_.uniq();
|
||||
|
||||
Info<< type() << " fields: " << selectFields_ << nl;
|
||||
|
||||
resultName_ = dict.lookupOrDefault<word>("result", type() + "(@@)");
|
||||
@ -139,10 +130,9 @@ bool Foam::functionObjects::zeroGradient::execute()
|
||||
DynamicList<word> missing(selectFields_.size());
|
||||
DynamicList<word> ignored(selectFields_.size());
|
||||
|
||||
// check exact matches first
|
||||
forAll(selectFields_, i)
|
||||
// Check exact matches first
|
||||
for (const wordRe& select : selectFields_)
|
||||
{
|
||||
const wordRe& select = selectFields_[i];
|
||||
if (!select.isPattern())
|
||||
{
|
||||
const word& fieldName = static_cast<const word&>(select);
|
||||
@ -158,9 +148,9 @@ bool Foam::functionObjects::zeroGradient::execute()
|
||||
}
|
||||
}
|
||||
|
||||
forAllConstIter(wordHashSet, candidates, iter)
|
||||
for (const word& fieldName : candidates)
|
||||
{
|
||||
process(iter.key());
|
||||
process(fieldName);
|
||||
}
|
||||
|
||||
if (missing.size())
|
||||
@ -187,10 +177,8 @@ bool Foam::functionObjects::zeroGradient::write()
|
||||
|
||||
// Consistent output order
|
||||
const wordList outputList = results_.sortedToc();
|
||||
forAll(outputList, i)
|
||||
for (const word& fieldName : outputList)
|
||||
{
|
||||
const word& fieldName = outputList[i];
|
||||
|
||||
if (foundObject<regIOobject>(fieldName))
|
||||
{
|
||||
const regIOobject& io = lookupObject<regIOobject>(fieldName);
|
||||
|
||||
Reference in New Issue
Block a user