ENH: reduce reliance on stringListOps functions

- findStrings, findMatchingStrings now mostly covered by matching
  intrinsics in wordRe and wordRes.

  Add static wordRes match() and matching() variants

COMP: remove stringListOps include from objectRegistry.H

- was already noted for removal (NOV-2018)
This commit is contained in:
Mark Olesen
2024-04-12 21:03:27 +02:00
parent 92c329a8a9
commit 16dd92b38e
36 changed files with 239 additions and 124 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,7 +27,6 @@ License
#include "ddt2.H"
#include "stringOps.H"
#include "stringListOps.H"
#include "volFields.H"
#include "dictionary.H"
#include "wordRes.H"
@ -173,7 +172,11 @@ bool Foam::functionObjects::ddt2::execute()
{
results_.clear();
wordHashSet candidates(subsetStrings(selectFields_, mesh_.names()));
wordHashSet candidates
(
mesh_.names(selectFields_)
);
DynamicList<word> missing(selectFields_.size());
DynamicList<word> ignored(selectFields_.size());

View File

@ -581,7 +581,10 @@ bool Foam::functionObjects::externalCoupled::read(const dictionary& dict)
const wordRe regionGroupName(dEntry.keyword());
const dictionary& regionDict = dEntry.dict();
labelList regionIDs = findStrings(regionGroupName, allRegionNames);
labelList regionIDs
(
wordRes::matching(regionGroupName, allRegionNames)
);
const wordList regionNames(allRegionNames, regionIDs);

View File

@ -146,7 +146,7 @@ bool Foam::functionObjects::wallHeatFlux::read(const dictionary& dict)
dict.readIfPresent("qr", qrName_);
wordRes patchNames;
labelHashSet patchSet(0);
labelHashSet patchSet;
if (dict.readIfPresent("patches", patchNames) && !patchNames.empty())
{
patchSet = pbm.patchSet(patchNames);

View File

@ -131,7 +131,7 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
wordRes patchNames;
labelHashSet patchSet(0);
labelHashSet patchSet;
if (dict.readIfPresent("patches", patchNames) && !patchNames.empty())
{
patchSet = pbm.patchSet(patchNames);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/
#include "zeroGradient.H"
#include "stringListOps.H"
#include "volFields.H"
#include "dictionary.H"
#include "wordRes.H"
@ -135,7 +134,11 @@ bool Foam::functionObjects::zeroGradient::execute()
{
results_.clear();
wordHashSet candidates(subsetStrings(selectFields_, mesh_.names()));
wordHashSet candidates
(
mesh_.names(selectFields_)
);
DynamicList<word> missing(selectFields_.size());
DynamicList<word> ignored(selectFields_.size());

View File

@ -244,7 +244,7 @@ bool Foam::functionObjects::ensightWrite::write()
// Output fields MUST be specified to avoid accidentally
// writing everything. Can still use ".*" for everything
wordHashSet candidateNames(0);
wordHashSet candidateNames;
if (!selectFields_.empty())
{

View File

@ -29,7 +29,7 @@ License
#include "dictionary.H"
#include "Time.H"
#include "areaFields.H"
#include "stringListOps.H"
#include "stringListOps.H" // For stringListOps::foundOp()
#include "foamVtkInternalWriter.H"
#include "foamVtkPatchWriter.H"
#include "foamVtkSeriesWriter.H"
@ -304,7 +304,7 @@ bool Foam::functionObjects::vtkWrite::write()
// Output fields MUST be specified to avoid accidentally
// writing everything. Can still use ".*" for everything
wordHashSet candidateNames(0);
wordHashSet candidateNames;
if (!selectFields_.empty())
{