mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +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:
@ -71,10 +71,8 @@ bool Foam::functionObjects::ddt2::checkFormatName(const word& str)
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -116,18 +114,12 @@ Foam::functionObjects::ddt2::ddt2
|
||||
resultName_(word::null),
|
||||
blacklist_(),
|
||||
results_(),
|
||||
mag_(dict.lookupOrDefault<Switch>("mag", false))
|
||||
mag_(dict.lookupOrDefault("mag", false))
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::ddt2::~ddt2()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::ddt2::read(const dictionary& dict)
|
||||
@ -142,10 +134,9 @@ bool Foam::functionObjects::ddt2::read(const dictionary& dict)
|
||||
return false;
|
||||
}
|
||||
|
||||
selectFields_ = wordRes::uniq
|
||||
(
|
||||
wordReList(dict.lookup("fields"))
|
||||
);
|
||||
dict.lookup("fields") >> selectFields_;
|
||||
selectFields_.uniq();
|
||||
|
||||
Info<< type() << " fields: " << selectFields_ << nl;
|
||||
|
||||
resultName_ = dict.lookupOrDefault<word>
|
||||
@ -166,11 +157,9 @@ bool Foam::functionObjects::ddt2::read(const dictionary& dict)
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
blacklist_.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
blacklist_.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -182,10 +171,9 @@ bool Foam::functionObjects::ddt2::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);
|
||||
@ -201,9 +189,9 @@ bool Foam::functionObjects::ddt2::execute()
|
||||
}
|
||||
}
|
||||
|
||||
forAllConstIter(wordHashSet, candidates, iter)
|
||||
for (const word& fieldName : candidates)
|
||||
{
|
||||
process(iter.key());
|
||||
process(fieldName);
|
||||
}
|
||||
|
||||
if (missing.size())
|
||||
@ -230,10 +218,8 @@ bool Foam::functionObjects::ddt2::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);
|
||||
|
||||
@ -79,10 +79,9 @@ SourceFiles
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "OFstream.H"
|
||||
#include "wordReList.H"
|
||||
#include "regExp.H"
|
||||
#include "HashSet.H"
|
||||
#include "Switch.H"
|
||||
#include "wordRes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -102,7 +101,7 @@ class ddt2
|
||||
// Private data
|
||||
|
||||
//- Name of fields to process
|
||||
wordReList selectFields_;
|
||||
wordRes selectFields_;
|
||||
|
||||
//- Formatting for the result fields.
|
||||
word resultName_;
|
||||
@ -116,13 +115,13 @@ class ddt2
|
||||
//- Use 'mag' instead of 'magSqr'.
|
||||
// Cannot be adjusted during the simulation since it alters the
|
||||
// dimensions of the output field.
|
||||
const Switch mag_;
|
||||
const bool mag_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Check that the word contains the appropriate substitution token(s).
|
||||
static bool checkFormatName(const word&);
|
||||
static bool checkFormatName(const word& str);
|
||||
|
||||
|
||||
//- Accept unless field name appears to have already been processed
|
||||
@ -161,7 +160,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~ddt2();
|
||||
virtual ~ddt2() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -135,8 +135,9 @@ Foam::heatTransferCoeffModel::heatTransferCoeffModel
|
||||
|
||||
bool Foam::heatTransferCoeffModel::read(const dictionary& dict)
|
||||
{
|
||||
const wordReList patchNames(dict.lookup("patches"));
|
||||
patchSet_ = mesh_.boundaryMesh().patchSet(patchNames);
|
||||
patchSet_ =
|
||||
mesh_.boundaryMesh().patchSet(wordReList(dict.lookup("patches")));
|
||||
|
||||
dict.readIfPresent("qr", qrName_);
|
||||
|
||||
return true;
|
||||
|
||||
@ -156,12 +156,6 @@ Foam::functionObjects::mapFields::mapFields
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::mapFields::~mapFields()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::mapFields::read(const dictionary& dict)
|
||||
|
||||
@ -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
|
||||
@ -98,7 +98,7 @@ class mapFields
|
||||
autoPtr<meshToMesh> interpPtr_;
|
||||
|
||||
//- List of field names to interpolate
|
||||
wordReList fieldNames_;
|
||||
wordRes fieldNames_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -142,7 +142,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~mapFields();
|
||||
virtual ~mapFields() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -144,7 +144,7 @@ SourceFiles
|
||||
#include "writer.H"
|
||||
#include "Map.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "wordReList.H"
|
||||
#include "wordRes.H"
|
||||
#include "coordinateSystem.H"
|
||||
#include "Switch.H"
|
||||
|
||||
@ -174,7 +174,7 @@ class regionSizeDistribution
|
||||
word alphaName_;
|
||||
|
||||
//- Patches to walk from
|
||||
wordReList patchNames_;
|
||||
wordRes patchNames_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
@ -192,7 +192,7 @@ class regionSizeDistribution
|
||||
label nBins_;
|
||||
|
||||
//- Names of fields to sample on regions
|
||||
wordReList fields_;
|
||||
wordRes fields_;
|
||||
|
||||
//- Output formatter to write
|
||||
autoPtr<writer<scalar>> formatterPtr_;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
@ -76,7 +76,7 @@ SourceFiles
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "OFstream.H"
|
||||
#include "wordReList.H"
|
||||
#include "wordRes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -96,7 +96,7 @@ class zeroGradient
|
||||
// Private data
|
||||
|
||||
//- Name of fields to process
|
||||
wordReList selectFields_;
|
||||
wordRes selectFields_;
|
||||
|
||||
//- Formatting for the result fields.
|
||||
word resultName_;
|
||||
@ -108,7 +108,7 @@ class zeroGradient
|
||||
// Private Member Functions
|
||||
|
||||
//- Check that the word contains the appropriate substitution token(s).
|
||||
static bool checkFormatName(const word&);
|
||||
static bool checkFormatName(const word& str);
|
||||
|
||||
|
||||
//- Accept unless field only has constraint patches
|
||||
@ -151,7 +151,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~zeroGradient();
|
||||
virtual ~zeroGradient() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
Reference in New Issue
Block a user