mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: deprecate hashedWordList contains() method
- identical to found(), which should be used for more consistency. The contains() is a remnant from when hashedWordList was generalized from a speciesTable (OCT 2010)
This commit is contained in:
@ -89,7 +89,7 @@ Foam::interfaceCompositionModels::Henry<Thermo, OtherThermo>::Yf
|
|||||||
const volScalarField& Tf
|
const volScalarField& Tf
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (this->speciesNames_.contains(speciesName))
|
if (this->speciesNames_.found(speciesName))
|
||||||
{
|
{
|
||||||
const label index = this->speciesNames_[speciesName];
|
const label index = this->speciesNames_[speciesName];
|
||||||
|
|
||||||
|
|||||||
@ -121,7 +121,7 @@ Foam::interfaceCompositionModels::Raoult<Thermo, OtherThermo>::Yf
|
|||||||
const volScalarField& Tf
|
const volScalarField& Tf
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (this->speciesNames_.contains(speciesName))
|
if (this->speciesNames_.found(speciesName))
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
this->otherThermo_.composition().Y(speciesName)
|
this->otherThermo_.composition().Y(speciesName)
|
||||||
@ -144,7 +144,7 @@ Foam::interfaceCompositionModels::Raoult<Thermo, OtherThermo>::YfPrime
|
|||||||
const volScalarField& Tf
|
const volScalarField& Tf
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (this->speciesNames_.contains(speciesName))
|
if (this->speciesNames_.found(speciesName))
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
this->otherThermo_.composition().Y(speciesName)
|
this->otherThermo_.composition().Y(speciesName)
|
||||||
|
|||||||
@ -63,17 +63,9 @@ const Foam::hashedWordList& Foam::interfaceCompositionModel::species() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::interfaceCompositionModel::transports
|
bool Foam::interfaceCompositionModel::transports(word& speciesName) const
|
||||||
(
|
|
||||||
word& speciesName
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
if (this->speciesNames_.contains(speciesName))
|
return this->speciesNames_.found(speciesName);
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -47,7 +47,7 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
class hashedWordList;
|
class hashedWordList;
|
||||||
inline Istream& operator>>(Istream& is, hashedWordList& lst);
|
inline Istream& operator>>(Istream& is, hashedWordList& list);
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -71,22 +71,22 @@ public:
|
|||||||
inline hashedWordList() = default;
|
inline hashedWordList() = default;
|
||||||
|
|
||||||
//- Copy construct.
|
//- Copy construct.
|
||||||
inline hashedWordList(const hashedWordList& lst);
|
inline hashedWordList(const hashedWordList& list);
|
||||||
|
|
||||||
//- Move construct.
|
//- Move construct.
|
||||||
inline hashedWordList(hashedWordList&& lst);
|
inline hashedWordList(hashedWordList&& list);
|
||||||
|
|
||||||
//- Copy construct from list of words
|
//- Copy construct from list of words
|
||||||
inline explicit hashedWordList(const wordUList& lst);
|
inline explicit hashedWordList(const wordUList& list);
|
||||||
|
|
||||||
//- Copy construct from list of words, eliminating duplicates
|
//- Copy construct from list of words, eliminating duplicates
|
||||||
inline hashedWordList(const wordUList& lst, bool unique);
|
inline hashedWordList(const wordUList& list, bool unique);
|
||||||
|
|
||||||
//- Move construct from list of words, optionally eliminating duplicates
|
//- Move construct from list of words, optionally eliminating duplicates
|
||||||
inline hashedWordList(wordList&& lst, bool unique=false);
|
inline hashedWordList(wordList&& list, bool unique=false);
|
||||||
|
|
||||||
//- Construct from an initializer list
|
//- Construct from an initializer list
|
||||||
inline hashedWordList(std::initializer_list<word> lst);
|
inline hashedWordList(std::initializer_list<word> list);
|
||||||
|
|
||||||
//- Construct from the word keys of any HashTable, sorting immediately.
|
//- Construct from the word keys of any HashTable, sorting immediately.
|
||||||
// This also handles a wordHashSet, which is derived from a HashTable.
|
// This also handles a wordHashSet, which is derived from a HashTable.
|
||||||
@ -102,7 +102,7 @@ public:
|
|||||||
hashedWordList(const label len, const char** array, bool unique=false);
|
hashedWordList(const label len, const char** array, bool unique=false);
|
||||||
|
|
||||||
//- Construct from a nullptr-terminated list of words,
|
//- Construct from a nullptr-terminated list of words,
|
||||||
// optionally eliminating duplicates
|
//- optionally eliminating duplicates
|
||||||
hashedWordList(const char** array, bool unique=false);
|
hashedWordList(const char** array, bool unique=false);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
@ -115,28 +115,25 @@ public:
|
|||||||
inline void clear();
|
inline void clear();
|
||||||
|
|
||||||
//- Append an element at the end of the list,
|
//- Append an element at the end of the list,
|
||||||
// optionally avoid append if it would be a duplicate entry
|
//- optionally avoid append if it would be a duplicate entry
|
||||||
inline void append(const word& name, bool unique=false);
|
inline void append(const word& name, bool unique=false);
|
||||||
|
|
||||||
//- Does the list contain the specified name
|
//- Search hashed values for the specified name
|
||||||
inline bool found(const word& name) const;
|
inline bool found(const word& name) const;
|
||||||
|
|
||||||
//- Does the list contain the specified name
|
|
||||||
inline bool contains(const word& name) const;
|
|
||||||
|
|
||||||
//- Return the hash of words/indices for inspection
|
//- Return the hash of words/indices for inspection
|
||||||
inline const HashTable<label>& lookup() const;
|
inline const HashTable<label>& lookup() const;
|
||||||
|
|
||||||
//- Swap contents
|
//- Swap contents
|
||||||
inline void swap(hashedWordList& lst);
|
inline void swap(hashedWordList& list);
|
||||||
|
|
||||||
//- Transfer contents of the argument into this list
|
//- Transfer contents of the argument into this list
|
||||||
//- and annul the argument list, optionally eliminating duplicates
|
//- and annul the argument list, optionally eliminating duplicates
|
||||||
inline void transfer(hashedWordList& lst);
|
inline void transfer(hashedWordList& list);
|
||||||
|
|
||||||
//- Transfer the contents of the argument List into this list
|
//- Transfer the contents of the argument List into this list
|
||||||
//- and annul the argument list, optionally eliminating duplicates
|
//- and annul the argument list, optionally eliminating duplicates
|
||||||
inline void transfer(wordList& lst, bool unique=false);
|
inline void transfer(wordList& list, bool unique=false);
|
||||||
|
|
||||||
//- Rebuild the lookup hash indices
|
//- Rebuild the lookup hash indices
|
||||||
void rehash() const;
|
void rehash() const;
|
||||||
@ -166,25 +163,36 @@ public:
|
|||||||
inline bool operator()(const word& name) const;
|
inline bool operator()(const word& name) const;
|
||||||
|
|
||||||
|
|
||||||
// Assignment
|
// Assignment
|
||||||
|
|
||||||
//- Copy assignment. Rehashes the indices.
|
//- Copy assignment. Rehashes the indices.
|
||||||
inline void operator=(const hashedWordList& lst);
|
inline void operator=(const hashedWordList& list);
|
||||||
|
|
||||||
//- Copy assignment from list of words. Rehashes the indices.
|
//- Copy assignment from list of words. Rehashes the indices.
|
||||||
inline void operator=(const wordUList& lst);
|
inline void operator=(const wordUList& list);
|
||||||
|
|
||||||
//- Copy assignment from initializer list. Rehashes the indices.
|
//- Copy assignment from initializer list. Rehashes the indices.
|
||||||
inline void operator=(std::initializer_list<word> lst);
|
inline void operator=(std::initializer_list<word> list);
|
||||||
|
|
||||||
//- Move assignment operator.
|
//- Move assignment operator.
|
||||||
inline void operator=(hashedWordList&& lst);
|
inline void operator=(hashedWordList&& list);
|
||||||
|
|
||||||
//- Move assignment from list of words. Rehashes the indices.
|
//- Move assignment from list of words. Rehashes the indices.
|
||||||
inline void operator=(wordList&& lst);
|
inline void operator=(wordList&& list);
|
||||||
|
|
||||||
//- Read from an input stream. Rehashes the indices.
|
//- Read from an input stream. Rehashes the indices.
|
||||||
inline friend Istream& operator>>(Istream& is, hashedWordList& lst);
|
inline friend Istream& operator>>(Istream& is, hashedWordList& list);
|
||||||
|
|
||||||
|
|
||||||
|
// Housekeeping
|
||||||
|
|
||||||
|
//- Deprecated(2019-01) Is the specified name found in the list?
|
||||||
|
// \deprecated(2019-01) - use found() method
|
||||||
|
inline bool contains(const word& name) const
|
||||||
|
FOAM_DEPRECATED_FOR(2019-01, "found() method")
|
||||||
|
{
|
||||||
|
return this-found(name);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,44 +25,44 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::hashedWordList::hashedWordList(const hashedWordList& lst)
|
inline Foam::hashedWordList::hashedWordList(const hashedWordList& list)
|
||||||
:
|
:
|
||||||
hashedWordList(static_cast<const wordUList&>(lst), false)
|
hashedWordList(static_cast<const wordUList&>(list), false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::hashedWordList::hashedWordList(hashedWordList&& lst)
|
inline Foam::hashedWordList::hashedWordList(hashedWordList&& list)
|
||||||
:
|
:
|
||||||
wordList(std::move(static_cast<wordList&>(lst))),
|
wordList(std::move(static_cast<wordList&>(list))),
|
||||||
lookup_(std::move(lst.lookup_))
|
lookup_(std::move(list.lookup_))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::hashedWordList::hashedWordList(const wordUList& lst)
|
inline Foam::hashedWordList::hashedWordList(const wordUList& list)
|
||||||
:
|
:
|
||||||
hashedWordList(lst, false)
|
hashedWordList(list, false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::hashedWordList::hashedWordList(const wordUList& lst, bool unique)
|
inline Foam::hashedWordList::hashedWordList(const wordUList& list, bool unique)
|
||||||
:
|
:
|
||||||
wordList(lst)
|
wordList(list)
|
||||||
{
|
{
|
||||||
rehash(unique);
|
rehash(unique);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::hashedWordList::hashedWordList(wordList&& lst, bool unique)
|
inline Foam::hashedWordList::hashedWordList(wordList&& list, bool unique)
|
||||||
:
|
:
|
||||||
wordList(std::move(lst))
|
wordList(std::move(list))
|
||||||
{
|
{
|
||||||
rehash(unique);
|
rehash(unique);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::hashedWordList::hashedWordList(std::initializer_list<word> lst)
|
inline Foam::hashedWordList::hashedWordList(std::initializer_list<word> list)
|
||||||
:
|
:
|
||||||
wordList(lst)
|
wordList(list)
|
||||||
{
|
{
|
||||||
rehash();
|
rehash();
|
||||||
}
|
}
|
||||||
@ -128,38 +128,37 @@ Foam::hashedWordList::lookup() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TBD (2019-01-07) - overload find() for consistency?
|
||||||
|
//
|
||||||
|
// inline Foam::label Foam::hashedWordList::find(const word& name) const
|
||||||
|
// {
|
||||||
|
// return lookup().lookup(name, -1); // -1 = not found or not hashed
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::hashedWordList::found(const word& name) const
|
inline bool Foam::hashedWordList::found(const word& name) const
|
||||||
{
|
{
|
||||||
return lookup().found(name);
|
return lookup().found(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::hashedWordList::contains(const word& name) const
|
inline void Foam::hashedWordList::swap(hashedWordList& list)
|
||||||
{
|
{
|
||||||
return lookup().found(name);
|
wordList::swap(static_cast<wordList&>(list));
|
||||||
|
lookup_.swap(list.lookup_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Foam::hashedWordList::swap(hashedWordList& lst)
|
inline void Foam::hashedWordList::transfer(hashedWordList& list)
|
||||||
{
|
{
|
||||||
wordList::swap(static_cast<wordList&>(lst));
|
wordList::transfer(static_cast<wordList&>(list));
|
||||||
lookup_.swap(lst.lookup_);
|
lookup_.transfer(list.lookup_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Foam::hashedWordList::transfer
|
inline void Foam::hashedWordList::transfer(wordList& list, bool unique)
|
||||||
(
|
|
||||||
hashedWordList& lst
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wordList::transfer(static_cast<wordList&>(lst));
|
wordList::transfer(list);
|
||||||
lookup_.transfer(lst.lookup_);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void Foam::hashedWordList::transfer(wordList& lst, bool unique)
|
|
||||||
{
|
|
||||||
wordList::transfer(lst);
|
|
||||||
rehash(unique);
|
rehash(unique);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,47 +206,47 @@ inline bool Foam::hashedWordList::operator()(const word& name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Foam::hashedWordList::operator=(const hashedWordList& lst)
|
inline void Foam::hashedWordList::operator=(const hashedWordList& list)
|
||||||
{
|
{
|
||||||
wordList::operator=(lst);
|
wordList::operator=(list);
|
||||||
rehash();
|
rehash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Foam::hashedWordList::operator=(const wordUList& lst)
|
inline void Foam::hashedWordList::operator=(const wordUList& list)
|
||||||
{
|
{
|
||||||
wordList::operator=(lst);
|
wordList::operator=(list);
|
||||||
rehash();
|
rehash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Foam::hashedWordList::operator=(std::initializer_list<word> lst)
|
inline void Foam::hashedWordList::operator=(std::initializer_list<word> list)
|
||||||
{
|
{
|
||||||
wordList::operator=(lst);
|
wordList::operator=(list);
|
||||||
rehash();
|
rehash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Foam::hashedWordList::operator=(hashedWordList&& lst)
|
inline void Foam::hashedWordList::operator=(hashedWordList&& list)
|
||||||
{
|
{
|
||||||
wordList::transfer(static_cast<wordList&>(lst));
|
wordList::transfer(static_cast<wordList&>(list));
|
||||||
lookup_ = std::move(lst.lookup_);
|
lookup_ = std::move(list.lookup_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Foam::hashedWordList::operator=(wordList&& lst)
|
inline void Foam::hashedWordList::operator=(wordList&& list)
|
||||||
{
|
{
|
||||||
wordList::transfer(lst);
|
wordList::transfer(list);
|
||||||
rehash();
|
rehash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::Istream& Foam::operator>>(Istream& is, hashedWordList& lst)
|
inline Foam::Istream& Foam::operator>>(Istream& is, hashedWordList& list)
|
||||||
{
|
{
|
||||||
is >> static_cast<wordList&>(lst);
|
is >> static_cast<wordList&>(list);
|
||||||
lst.rehash();
|
list.rehash();
|
||||||
|
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,7 @@ inline bool Foam::basicMultiComponentMixture::contains
|
|||||||
const word& specieName
|
const word& specieName
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return species_.contains(specieName);
|
return species_.found(specieName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
|
\\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -219,14 +219,8 @@ Foam::Reaction<ReactionThermo>::specieCoeffs::specieCoeffs
|
|||||||
specieName.resize(i);
|
specieName.resize(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (species.contains(specieName))
|
// -1 if not found
|
||||||
{
|
index = species[specieName];
|
||||||
index = species[specieName];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
index = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user