ENH: add hashedWordList find, appendUniq methods
- aligns calling signatures with wordList, for possible future replacement - drop construct from const char** (can use initializer_list instead) ENH: replace hashedWordList with plain wordList in triSurfaceLoader - additional hashing optimisation (and overhead) is not worth it for the comparatively small lists of surfaces used.
This commit is contained in:
parent
49d0e82842
commit
8b63b8cdfe
@ -1,4 +1,4 @@
|
|||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
const volScalarField& T = thermo.T();
|
const volScalarField& T = thermo.T();
|
||||||
regionModels::surfaceFilmModel& surfaceFilm = tsurfaceFilm();
|
regionModels::surfaceFilmModel& surfaceFilm = tsurfaceFilm();
|
||||||
const label inertIndex(composition.species()[inertSpecie]);
|
const label inertIndex(composition.species().find(inertSpecie));
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
const volScalarField& T = thermo.T();
|
const volScalarField& T = thermo.T();
|
||||||
const label inertIndex(composition.species()[inertSpecie]);
|
const label inertIndex(composition.species().find(inertSpecie));
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
const volScalarField& T = thermo.T();
|
const volScalarField& T = thermo.T();
|
||||||
const label inertIndex(composition.species()[inertSpecie]);
|
const label inertIndex(composition.species().find(inertSpecie));
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
const volScalarField& T = thermo.T();
|
const volScalarField& T = thermo.T();
|
||||||
const label inertIndex(composition.species()[inertSpecie]);
|
const label inertIndex(composition.species().find(inertSpecie));
|
||||||
|
@ -12,15 +12,15 @@
|
|||||||
if (Y.size())
|
if (Y.size())
|
||||||
{
|
{
|
||||||
const word inertSpecie(thermo.get<word>("inertSpecie"));
|
const word inertSpecie(thermo.get<word>("inertSpecie"));
|
||||||
if (!composition.species().found(inertSpecie))
|
inertIndex = composition.species().find(inertSpecie);
|
||||||
|
if (inertIndex < 0)
|
||||||
{
|
{
|
||||||
FatalIOErrorIn(args.executable().c_str(), thermo)
|
FatalIOErrorIn(args.executable().c_str(), thermo)
|
||||||
<< "Inert specie " << inertSpecie
|
<< "Inert specie " << inertSpecie
|
||||||
<< " not found in available species "
|
<< " not found in available species "
|
||||||
<< composition.species()
|
<< flatOutput(composition.species())
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
inertIndex = composition.species()[inertSpecie];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
volScalarField& rho = rhoFluid[i];
|
volScalarField& rho = rhoFluid[i];
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const volScalarField& T = thermo.T();
|
const volScalarField& T = thermo.T();
|
||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
|
|
||||||
const label inertIndex(composition.species()[inertSpecie]);
|
const label inertIndex(composition.species().find(inertSpecie));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const label inertIndex(composition.species()[inertSpecie]);
|
const label inertIndex(composition.species().find(inertSpecie));
|
||||||
|
|
||||||
const volScalarField& T = thermo.T();
|
const volScalarField& T = thermo.T();
|
||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
const volScalarField& T = thermo.T();
|
const volScalarField& T = thermo.T();
|
||||||
const label inertIndex(composition.species()[inertSpecie]);
|
const label inertIndex(composition.species().find(inertSpecie));
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
const volScalarField& T = thermo.T();
|
const volScalarField& T = thermo.T();
|
||||||
const label inertIndex(composition.species()[inertSpecie]);
|
const label inertIndex(composition.species().find(inertSpecie));
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
const volScalarField& T = thermo.T();
|
const volScalarField& T = thermo.T();
|
||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
const label inertIndex(composition.species()[inertSpecie]);
|
const label inertIndex(composition.species().find(inertSpecie));
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,43 +26,17 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "hashedWordList.H"
|
#include "hashedWordList.H"
|
||||||
#include "CStringList.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::hashedWordList::hashedWordList
|
|
||||||
(
|
|
||||||
const label len,
|
|
||||||
const char** array,
|
|
||||||
bool unique
|
|
||||||
)
|
|
||||||
:
|
|
||||||
wordList(len)
|
|
||||||
{
|
|
||||||
for (label i=0; i < len; ++i)
|
|
||||||
{
|
|
||||||
wordList::operator[](i) = array[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
rehash(unique);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::hashedWordList::hashedWordList(const char** array, bool unique)
|
|
||||||
:
|
|
||||||
hashedWordList(CStringList::count(array), array, unique)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::hashedWordList::rehash() const
|
void Foam::hashedWordList::rehash() const
|
||||||
{
|
{
|
||||||
lookup_.clear();
|
|
||||||
|
|
||||||
const wordUList& list = *this;
|
const wordUList& list = *this;
|
||||||
const label len = list.size();
|
const label len = list.size();
|
||||||
|
|
||||||
|
lookup_.clear();
|
||||||
|
lookup_.resize(2*len);
|
||||||
|
|
||||||
for (label i = 0; i < len; ++i)
|
for (label i = 0; i < len; ++i)
|
||||||
{
|
{
|
||||||
lookup_.insert(list[i], i);
|
lookup_.insert(list[i], i);
|
||||||
@ -72,12 +46,14 @@ void Foam::hashedWordList::rehash() const
|
|||||||
|
|
||||||
void Foam::hashedWordList::uniq()
|
void Foam::hashedWordList::uniq()
|
||||||
{
|
{
|
||||||
lookup_.clear();
|
|
||||||
|
|
||||||
wordList& list = *this;
|
wordList& list = *this;
|
||||||
const label len = list.size();
|
const label len = list.size();
|
||||||
|
|
||||||
|
lookup_.clear();
|
||||||
|
lookup_.resize(2*len);
|
||||||
|
|
||||||
label count = 0;
|
label count = 0;
|
||||||
|
|
||||||
for (label i = 0; i < len; ++i)
|
for (label i = 0; i < len; ++i)
|
||||||
{
|
{
|
||||||
word& item = list[i];
|
word& item = list[i];
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,8 +37,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef hashedWordList_H
|
#ifndef Foam_hashedWordList_H
|
||||||
#define hashedWordList_H
|
#define Foam_hashedWordList_H
|
||||||
|
|
||||||
#include "wordList.H"
|
#include "wordList.H"
|
||||||
#include "HashTable.H"
|
#include "HashTable.H"
|
||||||
@ -68,10 +68,10 @@ public:
|
|||||||
//- Default construct an empty list
|
//- Default construct an empty list
|
||||||
hashedWordList() = default;
|
hashedWordList() = default;
|
||||||
|
|
||||||
//- Copy construct.
|
//- Copy construct
|
||||||
inline hashedWordList(const hashedWordList& list);
|
inline hashedWordList(const hashedWordList& list);
|
||||||
|
|
||||||
//- Move construct.
|
//- Move construct
|
||||||
inline hashedWordList(hashedWordList&& list);
|
inline hashedWordList(hashedWordList&& list);
|
||||||
|
|
||||||
//- Copy construct from list of words
|
//- Copy construct from list of words
|
||||||
@ -95,16 +95,8 @@ public:
|
|||||||
const HashTable<AnyType, word, AnyHash>& tbl
|
const HashTable<AnyType, word, AnyHash>& tbl
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from number and list of words,
|
|
||||||
// optionally eliminating duplicates
|
|
||||||
hashedWordList(const label len, const char** array, bool unique=false);
|
|
||||||
|
|
||||||
//- Construct from a nullptr-terminated list of words,
|
|
||||||
//- optionally eliminating duplicates
|
|
||||||
hashedWordList(const char** array, bool unique=false);
|
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
inline hashedWordList(Istream& is);
|
inline explicit hashedWordList(Istream& is);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -112,12 +104,13 @@ public:
|
|||||||
//- Clear the list, i.e. set size to zero.
|
//- Clear the list, i.e. set size to zero.
|
||||||
inline void clear();
|
inline void clear();
|
||||||
|
|
||||||
//- Append an element at the end of the list,
|
//- Append an element if not already in the list.
|
||||||
//- optionally avoid append if it would be a duplicate entry
|
FOAM_DEPRECATED_FOR(2022-05, "appendUniq method")
|
||||||
inline void append(const word& name, bool unique=false);
|
inline void append(const word& val);
|
||||||
|
|
||||||
//- Search hashed values for the specified name
|
//- Append an element if not already in the list.
|
||||||
inline bool found(const word& name) const;
|
// \return the change in list length
|
||||||
|
inline label appendUniq(const word& val);
|
||||||
|
|
||||||
//- 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;
|
||||||
@ -143,22 +136,33 @@ public:
|
|||||||
//- and rehash the indices
|
//- and rehash the indices
|
||||||
void uniq();
|
void uniq();
|
||||||
|
|
||||||
//- Sort the list and rehash the indices
|
//- Inplace sort list and rehash the indices
|
||||||
inline void sort();
|
inline void sort();
|
||||||
|
|
||||||
|
|
||||||
|
// Search
|
||||||
|
|
||||||
|
//- Find index of the value (searches the hash).
|
||||||
|
// \return position in list or -1 if not found.
|
||||||
|
inline label find(const word& val) const;
|
||||||
|
|
||||||
|
//- True if the value if found in the list (searches the hash).
|
||||||
|
inline bool found(const word& val) const;
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
//- Return name corresponding to specified index.
|
//- Return name corresponding to specified index.
|
||||||
// Fatal for out of range values.
|
// Fatal for out of range values.
|
||||||
inline const word& operator[](const label index) const;
|
inline const word& operator[](const label index) const;
|
||||||
|
|
||||||
//- Return index corresponding to specified name, or -1 on failure
|
//- Find index of the value (searches the hash) - same as find().
|
||||||
inline label operator[](const word& name) const;
|
// \return position in list or -1 if not found.
|
||||||
|
inline label operator[](const word& val) const;
|
||||||
|
|
||||||
//- Check hashed values for the specified name - same as found.
|
//- Check hashed values for the specified name - same as found().
|
||||||
// Can be used as a unary predicate.
|
// Can be used as a unary predicate.
|
||||||
inline bool operator()(const word& name) const;
|
inline bool operator()(const word& val) const;
|
||||||
|
|
||||||
|
|
||||||
// Assignment
|
// Assignment
|
||||||
@ -184,10 +188,7 @@ public:
|
|||||||
//- Deprecated(2019-01) Is the specified name found in the list?
|
//- Deprecated(2019-01) Is the specified name found in the list?
|
||||||
// \deprecated(2019-01) - use found() method
|
// \deprecated(2019-01) - use found() method
|
||||||
FOAM_DEPRECATED_FOR(2019-01, "found() method")
|
FOAM_DEPRECATED_FOR(2019-01, "found() method")
|
||||||
bool contains(const word& name) const
|
bool contains(const word& val) const { return this->found(val); }
|
||||||
{
|
|
||||||
return this->found(name);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -76,17 +76,9 @@ inline Foam::hashedWordList::hashedWordList
|
|||||||
const HashTable<AnyType, word, AnyHash>& tbl
|
const HashTable<AnyType, word, AnyHash>& tbl
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
wordList(tbl.size())
|
wordList(tbl.sortedToc())
|
||||||
{
|
{
|
||||||
wordList& list = *this;
|
rehash();
|
||||||
|
|
||||||
label count = 0;
|
|
||||||
for (auto iter = tbl.cbegin(); iter != tbl.cend(); ++iter)
|
|
||||||
{
|
|
||||||
list[count++] = iter.key();
|
|
||||||
}
|
|
||||||
|
|
||||||
this->sort();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -105,16 +97,27 @@ inline void Foam::hashedWordList::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Foam::hashedWordList::append(const word& name, bool unique)
|
inline void Foam::hashedWordList::append(const word& val)
|
||||||
{
|
{
|
||||||
// name is either unique or we don't care about duplicates
|
if (lookup_.insert(val, size()))
|
||||||
if (lookup_.insert(name, size()) || !unique)
|
|
||||||
{
|
{
|
||||||
wordList::append(name);
|
wordList::append(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::hashedWordList::appendUniq(const word& val)
|
||||||
|
{
|
||||||
|
if (lookup_.insert(val, size()))
|
||||||
|
{
|
||||||
|
wordList::append(val);
|
||||||
|
return 1; // Increased list length by one
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0; // No change
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::HashTable<Foam::label>&
|
inline const Foam::HashTable<Foam::label>&
|
||||||
Foam::hashedWordList::lookup() const
|
Foam::hashedWordList::lookup() const
|
||||||
{
|
{
|
||||||
@ -130,17 +133,15 @@ Foam::hashedWordList::lookup() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TBD (2019-01-07) - overload find() for consistency?
|
inline Foam::label Foam::hashedWordList::find(const word& val) const
|
||||||
//
|
|
||||||
// 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
|
|
||||||
{
|
{
|
||||||
return lookup().found(name);
|
return lookup().lookup(val, -1); // -1 = not found or not hashed
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool Foam::hashedWordList::found(const word& val) const
|
||||||
|
{
|
||||||
|
return lookup().found(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -201,15 +202,15 @@ inline const Foam::word& Foam::hashedWordList::operator[]
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::hashedWordList::operator[](const word& name) const
|
inline Foam::label Foam::hashedWordList::operator[](const word& val) const
|
||||||
{
|
{
|
||||||
return lookup_.lookup(name, -1); // -1 = not found or not hashed
|
return lookup_.lookup(val, -1); // -1 = not found or not hashed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::hashedWordList::operator()(const word& name) const
|
inline bool Foam::hashedWordList::operator()(const word& val) const
|
||||||
{
|
{
|
||||||
return lookup_.found(name);
|
return lookup_.found(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,8 +80,8 @@ diffusionMulticomponent<ReactionThermo, ThermoType>::init()
|
|||||||
const List<specieCoeffs>& lhs = reactions_[k].lhs();
|
const List<specieCoeffs>& lhs = reactions_[k].lhs();
|
||||||
const List<specieCoeffs>& rhs = reactions_[k].rhs();
|
const List<specieCoeffs>& rhs = reactions_[k].rhs();
|
||||||
|
|
||||||
const label fuelIndex = species[fuelNames_[k]];
|
const label fuelIndex = species.find(fuelNames_[k]);
|
||||||
const label oxidantIndex = species[oxidantNames_[k]];
|
const label oxidantIndex = species.find(oxidantNames_[k]);
|
||||||
|
|
||||||
const scalar Wu = specieThermo_[fuelIndex].W();
|
const scalar Wu = specieThermo_[fuelIndex].W();
|
||||||
const scalar Wox = specieThermo_[oxidantIndex].W();
|
const scalar Wox = specieThermo_[oxidantIndex].W();
|
||||||
@ -216,7 +216,7 @@ diffusionMulticomponent<ReactionThermo, ThermoType>::correct()
|
|||||||
volScalarField& Rijl = RijlPtr[k];
|
volScalarField& Rijl = RijlPtr[k];
|
||||||
|
|
||||||
// Obtain individual reaction rates for each reaction
|
// Obtain individual reaction rates for each reaction
|
||||||
const label fuelIndex = species[fuelNames_[k]];
|
const label fuelIndex = species.find(fuelNames_[k]);
|
||||||
|
|
||||||
if (laminarIgn_)
|
if (laminarIgn_)
|
||||||
{
|
{
|
||||||
@ -247,8 +247,8 @@ diffusionMulticomponent<ReactionThermo, ThermoType>::correct()
|
|||||||
|
|
||||||
for (label k=0; k < nReactions; k++)
|
for (label k=0; k < nReactions; k++)
|
||||||
{
|
{
|
||||||
const label fuelIndex = species[fuelNames_[k]];
|
const label fuelIndex = species.find(fuelNames_[k]);
|
||||||
const label oxidantIndex = species[oxidantNames_[k]];
|
const label oxidantIndex = species.find(oxidantNames_[k]);
|
||||||
|
|
||||||
const volScalarField& Yfuel =
|
const volScalarField& Yfuel =
|
||||||
this->thermo().composition().Y(fuelIndex);
|
this->thermo().composition().Y(fuelIndex);
|
||||||
@ -381,7 +381,7 @@ Foam::combustionModels::diffusionMulticomponent<ReactionThermo, ThermoType>::R
|
|||||||
if (this->active())
|
if (this->active())
|
||||||
{
|
{
|
||||||
const label specieI =
|
const label specieI =
|
||||||
this->thermo().composition().species()[Y.member()];
|
this->thermo().composition().species().find(Y.member());
|
||||||
|
|
||||||
Su += this->chemistryPtr_->RR(specieI);
|
Su += this->chemistryPtr_->RR(specieI);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ Foam::combustionModels::laminar<ReactionThermo>::R(volScalarField& Y) const
|
|||||||
if (this->active())
|
if (this->active())
|
||||||
{
|
{
|
||||||
const label specieI =
|
const label specieI =
|
||||||
this->thermo().composition().species()[Y.member()];
|
this->thermo().composition().species().find(Y.member());
|
||||||
|
|
||||||
Su += this->chemistryPtr_->RR(specieI);
|
Su += this->chemistryPtr_->RR(specieI);
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ tmp<fvScalarMatrix> singleStepCombustion<ReactionThermo, ThermoType>::R
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const label specieI =
|
const label specieI =
|
||||||
this->thermo().composition().species()[Y.member()];
|
this->thermo().composition().species().find(Y.member());
|
||||||
|
|
||||||
volScalarField wSpecie
|
volScalarField wSpecie
|
||||||
(
|
(
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -88,7 +88,7 @@ Foam::label Foam::triSurfaceLoader::readDir()
|
|||||||
names.insert(f.name());
|
names.insert(f.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
available_ = names.sortedToc(); // Also hashes the names
|
available_ = names.sortedToc();
|
||||||
|
|
||||||
return available_.size();
|
return available_.size();
|
||||||
}
|
}
|
||||||
@ -105,7 +105,8 @@ Foam::label Foam::triSurfaceLoader::select(const word& name)
|
|||||||
{
|
{
|
||||||
if (available_.found(name))
|
if (available_.found(name))
|
||||||
{
|
{
|
||||||
selected_ = wordList{name}; // hashedWordList::operator[] is hidden!
|
selected_.resize(1);
|
||||||
|
selected_.first() = name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -118,19 +119,16 @@ Foam::label Foam::triSurfaceLoader::select(const word& name)
|
|||||||
|
|
||||||
Foam::label Foam::triSurfaceLoader::select(const wordRe& mat)
|
Foam::label Foam::triSurfaceLoader::select(const wordRe& mat)
|
||||||
{
|
{
|
||||||
DynamicList<label> foundIds(available_.size());
|
|
||||||
|
|
||||||
if (mat.isPattern())
|
if (mat.isPattern())
|
||||||
{
|
{
|
||||||
foundIds = findStrings(mat, available_);
|
labelList foundIds = findStrings(mat, available_);
|
||||||
sort(foundIds);
|
Foam::sort(foundIds);
|
||||||
|
selected_ = wordList(available_, foundIds);
|
||||||
}
|
}
|
||||||
else
|
else if (available_.found(static_cast<const word&>(mat)))
|
||||||
{
|
{
|
||||||
const word& plain = mat;
|
selected_.resize(1);
|
||||||
if (available_.found(plain))
|
selected_.first() = mat;
|
||||||
{
|
|
||||||
foundIds.append(available_[plain]);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -139,9 +137,7 @@ Foam::label Foam::triSurfaceLoader::select(const wordRe& mat)
|
|||||||
<< " - but could not find it"
|
<< " - but could not find it"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
selected_ = wordList(available_, foundIds);
|
|
||||||
return selected_.size();
|
return selected_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +163,7 @@ Foam::label Foam::triSurfaceLoader::select(const UList<wordRe>& matcher)
|
|||||||
if (mat.isPattern())
|
if (mat.isPattern())
|
||||||
{
|
{
|
||||||
labelList indices = findStrings(mat, available_);
|
labelList indices = findStrings(mat, available_);
|
||||||
sort(indices);
|
Foam::sort(indices);
|
||||||
|
|
||||||
for (const label idx : indices)
|
for (const label idx : indices)
|
||||||
{
|
{
|
||||||
@ -180,9 +176,10 @@ Foam::label Foam::triSurfaceLoader::select(const UList<wordRe>& matcher)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const word& plain = mat;
|
const word& plain = mat;
|
||||||
if (available_.found(plain))
|
const label idx = available_.find(plain);
|
||||||
|
|
||||||
|
if (idx >= 0)
|
||||||
{
|
{
|
||||||
const label idx = available_[plain];
|
|
||||||
if (hashedFound.insert(idx))
|
if (hashedFound.insert(idx))
|
||||||
{
|
{
|
||||||
foundIds.append(idx);
|
foundIds.append(idx);
|
||||||
@ -240,7 +237,7 @@ Foam::autoPtr<Foam::triSurface> Foam::triSurfaceLoader::load
|
|||||||
|
|
||||||
if (surf.patches().size())
|
if (surf.patches().size())
|
||||||
{
|
{
|
||||||
surf.patches().setSize(1);
|
surf.patches().resize(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,20 +39,20 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef triSurfaceLoader_H
|
#ifndef Foam_triSurfaceLoader_H
|
||||||
#define triSurfaceLoader_H
|
#define Foam_triSurfaceLoader_H
|
||||||
|
|
||||||
#include "triSurface.H"
|
#include "triSurface.H"
|
||||||
#include "wordRes.H"
|
#include "wordRes.H"
|
||||||
#include "Enum.H"
|
#include "Enum.H"
|
||||||
#include "hashedWordList.H"
|
#include "wordList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward Declarations
|
||||||
class triSurfaceLoader;
|
class triSurfaceLoader;
|
||||||
class Time;
|
class Time;
|
||||||
|
|
||||||
@ -79,16 +79,16 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- The directory to load from (eg, case/constant/triSurface)
|
//- The directory to load from (eg, case/constant/triSurface)
|
||||||
fileName directory_;
|
fileName directory_;
|
||||||
|
|
||||||
//- All available files
|
//- All available files
|
||||||
hashedWordList available_;
|
wordList available_;
|
||||||
|
|
||||||
//- Selected files
|
//- Selected files
|
||||||
hashedWordList selected_;
|
wordList selected_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -119,19 +119,19 @@ public:
|
|||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- The directory being used
|
//- The directory being used
|
||||||
inline const fileName& directory() const
|
const fileName& directory() const noexcept
|
||||||
{
|
{
|
||||||
return directory_;
|
return directory_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- The list of available files
|
//- The list of available files
|
||||||
inline const hashedWordList& available() const
|
const wordList& available() const noexcept
|
||||||
{
|
{
|
||||||
return available_;
|
return available_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- The list of selected files
|
//- The list of selected files
|
||||||
inline const hashedWordList& selected() const
|
const wordList& selected() const noexcept
|
||||||
{
|
{
|
||||||
return selected_;
|
return selected_;
|
||||||
}
|
}
|
||||||
@ -163,7 +163,6 @@ public:
|
|||||||
const enum loadingOption opt = loadingOption::OFFSET_REGION,
|
const enum loadingOption opt = loadingOption::OFFSET_REGION,
|
||||||
const scalar scaleFactor = -1
|
const scalar scaleFactor = -1
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,10 +47,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getLocalThermo
|
|||||||
return
|
return
|
||||||
globalThermo.getLocalThermo
|
globalThermo.getLocalThermo
|
||||||
(
|
(
|
||||||
globalThermo.species()
|
globalThermo.species().find(speciesName)
|
||||||
[
|
|
||||||
speciesName
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ MultiComponentPhaseModel
|
|||||||
|
|
||||||
species_ = thermoPtr_->composition().species();
|
species_ = thermoPtr_->composition().species();
|
||||||
|
|
||||||
inertIndex_ = species_[thermoPtr_().template get<word>("inertSpecie")];
|
inertIndex_ = species_.find(thermoPtr_().template get<word>("inertSpecie"));
|
||||||
|
|
||||||
X_.setSize(thermoPtr_->composition().species().size());
|
X_.setSize(thermoPtr_->composition().species().size());
|
||||||
|
|
||||||
|
@ -84,10 +84,10 @@ Foam::interfaceCompositionModels::Henry<Thermo, OtherThermo>::Yf
|
|||||||
const volScalarField& Tf
|
const volScalarField& Tf
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (this->speciesNames_.found(speciesName))
|
const label index = this->speciesNames_.find(speciesName);
|
||||||
{
|
|
||||||
const label index = this->speciesNames_[speciesName];
|
|
||||||
|
|
||||||
|
if (index >= 0)
|
||||||
|
{
|
||||||
return
|
return
|
||||||
k_[index]
|
k_[index]
|
||||||
*this->otherThermo_.composition().Y(speciesName)
|
*this->otherThermo_.composition().Y(speciesName)
|
||||||
|
@ -46,10 +46,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getLocalThermo
|
|||||||
return
|
return
|
||||||
globalThermo.getLocalThermo
|
globalThermo.getLocalThermo
|
||||||
(
|
(
|
||||||
globalThermo.species()
|
globalThermo.species().find(speciesName)
|
||||||
[
|
|
||||||
speciesName
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +106,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::dY
|
|||||||
Yf(speciesName, Tf)
|
Yf(speciesName, Tf)
|
||||||
- thermo_.composition().Y()
|
- thermo_.composition().Y()
|
||||||
[
|
[
|
||||||
thermo_.composition().species()[speciesName]
|
thermo_.composition().species().find(speciesName)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +75,8 @@ NonRandomTwoLiquid
|
|||||||
species1Name_ = this->speciesNames_[0];
|
species1Name_ = this->speciesNames_[0];
|
||||||
species2Name_ = this->speciesNames_[1];
|
species2Name_ = this->speciesNames_[1];
|
||||||
|
|
||||||
species1Index_ = this->thermo_.composition().species()[species1Name_];
|
species1Index_ = this->thermo_.composition().species().find(species1Name_);
|
||||||
species2Index_ = this->thermo_.composition().species()[species2Name_];
|
species2Index_ = this->thermo_.composition().species().find(species2Name_);
|
||||||
|
|
||||||
alpha12_.read("alpha", dict.subDict(species1Name_));
|
alpha12_.read("alpha", dict.subDict(species1Name_));
|
||||||
alpha21_.read("alpha", dict.subDict(species2Name_));
|
alpha21_.read("alpha", dict.subDict(species2Name_));
|
||||||
|
@ -58,7 +58,7 @@ Foam::interfaceCompositionModels::Saturated<Thermo, OtherThermo>::Saturated
|
|||||||
saturatedName_(this->speciesNames_[0]),
|
saturatedName_(this->speciesNames_[0]),
|
||||||
saturatedIndex_
|
saturatedIndex_
|
||||||
(
|
(
|
||||||
this->thermo_.composition().species()[saturatedName_]
|
this->thermo_.composition().species().find(saturatedName_)
|
||||||
),
|
),
|
||||||
saturationModel_
|
saturationModel_
|
||||||
(
|
(
|
||||||
@ -112,7 +112,7 @@ Foam::interfaceCompositionModels::Saturated<Thermo, OtherThermo>::Yf
|
|||||||
{
|
{
|
||||||
const label speciesIndex
|
const label speciesIndex
|
||||||
(
|
(
|
||||||
this->thermo_.composition().species()[speciesName]
|
this->thermo_.composition().species().find(speciesName)
|
||||||
);
|
);
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -139,7 +139,7 @@ Foam::interfaceCompositionModels::Saturated<Thermo, OtherThermo>::YfPrime
|
|||||||
{
|
{
|
||||||
const label speciesIndex
|
const label speciesIndex
|
||||||
(
|
(
|
||||||
this->thermo_.composition().species()[speciesName]
|
this->thermo_.composition().species().find(speciesName)
|
||||||
);
|
);
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -63,14 +63,14 @@ Foam::MultiComponentPhaseModel<BasePhaseModel>::MultiComponentPhaseModel
|
|||||||
),
|
),
|
||||||
inertIndex_(-1)
|
inertIndex_(-1)
|
||||||
{
|
{
|
||||||
const word inertSpecie
|
word inertSpecie;
|
||||||
|
if
|
||||||
(
|
(
|
||||||
this->thermo_->getOrDefault("inertSpecie", word::null)
|
this->thermo_->readIfPresent("inertSpecie", inertSpecie)
|
||||||
);
|
&& !inertSpecie.empty()
|
||||||
|
)
|
||||||
if (inertSpecie != word::null)
|
|
||||||
{
|
{
|
||||||
inertIndex_ = this->thermo_->composition().species()[inertSpecie];
|
inertIndex_ = this->thermo_->composition().species().find(inertSpecie);
|
||||||
}
|
}
|
||||||
|
|
||||||
PtrList<volScalarField>& Y = this->thermo_->composition().Y();
|
PtrList<volScalarField>& Y = this->thermo_->composition().Y();
|
||||||
|
@ -238,7 +238,7 @@ Foam::radiation::greyMeanAbsorptionEmission::aCont(const label bandI) const
|
|||||||
invWt += mixture.Y(s)[celli]/mixture.W(s);
|
invWt += mixture.Y(s)[celli]/mixture.W(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
label index = mixture.species()[iter.key()];
|
const label index = mixture.species().find(iter.key());
|
||||||
scalar Xk = mixture.Y(index)[celli]/(mixture.W(index)*invWt);
|
scalar Xk = mixture.Y(index)[celli]/(mixture.W(index)*invWt);
|
||||||
|
|
||||||
Xipi = Xk*paToAtm(p[celli]);
|
Xipi = Xk*paToAtm(p[celli]);
|
||||||
|
@ -73,7 +73,7 @@ greyMeanSolidAbsorptionEmission::X(const word specie) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const scalarField& Yj = mixture_.Y(specie);
|
const scalarField& Yj = mixture_.Y(specie);
|
||||||
const label mySpecieI = mixture_.species()[specie];
|
const label mySpecieI = mixture_.species().find(specie);
|
||||||
forAll(Xj, iCell)
|
forAll(Xj, iCell)
|
||||||
{
|
{
|
||||||
Xj[iCell] = Yj[iCell]/mixture_.rho(mySpecieI, p[iCell], T[iCell]);
|
Xj[iCell] = Yj[iCell]/mixture_.rho(mySpecieI, p[iCell], T[iCell]);
|
||||||
@ -166,7 +166,7 @@ calc(const label propertyId) const
|
|||||||
{
|
{
|
||||||
if (mixture_.contains(iter.key()))
|
if (mixture_.contains(iter.key()))
|
||||||
{
|
{
|
||||||
a += solidData_[iter()][propertyId]*X(iter.key());
|
a += solidData_[iter.val()][propertyId]*X(iter.key());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ Foam::radiation::wideBandAbsorptionEmission::aCont(const label bandi) const
|
|||||||
invWt += mixture.Y(s)[celli]/mixture.W(s);
|
invWt += mixture.Y(s)[celli]/mixture.W(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
const label index = mixture.species()[iter.key()];
|
const label index = mixture.species().find(iter.key());
|
||||||
|
|
||||||
const scalar Xk =
|
const scalar Xk =
|
||||||
mixture.Y(index)[celli]/(mixture.W(index)*invWt);
|
mixture.Y(index)[celli]/(mixture.W(index)*invWt);
|
||||||
|
@ -133,7 +133,7 @@ Foam::radiation::mixtureFractionSoot<ThermoType>::mixtureFractionSoot
|
|||||||
mappingFieldName_ = mixture_.Y(index).name();
|
mappingFieldName_ = mixture_.Y(index).name();
|
||||||
}
|
}
|
||||||
|
|
||||||
const label mapFieldIndex = mixture_.species()[mappingFieldName_];
|
const label mapFieldIndex = mixture_.species().find(mappingFieldName_);
|
||||||
|
|
||||||
mapFieldMax_ = mixture_.Yprod0()[mapFieldIndex];
|
mapFieldMax_ = mixture_.Yprod0()[mapFieldIndex];
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ inline Foam::volScalarField& Foam::basicMultiComponentMixture::Y
|
|||||||
const word& specieName
|
const word& specieName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return Y_[species_[specieName]];
|
return Y_[species_.find(specieName)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ inline const Foam::volScalarField& Foam::basicMultiComponentMixture::Y
|
|||||||
const word& specieName
|
const word& specieName
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return Y_[species_[specieName]];
|
return Y_[species_.find(specieName)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ void Foam::singleStepReactingMixture<ThermoType>::calculateqFuel()
|
|||||||
template<class ThermoType>
|
template<class ThermoType>
|
||||||
void Foam::singleStepReactingMixture<ThermoType>::massAndAirStoichRatios()
|
void Foam::singleStepReactingMixture<ThermoType>::massAndAirStoichRatios()
|
||||||
{
|
{
|
||||||
const label O2Index = this->species()["O2"];
|
const label O2Index = this->species().find("O2");
|
||||||
const scalar Wu = this->speciesData()[fuelIndex_].W();
|
const scalar Wu = this->speciesData()[fuelIndex_].W();
|
||||||
|
|
||||||
stoicRatio_ =
|
stoicRatio_ =
|
||||||
@ -136,7 +136,7 @@ void Foam::singleStepReactingMixture<ThermoType>::fresCorrect()
|
|||||||
{
|
{
|
||||||
const Reaction<ThermoType>& reaction = this->operator[](0);
|
const Reaction<ThermoType>& reaction = this->operator[](0);
|
||||||
|
|
||||||
const label O2Index = this->species()["O2"];
|
const label O2Index = this->species().find("O2");
|
||||||
const volScalarField& YFuel = this->Y()[fuelIndex_];
|
const volScalarField& YFuel = this->Y()[fuelIndex_];
|
||||||
const volScalarField& YO2 = this->Y()[O2Index];
|
const volScalarField& YO2 = this->Y()[O2Index];
|
||||||
|
|
||||||
@ -204,8 +204,8 @@ Foam::singleStepReactingMixture<ThermoType>::singleStepReactingMixture
|
|||||||
specieStoichCoeffs_(this->species_.size(), Zero),
|
specieStoichCoeffs_(this->species_.size(), Zero),
|
||||||
Yprod0_(this->species_.size(), Zero),
|
Yprod0_(this->species_.size(), Zero),
|
||||||
fres_(Yprod0_.size()),
|
fres_(Yprod0_.size()),
|
||||||
inertIndex_(this->species()[thermoDict.get<word>("inertSpecie")]),
|
inertIndex_(this->species().find(thermoDict.get<word>("inertSpecie"))),
|
||||||
fuelIndex_(this->species()[thermoDict.get<word>("fuel")]),
|
fuelIndex_(this->species().find(thermoDict.get<word>("fuel"))),
|
||||||
specieProd_(Yprod0_.size(), 1)
|
specieProd_(Yprod0_.size(), 1)
|
||||||
{
|
{
|
||||||
if (this->size() == 1)
|
if (this->size() == 1)
|
||||||
|
@ -93,7 +93,7 @@ Foam::solidReaction<ReactionThermo>::solidReaction
|
|||||||
speciesTable allSpecies(species);
|
speciesTable allSpecies(species);
|
||||||
for (const word& gasName : pyrolisisGases_)
|
for (const word& gasName : pyrolisisGases_)
|
||||||
{
|
{
|
||||||
allSpecies.append(gasName);
|
allSpecies.appendUniq(gasName);
|
||||||
}
|
}
|
||||||
List<specieCoeffs> dummyLhs;
|
List<specieCoeffs> dummyLhs;
|
||||||
List<specieCoeffs> dummyRhs;
|
List<specieCoeffs> dummyRhs;
|
||||||
|
@ -224,7 +224,7 @@ Foam::Reaction<ReactionThermo>::specieCoeffs::specieCoeffs
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Lookup specie name: -1 if not found
|
// Lookup specie name: -1 if not found
|
||||||
index = species[specieName];
|
index = species.find(specieName);
|
||||||
|
|
||||||
if (failUnknownSpecie && index < 0)
|
if (failUnknownSpecie && index < 0)
|
||||||
{
|
{
|
||||||
|
@ -53,13 +53,13 @@ inline Foam::LangmuirHinshelwoodReactionRate::LangmuirHinshelwoodReactionRate
|
|||||||
|
|
||||||
inline Foam::LangmuirHinshelwoodReactionRate::LangmuirHinshelwoodReactionRate
|
inline Foam::LangmuirHinshelwoodReactionRate::LangmuirHinshelwoodReactionRate
|
||||||
(
|
(
|
||||||
const speciesTable& st,
|
const speciesTable& species,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
co_(st["CO"]),
|
co_(species.find("CO")),
|
||||||
c3h6_(st["C3H6"]),
|
c3h6_(species.find("C3H6")),
|
||||||
no_(st["NO"])
|
no_(species.find("NO"))
|
||||||
{
|
{
|
||||||
// read (A, Ta) pairs
|
// read (A, Ta) pairs
|
||||||
FixedList<Tuple2<scalar, scalar>, n_> coeffs(dict.lookup("coeffs"));
|
FixedList<Tuple2<scalar, scalar>, n_> coeffs(dict.lookup("coeffs"));
|
||||||
|
@ -41,7 +41,7 @@ inline Foam::thirdBodyEfficiencies::thirdBodyEfficiencies
|
|||||||
if (size() != species_.size())
|
if (size() != species_.size())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "number of efficiencies = " << size()
|
<< "Number of efficiencies = " << size()
|
||||||
<< " is not equal to the number of species " << species_.size()
|
<< " is not equal to the number of species " << species_.size()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
@ -63,14 +63,24 @@ inline Foam::thirdBodyEfficiencies::thirdBodyEfficiencies
|
|||||||
if (coeffs.size() != species_.size())
|
if (coeffs.size() != species_.size())
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction(dict)
|
FatalIOErrorInFunction(dict)
|
||||||
<< "number of efficiencies = " << coeffs.size()
|
<< "Number of efficiencies = " << coeffs.size()
|
||||||
<< " is not equat to the number of species " << species_.size()
|
<< " is not equal to the number of species " << species_.size()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(coeffs, i)
|
for (const auto& coeff : coeffs)
|
||||||
{
|
{
|
||||||
operator[](species[coeffs[i].first()]) = coeffs[i].second();
|
const label idx = species.find(coeff.first());
|
||||||
|
|
||||||
|
if (idx < 0)
|
||||||
|
{
|
||||||
|
FatalIOErrorInFunction(dict)
|
||||||
|
<< "No such species: " << coeffs.first()
|
||||||
|
<< ", available: " << flatOutput(species) << endl
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
|
operator[](idx) = coeff.second();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -34,6 +34,7 @@ Description
|
|||||||
#ifndef speciesTable_H
|
#ifndef speciesTable_H
|
||||||
#define speciesTable_H
|
#define speciesTable_H
|
||||||
|
|
||||||
|
#include "wordList.H"
|
||||||
#include "hashedWordList.H"
|
#include "hashedWordList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
Loading…
Reference in New Issue
Block a user