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:
parent
92c329a8a9
commit
16dd92b38e
@ -55,7 +55,7 @@ do
|
||||
|
||||
bitSet haveMeshOnProc;
|
||||
std::unique_ptr<faMeshSubset> subsetter;
|
||||
IOobjectList objects(0);
|
||||
IOobjectList objects;
|
||||
|
||||
refPtr<fileOperation> newHandler(fileOperation::NewUncollated());
|
||||
|
||||
|
@ -26,7 +26,7 @@ forAll(meshes, regioni)
|
||||
{
|
||||
const auto& mesh = meshes[regioni];
|
||||
|
||||
IOobjectList objects(0);
|
||||
IOobjectList objects;
|
||||
|
||||
if (doConvertFields && !timeDirs.empty())
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ Note
|
||||
#include "pointSet.H"
|
||||
#include "HashOps.H"
|
||||
#include "regionProperties.H"
|
||||
#include "stringListOps.H"
|
||||
#include "stringListOps.H" // For stringListOps::findMatching()
|
||||
|
||||
#include "Cloud.H"
|
||||
#include "readFields.H"
|
||||
@ -780,7 +780,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
IOobjectList objects(0);
|
||||
IOobjectList objects;
|
||||
|
||||
if (doConvertFields)
|
||||
{
|
||||
|
@ -80,7 +80,6 @@ Usage
|
||||
#include "IOobjectList.H"
|
||||
#include "IOPtrList.H"
|
||||
#include "volFields.H"
|
||||
#include "stringListOps.H"
|
||||
#include "timeSelector.H"
|
||||
|
||||
using namespace Foam;
|
||||
@ -189,7 +188,7 @@ labelList findMatches
|
||||
const HashTable<wordList>& shortcuts,
|
||||
const wordList& shortcutNames,
|
||||
const wordList& thisKeys,
|
||||
const keyType& key
|
||||
const wordRe& key
|
||||
)
|
||||
{
|
||||
labelList matches;
|
||||
@ -197,20 +196,20 @@ labelList findMatches
|
||||
if (key.isPattern())
|
||||
{
|
||||
// Wildcard match
|
||||
matches = findStrings(key, thisKeys);
|
||||
matches = wordRes::matching(key, thisKeys);
|
||||
}
|
||||
else if (shortcuts.size())
|
||||
{
|
||||
// See if patchGroups expand to valid thisKeys
|
||||
labelList indices = findStrings(key, shortcutNames);
|
||||
labelList indices = wordRes::matching(key, shortcutNames);
|
||||
|
||||
for (const label idx : indices)
|
||||
{
|
||||
const word& name = shortcutNames[idx];
|
||||
const wordList& keys = shortcuts[name];
|
||||
forAll(keys, j)
|
||||
for (const word& k : keys)
|
||||
{
|
||||
const label index = thisKeys.find(keys[j]);
|
||||
const label index = thisKeys.find(k);
|
||||
if (index != -1)
|
||||
{
|
||||
matches.append(index);
|
||||
|
@ -51,6 +51,7 @@ Description
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "processorPolyPatch.H"
|
||||
#include "ListListOps.H"
|
||||
#include "stringListOps.H" // For stringListOps::findMatching()
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "globalMeshData.H"
|
||||
#include "globalIndex.H"
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2014 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -294,7 +294,7 @@ bool Foam::searchableSurfaceModifiers::cut::modify
|
||||
// Find the surfaces to cut with
|
||||
for (const wordRe& cutterName : cutterNames_)
|
||||
{
|
||||
labelList geomIDs = findStrings(cutterName, geometry_.names());
|
||||
labelList geomIDs = wordRes::matching(cutterName, geometry_.names());
|
||||
|
||||
for (const label geomI : geomIDs)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -130,9 +130,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (const entry& e : regionsDict)
|
||||
{
|
||||
const keyType& regionName = e.keyword();
|
||||
const wordRe regionName(e.keyword());
|
||||
const dictionary& regionDict = e.dict();
|
||||
|
||||
labelList regionIDs
|
||||
(
|
||||
wordRes::matching(regionName, surf.regions())
|
||||
);
|
||||
|
||||
autoPtr<searchableSurfaceModifier> modifier
|
||||
(
|
||||
searchableSurfaceModifier::New
|
||||
@ -143,9 +148,6 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
labelList regionIDs =
|
||||
findStrings(regionName, surf.regions());
|
||||
|
||||
if (modifier().modify(regionIDs, surf))
|
||||
{
|
||||
changed = true;
|
||||
|
@ -56,7 +56,7 @@ Usage
|
||||
|
||||
#include "argList.H"
|
||||
#include "MeshedSurfaces.H"
|
||||
#include "stringListOps.H"
|
||||
#include "stringListOps.H" // For stringListOps::findMatching()
|
||||
#include "geometricSurfacePatch.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,7 +28,7 @@ License
|
||||
|
||||
#include "removeEntry.H"
|
||||
#include "dictionary.H"
|
||||
#include "stringListOps.H"
|
||||
#include "wordRes.H"
|
||||
#include "addToMemberFunctionSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -75,7 +75,7 @@ bool Foam::functionEntries::removeEntry::execute
|
||||
{
|
||||
// Remove by pattern
|
||||
const wordList dictKeys = parentDict.toc();
|
||||
const labelList indices = findStrings(key, dictKeys);
|
||||
const labelList indices = wordRes::matching(key, dictKeys);
|
||||
|
||||
for (const auto idx : indices)
|
||||
{
|
||||
|
@ -822,7 +822,7 @@ bool Foam::functionObjectList::execute
|
||||
{
|
||||
for (functionObject& funcObj : functions())
|
||||
{
|
||||
if (stringOps::match(functionNames, funcObj.name()))
|
||||
if (wordRes::match(functionNames, funcObj.name()))
|
||||
{
|
||||
// Probably do not need try/catch...
|
||||
|
||||
|
@ -46,11 +46,6 @@ SourceFiles
|
||||
#include "wordRes.H"
|
||||
#include "Pair.H"
|
||||
|
||||
// Historically included by objectRegistryTemplates (until NOV-2018),
|
||||
// but not used by objectRegistry directly.
|
||||
// Leave here for now to avoid a missing include in other bits of code.
|
||||
#include "stringListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
|
@ -42,8 +42,8 @@ static wordHashSet getAcceptableFunctionKeys
|
||||
const bool report = false
|
||||
)
|
||||
{
|
||||
wordHashSet acceptKeys(0);
|
||||
wordHashSet rejectKeys(0);
|
||||
wordHashSet acceptKeys;
|
||||
wordHashSet rejectKeys;
|
||||
|
||||
if (!dictPtr)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1476,7 +1476,7 @@ void Foam::argList::parse
|
||||
{
|
||||
labelList matched
|
||||
(
|
||||
findMatchingStrings(hostRoot.first(), hostMachine)
|
||||
wordRes::matching(hostRoot.first(), hostMachine)
|
||||
);
|
||||
for (const label matchi : matched)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -70,10 +70,10 @@ namespace stringOps
|
||||
//- Count the number of occurrences of the specified character
|
||||
std::string::size_type count(const std::string& s, const char c);
|
||||
|
||||
//- Return true if text matches one of the regular expressions.
|
||||
inline bool match(const UList<wordRe>& patterns, const std::string& text)
|
||||
//- True if text matches one of the selector expressions
|
||||
inline bool match(const UList<wordRe>& selectors, const std::string& text)
|
||||
{
|
||||
return wordRes::matcher(patterns)(text);
|
||||
return wordRes::match(selectors, text);
|
||||
}
|
||||
|
||||
//- Quote any meta-characters in given string
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -67,24 +67,13 @@ class wordRes
|
||||
(
|
||||
const UList<wordRe>& selectors,
|
||||
const std::string& text,
|
||||
const bool literal=false
|
||||
);
|
||||
|
||||
//- Smart match across entire list, returning the best match type.
|
||||
// Stops on the first literal match, or continues to examine
|
||||
// if a regex match occurs.
|
||||
// \return wordRe::LITERAL, wordRe::REGEX on match and
|
||||
// wordRe::UNKNOWN otherwise.
|
||||
inline static wordRe::compOption found_matched
|
||||
(
|
||||
const UList<wordRe>& selectors,
|
||||
const std::string& text
|
||||
const bool literal = false
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static Data / Methods
|
||||
// Static Methods
|
||||
|
||||
//- Return a null wordRes (reference to a nullObject).
|
||||
//- Behaves like a empty wordRes.
|
||||
@ -93,10 +82,6 @@ public:
|
||||
return NullObjectRef<wordRes>();
|
||||
}
|
||||
|
||||
//- Return a wordRes with duplicate entries filtered out.
|
||||
// No distinction made between literals and regular expressions.
|
||||
static wordRes uniq(const UList<wordRe>& input);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -108,6 +93,60 @@ public:
|
||||
~wordRes() = default;
|
||||
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Return a wordRes with duplicate entries filtered out.
|
||||
// No distinction made between literals and regular expressions.
|
||||
static wordRes uniq(const UList<wordRe>& input);
|
||||
|
||||
//- Test for a match
|
||||
inline static bool match
|
||||
(
|
||||
const UList<wordRe>& selectors,
|
||||
const std::string& text,
|
||||
bool literal = false
|
||||
);
|
||||
|
||||
//- Smart match across entire list, returning the best match type.
|
||||
// Stops on the first literal match, or continues to examine
|
||||
// if a regex match occurs.
|
||||
// \return wordRe::LITERAL, wordRe::REGEX on match and
|
||||
// wordRe::UNKNOWN otherwise.
|
||||
inline static wordRe::compOption matched
|
||||
(
|
||||
const UList<wordRe>& selectors,
|
||||
const std::string& text
|
||||
);
|
||||
|
||||
//- Determine the list indices for all matches.
|
||||
//
|
||||
// \return indices of the matches in the input list
|
||||
template<class StringType>
|
||||
inline static labelList matching
|
||||
(
|
||||
//! A single literal or pattern matcher
|
||||
const wordRe& select,
|
||||
//! List of string inputs to match against
|
||||
const UList<StringType>& input,
|
||||
//! Invert the matching logic
|
||||
const bool invert = false
|
||||
);
|
||||
|
||||
//- Determine the list indices for all matches.
|
||||
//
|
||||
// \return indices of the matches in the input list
|
||||
template<class StringType>
|
||||
inline static labelList matching
|
||||
(
|
||||
//! The list of matchers
|
||||
const UList<wordRe>& selectors,
|
||||
//! List of string inputs to match against
|
||||
const UList<StringType>& input,
|
||||
//! Invert the matching logic
|
||||
const bool invert = false
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Filter out duplicate entries (inplace).
|
||||
@ -128,16 +167,16 @@ public:
|
||||
// UNKNOWN otherwise.
|
||||
inline wordRe::compOption matched(const std::string& text) const;
|
||||
|
||||
//- Return list indices for all matches.
|
||||
//- Determine the list indices for all matches.
|
||||
//
|
||||
// \param input A list of string inputs to match against
|
||||
// \param invert invert the matching logic
|
||||
// \return indices of the matches in the input list
|
||||
template<class StringType>
|
||||
inline labelList matching
|
||||
(
|
||||
//! List of string inputs to match against
|
||||
const UList<StringType>& input,
|
||||
const bool invert=false
|
||||
//! Invert the matching logic
|
||||
const bool invert = false
|
||||
) const;
|
||||
|
||||
|
||||
@ -152,18 +191,19 @@ public:
|
||||
//- Functor wrapper of a list of wordRe for matching
|
||||
struct matcher
|
||||
{
|
||||
//- Construct with 'allow' matcher
|
||||
inline matcher(const UList<wordRe>& allow);
|
||||
//- Construct with \em select matcher(s)
|
||||
inline explicit matcher(const UList<wordRe>& selectors) noexcept;
|
||||
|
||||
//- Nothing defined
|
||||
//- No selectors defined
|
||||
inline bool empty() const noexcept;
|
||||
|
||||
//- True if text matches ANY of the entries.
|
||||
//- True if text matches ANY of the selectors.
|
||||
//- Always false if entries are empty.
|
||||
// Allows use as a predicate.
|
||||
inline bool operator()(const std::string& text) const;
|
||||
|
||||
private:
|
||||
const UList<wordRe>& allow_;
|
||||
const UList<wordRe>& select_;
|
||||
};
|
||||
|
||||
|
||||
@ -188,7 +228,7 @@ public:
|
||||
(
|
||||
const UList<wordRe>& allow,
|
||||
const UList<wordRe>& deny
|
||||
);
|
||||
) noexcept;
|
||||
|
||||
//- Nothing defined
|
||||
inline bool empty() const noexcept;
|
||||
|
@ -48,7 +48,27 @@ inline Foam::label Foam::wordRes::first_match
|
||||
}
|
||||
|
||||
|
||||
inline Foam::wordRe::compOption Foam::wordRes::found_matched
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::wordRes::match
|
||||
(
|
||||
const UList<wordRe>& selectors,
|
||||
const std::string& text,
|
||||
bool literal
|
||||
)
|
||||
{
|
||||
for (const wordRe& select : selectors)
|
||||
{
|
||||
if (select.match(text, literal))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::wordRe::compOption Foam::wordRes::matched
|
||||
(
|
||||
const UList<wordRe>& selectors,
|
||||
const std::string& text
|
||||
@ -80,36 +100,27 @@ inline Foam::wordRe::compOption Foam::wordRes::found_matched
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::wordRes::match(const std::string& text, bool literal) const
|
||||
{
|
||||
return (first_match(*this, text, literal) >= 0);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::wordRe::compOption
|
||||
Foam::wordRes::matched(const std::string& text) const
|
||||
{
|
||||
return found_matched(*this, text);
|
||||
}
|
||||
|
||||
|
||||
template<class StringType>
|
||||
inline Foam::labelList Foam::wordRes::matching
|
||||
(
|
||||
const wordRe& select,
|
||||
const UList<StringType>& input,
|
||||
const bool invert
|
||||
) const
|
||||
)
|
||||
{
|
||||
if (select.empty() && !invert)
|
||||
{
|
||||
return labelList();
|
||||
}
|
||||
|
||||
const label len = input.size();
|
||||
|
||||
labelList indices(len);
|
||||
|
||||
label count = 0;
|
||||
for (label i=0; i < len; ++i)
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
if (match(input[i]) ? !invert : invert)
|
||||
if (select.match(input[i]) ? !invert : invert)
|
||||
{
|
||||
indices[count] = i;
|
||||
++count;
|
||||
@ -121,11 +132,69 @@ inline Foam::labelList Foam::wordRes::matching
|
||||
}
|
||||
|
||||
|
||||
template<class StringType>
|
||||
inline Foam::labelList Foam::wordRes::matching
|
||||
(
|
||||
const UList<wordRe>& selectors,
|
||||
const UList<StringType>& input,
|
||||
const bool invert
|
||||
)
|
||||
{
|
||||
if (selectors.empty() && !invert)
|
||||
{
|
||||
return labelList();
|
||||
}
|
||||
|
||||
const label len = input.size();
|
||||
|
||||
labelList indices(len);
|
||||
|
||||
label count = 0;
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
if (wordRes::match(selectors, input[i]) ? !invert : invert)
|
||||
{
|
||||
indices[count] = i;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
indices.resize(count);
|
||||
|
||||
return indices;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::wordRes::match(const std::string& text, bool literal) const
|
||||
{
|
||||
return wordRes::match(*this, text, literal);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::wordRe::compOption
|
||||
Foam::wordRes::matched(const std::string& text) const
|
||||
{
|
||||
return wordRes::matched(*this, text);
|
||||
}
|
||||
|
||||
|
||||
template<class StringType>
|
||||
inline Foam::labelList Foam::wordRes::matching
|
||||
(
|
||||
const UList<StringType>& input,
|
||||
const bool invert
|
||||
) const
|
||||
{
|
||||
return wordRes::matching(*this, input, invert);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::wordRes::operator()(const std::string& text) const
|
||||
{
|
||||
return (wordRes::first_match(*this, text) >= 0);
|
||||
return wordRes::match(*this, text);
|
||||
}
|
||||
|
||||
|
||||
@ -133,10 +202,10 @@ inline bool Foam::wordRes::operator()(const std::string& text) const
|
||||
|
||||
inline Foam::wordRes::matcher::matcher
|
||||
(
|
||||
const UList<wordRe>& allow
|
||||
)
|
||||
const UList<wordRe>& selectors
|
||||
) noexcept
|
||||
:
|
||||
allow_(allow)
|
||||
select_(selectors)
|
||||
{}
|
||||
|
||||
|
||||
@ -144,7 +213,7 @@ inline Foam::wordRes::filter::filter
|
||||
(
|
||||
const UList<wordRe>& allow,
|
||||
const UList<wordRe>& deny
|
||||
)
|
||||
) noexcept
|
||||
:
|
||||
allow_(allow),
|
||||
deny_(deny)
|
||||
@ -153,7 +222,7 @@ inline Foam::wordRes::filter::filter
|
||||
|
||||
inline bool Foam::wordRes::matcher::empty() const noexcept
|
||||
{
|
||||
return allow_.empty();
|
||||
return select_.empty();
|
||||
}
|
||||
|
||||
inline bool Foam::wordRes::filter::empty() const noexcept
|
||||
@ -164,7 +233,7 @@ inline bool Foam::wordRes::filter::empty() const noexcept
|
||||
|
||||
inline bool Foam::wordRes::matcher::operator()(const std::string& text) const
|
||||
{
|
||||
return (wordRes::first_match(allow_, text) >= 0);
|
||||
return wordRes::match(select_, text);
|
||||
}
|
||||
|
||||
|
||||
@ -173,17 +242,17 @@ inline bool Foam::wordRes::filter::operator()(const std::string& text) const
|
||||
if (allow_.empty())
|
||||
{
|
||||
// No allow specified, so accept everything that is NOT blocked
|
||||
return (deny_.empty() || (wordRes::first_match(deny_, text) < 0));
|
||||
return (deny_.empty() || !wordRes::match(deny_, text));
|
||||
}
|
||||
else if (deny_.empty())
|
||||
{
|
||||
// Nothing blocked, apply accept filter
|
||||
return (wordRes::first_match(allow_, text) >= 0);
|
||||
return wordRes::match(allow_, text);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Both accept and deny filters, need to search more carefully
|
||||
const auto result = wordRes::found_matched(allow_, text);
|
||||
const auto result = wordRes::matched(allow_, text);
|
||||
|
||||
return
|
||||
(
|
||||
@ -192,7 +261,7 @@ inline bool Foam::wordRes::filter::operator()(const std::string& text) const
|
||||
:
|
||||
(
|
||||
result == wordRe::REGEX
|
||||
&& (wordRes::first_match(deny_, text) < 0)
|
||||
&& !wordRes::match(deny_, text)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ License
|
||||
#include "polyMesh.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "processorPolyPatch.H"
|
||||
#include "stringListOps.H" // For stringListOps::findMatching()
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -136,7 +136,7 @@ bool Foam::functionObjects::fieldSelection::resetFieldFilters
|
||||
|
||||
bool Foam::functionObjects::fieldSelection::read(const dictionary& dict)
|
||||
{
|
||||
HashSet<wordRe> fields(0);
|
||||
HashSet<wordRe> fields;
|
||||
dict.readEntry("fields", fields);
|
||||
|
||||
return resetFieldFilters(fields);
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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())
|
||||
{
|
||||
|
@ -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())
|
||||
{
|
||||
|
@ -27,6 +27,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ParticleErosion.H"
|
||||
#include "wordRes.H"
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
@ -110,15 +111,15 @@ Foam::ParticleErosion<CloudType>::ParticleErosion
|
||||
);
|
||||
|
||||
labelHashSet uniqIds;
|
||||
for (const wordRe& re : patchNames)
|
||||
for (const wordRe& select : patchNames)
|
||||
{
|
||||
labelList ids = findMatchingStrings(re, allPatchNames);
|
||||
labelList ids = wordRes::matching(select, allPatchNames);
|
||||
|
||||
if (ids.empty())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot find any patch names matching " << re
|
||||
<< endl;
|
||||
<< "Cannot find any patch names matching "
|
||||
<< select << nl;
|
||||
}
|
||||
|
||||
uniqIds.insert(ids);
|
||||
|
@ -27,7 +27,6 @@ License
|
||||
|
||||
#include "ParticleHistogram.H"
|
||||
#include "Pstream.H"
|
||||
#include "stringListOps.H"
|
||||
#include "ListOps.H"
|
||||
#include "ListListOps.H"
|
||||
|
||||
|
@ -28,7 +28,6 @@ License
|
||||
|
||||
#include "ParticlePostProcessing.H"
|
||||
#include "Pstream.H"
|
||||
#include "stringListOps.H"
|
||||
#include "ListOps.H"
|
||||
#include "ListListOps.H"
|
||||
|
||||
|
@ -28,7 +28,6 @@ License
|
||||
|
||||
#include "PatchCollisionDensity.H"
|
||||
#include "Pstream.H"
|
||||
#include "stringListOps.H"
|
||||
#include "ListOps.H"
|
||||
#include "ListListOps.H"
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -106,7 +106,7 @@ Foam::label Foam::triSurfaceLoader::select(const word& name)
|
||||
if (available_.found(name))
|
||||
{
|
||||
selected_.resize(1);
|
||||
selected_.first() = name;
|
||||
selected_.front() = name;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -121,14 +121,14 @@ Foam::label Foam::triSurfaceLoader::select(const wordRe& mat)
|
||||
{
|
||||
if (mat.isPattern())
|
||||
{
|
||||
labelList foundIds = findStrings(mat, available_);
|
||||
labelList foundIds = wordRes::matching(mat, available_);
|
||||
Foam::sort(foundIds);
|
||||
selected_ = wordList(available_, foundIds);
|
||||
}
|
||||
else if (available_.found(static_cast<const word&>(mat)))
|
||||
{
|
||||
selected_.resize(1);
|
||||
selected_.first() = mat;
|
||||
selected_.front() = mat;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -162,7 +162,7 @@ Foam::label Foam::triSurfaceLoader::select(const UList<wordRe>& matcher)
|
||||
{
|
||||
if (mat.isPattern())
|
||||
{
|
||||
labelList indices = findStrings(mat, available_);
|
||||
labelList indices = wordRes::matching(mat, available_);
|
||||
Foam::sort(indices);
|
||||
|
||||
for (const label idx : indices)
|
||||
|
@ -35,7 +35,6 @@ License
|
||||
#include "surfaceInterpolate.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "stringListOps.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -174,7 +174,7 @@ Foam::IOobjectList Foam::sampledSets::preCheckFields(unsigned request)
|
||||
wordList allFields; // Just needed for warnings
|
||||
HashTable<wordHashSet> selected;
|
||||
|
||||
IOobjectList objects(0);
|
||||
IOobjectList objects;
|
||||
|
||||
if (loadFromFiles_)
|
||||
{
|
||||
|
@ -34,6 +34,7 @@ License
|
||||
#include "treeDataFace.H"
|
||||
#include "meshTools.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "stringListOps.H" // For stringListOps::findMatching()
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -75,7 +75,7 @@ Foam::IOobjectList Foam::sampledSurfaces::preCheckFields()
|
||||
wordList allFields; // Just needed for warnings
|
||||
HashTable<wordHashSet> selected;
|
||||
|
||||
IOobjectList objects(0);
|
||||
IOobjectList objects;
|
||||
|
||||
if (loadFromFiles_)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,7 +30,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "ListOps.H"
|
||||
#include "surfMesh.H"
|
||||
#include "stringListOps.H"
|
||||
#include "stringListOps.H" // For stringListOps::findMatching()
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,6 +31,7 @@ License
|
||||
#include "surfZoneList.H"
|
||||
#include "MeshedSurface.H"
|
||||
#include "ListOps.H"
|
||||
#include "stringListOps.H" // For stringListOps::findMatching()
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user