Zones: Now derived from PtrListDictionary to provide faster lookup

Now the HashTable underlying PtrListDictionary is used for zone lookup by name
which is a lot faster than the linear search method used previously if there are
a large number of zones.
This commit is contained in:
Henry Weller
2024-03-28 20:25:29 +00:00
parent 4ad52ea108
commit 3123551bfa
36 changed files with 340 additions and 302 deletions

View File

@ -1209,7 +1209,7 @@ int main(int argc, char *argv[])
{ {
FatalIOErrorIn(args.executable().c_str(), dict) FatalIOErrorIn(args.executable().c_str(), dict)
<< "Cannot find zone " << zoneNames[zonei] << "Cannot find zone " << zoneNames[zonei]
<< endl << "Valid zones are " << mesh.faceZones().names() << endl << "Valid zones are " << mesh.faceZones().toc()
<< exit(FatalIOError); << exit(FatalIOError);
} }
@ -1222,7 +1222,7 @@ int main(int argc, char *argv[])
{ {
FatalIOErrorIn(args.executable().c_str(), dict) FatalIOErrorIn(args.executable().c_str(), dict)
<< "Cannot find opposite zone " << oppositeZoneNames[zonei] << "Cannot find opposite zone " << oppositeZoneNames[zonei]
<< endl << "Valid zones are " << mesh.faceZones().names() << endl << "Valid zones are " << mesh.faceZones().toc()
<< exit(FatalIOError); << exit(FatalIOError);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -73,7 +73,7 @@ void Foam::faceSelections::faceZoneSelection::select
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Cannot find faceZone " << zoneName_ << nl << "Valid zones are " << "Cannot find faceZone " << zoneName_ << nl << "Valid zones are "
<< mesh_.faceZones().names() << mesh_.faceZones().toc()
<< exit(FatalError); << exit(FatalError);
} }

View File

@ -142,7 +142,7 @@ Foam::mergePolyMesh::mergePolyMesh(polyMesh& mesh)
// Insert point, face and cell zones into the list // Insert point, face and cell zones into the list
// Point zones // Point zones
wordList curPointZoneNames = mesh_.pointZones().names(); wordList curPointZoneNames = mesh_.pointZones().toc();
if (curPointZoneNames.size()) if (curPointZoneNames.size())
{ {
pointZoneNames_.setCapacity(2*curPointZoneNames.size()); pointZoneNames_.setCapacity(2*curPointZoneNames.size());
@ -156,7 +156,7 @@ Foam::mergePolyMesh::mergePolyMesh(polyMesh& mesh)
pointZonesAddedPoints_.setSize(pointZoneNames_.size()); pointZonesAddedPoints_.setSize(pointZoneNames_.size());
// Face zones // Face zones
wordList curFaceZoneNames = mesh_.faceZones().names(); wordList curFaceZoneNames = mesh_.faceZones().toc();
if (curFaceZoneNames.size()) if (curFaceZoneNames.size())
{ {
@ -171,7 +171,7 @@ Foam::mergePolyMesh::mergePolyMesh(polyMesh& mesh)
faceZonesAddedFaces_.setSize(faceZoneNames_.size()); faceZonesAddedFaces_.setSize(faceZoneNames_.size());
// Cell zones // Cell zones
wordList curCellZoneNames = mesh_.cellZones().names(); wordList curCellZoneNames = mesh_.cellZones().toc();
if (curCellZoneNames.size()) if (curCellZoneNames.size())
{ {

View File

@ -1196,7 +1196,7 @@ void matchRegions
labelList zoneSizes(cellZones.size(), 0); labelList zoneSizes(cellZones.size(), 0);
{ {
List<wordList> zoneNames(Pstream::nProcs()); List<wordList> zoneNames(Pstream::nProcs());
zoneNames[Pstream::myProcNo()] = cellZones.names(); zoneNames[Pstream::myProcNo()] = cellZones.toc();
Pstream::gatherList(zoneNames); Pstream::gatherList(zoneNames);
Pstream::scatterList(zoneNames); Pstream::scatterList(zoneNames);

View File

@ -272,11 +272,11 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
// Determine zones // Determine zones
// ~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~
wordList pointZoneNames(mesh.pointZones().names()); wordList pointZoneNames(mesh.pointZones().toc());
Pstream::scatter(pointZoneNames); Pstream::scatter(pointZoneNames);
wordList faceZoneNames(mesh.faceZones().names()); wordList faceZoneNames(mesh.faceZones().toc());
Pstream::scatter(faceZoneNames); Pstream::scatter(faceZoneNames);
wordList cellZoneNames(mesh.cellZones().names()); wordList cellZoneNames(mesh.cellZones().toc());
Pstream::scatter(cellZoneNames); Pstream::scatter(cellZoneNames);
if (!haveMesh) if (!haveMesh)

View File

@ -261,7 +261,7 @@ void Foam::ensightMesh::correct()
// faceZones // faceZones
if (faceZones_) if (faceZones_)
{ {
wordList faceZoneNamesAll = mesh_.faceZones().names(); wordList faceZoneNamesAll = mesh_.faceZones().toc();
// Need to sort the list of all face zones since the index may vary // Need to sort the list of all face zones since the index may vary
// from processor to processor... // from processor to processor...
sort(faceZoneNamesAll); sort(faceZoneNamesAll);

View File

@ -148,7 +148,7 @@ int main(int argc, char *argv[])
if (args.optionFound("faceZones")) if (args.optionFound("faceZones"))
{ {
wordReList zoneNames(args.optionLookup("faceZones")()); wordReList zoneNames(args.optionLookup("faceZones")());
const wordList allZoneNames(mfz.names()); const wordList allZoneNames(mfz.toc());
forAll(zoneNames, i) forAll(zoneNames, i)
{ {
const wordRe& zoneName = zoneNames[i]; const wordRe& zoneName = zoneNames[i];

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -69,9 +69,56 @@ Foam::PtrListDictionary<T>::PtrListDictionary(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T> template<class T>
inline Foam::autoPtr<T> Foam::PtrListDictionary<T>::set Foam::label Foam::PtrListDictionary<T>::findIndex(const word& key) const
{
forAll(*this, i)
{
if (operator[](i).keyword() == key)
{
return i;
}
}
return -1;
}
template<class T>
Foam::List<Foam::label> Foam::PtrListDictionary<T>::findIndices
(
const wordRe& key
) const
{
List<label> indices;
if (!key.empty())
{
if (key.isPattern())
{
indices = findStrings(key, this->toc());
}
else
{
indices.setSize(this->size());
label nFound = 0;
forAll(*this, i)
{
if (key == operator[](i).keyword())
{
indices[nFound++] = i;
}
}
indices.setSize(nFound);
}
}
return indices;
}
template<class T>
inline void Foam::PtrListDictionary<T>::append
( (
const label i,
const word& key, const word& key,
T* ptr T* ptr
) )
@ -82,7 +129,50 @@ inline Foam::autoPtr<T> Foam::PtrListDictionary<T>::set
<< "Cannot insert with key '" << key << "' into hash-table" << "Cannot insert with key '" << key << "' into hash-table"
<< abort(FatalError); << abort(FatalError);
} }
return PtrList<T>::set(i, ptr); return PtrList<T>::append(ptr);
}
template<class T>
inline void Foam::PtrListDictionary<T>::append
(
const word& key,
const autoPtr<T>& aptr
)
{
return append(key, const_cast<autoPtr<T>&>(aptr).ptr());
}
template<class T>
inline void Foam::PtrListDictionary<T>::append
(
const word& key,
const tmp<T>& t
)
{
return append(key, const_cast<tmp<T>&>(t).ptr());
}
template<class T>
inline void Foam::PtrListDictionary<T>::append(T* ptr)
{
append(ptr->keyword(), ptr);
}
template<class T>
inline void Foam::PtrListDictionary<T>::append(const autoPtr<T>& aptr)
{
append(aptr->keyword(), aptr);
}
template<class T>
inline void Foam::PtrListDictionary<T>::append(const tmp<T>& t)
{
append(t->keyword(), t);
} }
@ -91,14 +181,13 @@ inline Foam::autoPtr<T> Foam::PtrListDictionary<T>::set
( (
const label i, const label i,
const word& key, const word& key,
autoPtr<T>& aptr T* ptr
) )
{ {
T* ptr = aptr.ptr(); if (!DictionaryBase<PtrList<T>, T>::hashedTs_.set(key, ptr))
if (!DictionaryBase<PtrList<T>, T>::hashedTs_.insert(key, ptr))
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Cannot insert with key '" << key << "' into hash-table" << "Cannot set with key '" << key << "' into hash-table"
<< abort(FatalError); << abort(FatalError);
} }
return PtrList<T>::set(i, ptr); return PtrList<T>::set(i, ptr);
@ -110,17 +199,55 @@ inline Foam::autoPtr<T> Foam::PtrListDictionary<T>::set
( (
const label i, const label i,
const word& key, const word& key,
tmp<T>& t const autoPtr<T>& aptr
) )
{ {
T* ptr = t.ptr(); return set(i, key, const_cast<autoPtr<T>&>(aptr).ptr());
if (!DictionaryBase<PtrList<T>, T>::hashedTs_.insert(key, ptr)) }
{
FatalErrorInFunction
<< "Cannot insert with key '" << key << "' into hash-table" template<class T>
<< abort(FatalError); inline Foam::autoPtr<T> Foam::PtrListDictionary<T>::set
} (
return PtrList<T>::set(i, ptr); const label i,
const word& key,
const tmp<T>& t
)
{
return set(i, key, const_cast<tmp<T>&>(t).ptr());
}
template<class T>
inline Foam::autoPtr<T> Foam::PtrListDictionary<T>::set
(
const label i,
T* ptr
)
{
return set(i, ptr->keyword(), ptr);
}
template<class T>
inline Foam::autoPtr<T> Foam::PtrListDictionary<T>::set
(
const label i,
const autoPtr<T>& aptr
)
{
return set(i, aptr->keyword(), aptr);
}
template<class T>
inline Foam::autoPtr<T> Foam::PtrListDictionary<T>::set
(
const label i,
const tmp<T>& t
)
{
return set(i, t->keyword(), t);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -40,6 +40,7 @@ SourceFiles
#include "DictionaryBase.H" #include "DictionaryBase.H"
#include "PtrList.H" #include "PtrList.H"
#include "wordRe.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -88,14 +89,59 @@ public:
// Member Functions // Member Functions
// Access
//- Return the index of the given the key or -1 if not found
label findIndex(const word& key) const;
//- Return the indices for all matches
// of the given key regular expression
List<label> findIndices(const wordRe& key) const;
// Edit
//- Append an element at the end of the list
inline void append(const word& key, T*);
//- Append an element at the end of the list
inline void append(const word& key, const autoPtr<T>&);
//- Append an element at the end of the list
inline void append(const word& key, const tmp<T>&);
//- Append an element at the end of the list
// using the element's keyword as the key
inline void append(T*);
//- Append an element at the end of the list
// using the element's keyword as the key
inline void append(const autoPtr<T>&);
//- Append an element at the end of the list
// using the element's keyword as the key
inline void append(const tmp<T>&);
//- Set element to pointer provided and return old element //- Set element to pointer provided and return old element
autoPtr<T> set(const label, const word& key, T*); autoPtr<T> set(const label, const word& key, T*);
//- Set element to autoPtr value provided and return old element //- Set element to autoPtr value provided and return old element
autoPtr<T> set(const label, const word& key, autoPtr<T>&); autoPtr<T> set(const label, const word& key, const autoPtr<T>&);
//- Set element to tmp value provided and return old element //- Set element to tmp value provided and return old element
autoPtr<T> set(const label, const word& key, tmp<T>&); autoPtr<T> set(const label, const word& key, const tmp<T>&);
//- Set element to pointer provided and return old element
// using the element's keyword as the key
autoPtr<T> set(const label, T*);
//- Set element to autoPtr value provided and return old element
// using the element's keyword as the key
autoPtr<T> set(const label, const autoPtr<T>&);
//- Set element to tmp value provided and return old element
// using the element's keyword as the key
autoPtr<T> set(const label, const tmp<T>&);
// Conversion // Conversion

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -98,6 +98,12 @@ Foam::functionObjects::logFiles::~logFiles()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::wordList& Foam::functionObjects::logFiles::toc() const
{
return names_;
}
const Foam::wordList& Foam::functionObjects::logFiles::names() const const Foam::wordList& Foam::functionObjects::logFiles::names() const
{ {
return names_; return names_;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -107,7 +107,10 @@ public:
// Member Functions // Member Functions
//- Return const access to the names //- Return the list of log file names
const wordList& toc() const;
//- Return the list of log file names
const wordList& names() const; const wordList& names() const;
//- Return access to the files //- Return access to the files

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -567,7 +567,7 @@ void Foam::polyBoundaryMesh::setGroup
} }
Foam::wordList Foam::polyBoundaryMesh::names() const Foam::wordList Foam::polyBoundaryMesh::toc() const
{ {
const polyPatchList& patches = *this; const polyPatchList& patches = *this;
@ -582,6 +582,12 @@ Foam::wordList Foam::polyBoundaryMesh::names() const
} }
Foam::wordList Foam::polyBoundaryMesh::names() const
{
return toc();
}
Foam::wordList Foam::polyBoundaryMesh::types() const Foam::wordList Foam::polyBoundaryMesh::types() const
{ {
const polyPatchList& patches = *this; const polyPatchList& patches = *this;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -153,7 +153,10 @@ public:
// Only valid for singly connected polyBoundaryMesh and not parallel // Only valid for singly connected polyBoundaryMesh and not parallel
const List<labelPairList>& nbrEdges() const; const List<labelPairList>& nbrEdges() const;
//- Return a list of patch names //- Return the list of patch names
wordList toc() const;
//- Return the list of patch names
wordList names() const; wordList names() const;
//- Return a list of patch types //- Return a list of patch types

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -1144,7 +1144,7 @@ void Foam::polyMesh::addZones
// Copy the zone pointers // Copy the zone pointers
forAll(pz, pI) forAll(pz, pI)
{ {
pointZones_.set(pI, pz[pI]); pointZones_.set(pI, pz[pI]->name(), pz[pI]);
} }
pointZones_.writeOpt() = IOobject::AUTO_WRITE; pointZones_.writeOpt() = IOobject::AUTO_WRITE;
@ -1158,7 +1158,7 @@ void Foam::polyMesh::addZones
// Copy the zone pointers // Copy the zone pointers
forAll(fz, fI) forAll(fz, fI)
{ {
faceZones_.set(fI, fz[fI]); faceZones_.set(fI, fz[fI]->name(), fz[fI]);
} }
faceZones_.writeOpt() = IOobject::AUTO_WRITE; faceZones_.writeOpt() = IOobject::AUTO_WRITE;
@ -1172,7 +1172,7 @@ void Foam::polyMesh::addZones
// Copy the zone pointers // Copy the zone pointers
forAll(cz, cI) forAll(cz, cI)
{ {
cellZones_.set(cI, cz[cI]); cellZones_.set(cI, cz[cI]->name(), cz[cI]);
} }
cellZones_.writeOpt() = IOobject::AUTO_WRITE; cellZones_.writeOpt() = IOobject::AUTO_WRITE;

View File

@ -183,6 +183,12 @@ public:
return name_; return name_;
} }
//- Return name as the keyword
const word& keyword() const
{
return name_;
}
//- Return ZonesType reference //- Return ZonesType reference
const ZonesType& zones() const; const ZonesType& zones() const;

View File

@ -47,7 +47,7 @@ bool Foam::Zones<ZoneType, ZonesType, MeshType>::read()
<< endl; << endl;
} }
PtrList<ZoneType>& zones = *this; PtrListDictionary<ZoneType>& zones = *this;
// Read zones // Read zones
Istream& is = readStream(typeName); Istream& is = readStream(typeName);
@ -60,6 +60,7 @@ bool Foam::Zones<ZoneType, ZonesType, MeshType>::read()
zones.set zones.set
( (
zi, zi,
patchEntries[zi].keyword(),
ZoneType::New ZoneType::New
( (
patchEntries[zi].keyword(), patchEntries[zi].keyword(),
@ -97,8 +98,8 @@ Foam::Zones<ZoneType, ZonesType, MeshType>::Zones
const MeshType& mesh const MeshType& mesh
) )
: :
PtrList<ZoneType>(),
regIOobject(io), regIOobject(io),
PtrListDictionary<ZoneType>(0),
mesh_(mesh) mesh_(mesh)
{ {
read(); read();
@ -113,8 +114,8 @@ Foam::Zones<ZoneType, ZonesType, MeshType>::Zones
const label size const label size
) )
: :
PtrList<ZoneType>(size),
regIOobject(io), regIOobject(io),
PtrListDictionary<ZoneType>(size),
mesh_(mesh) mesh_(mesh)
{ {
// Optionally read contents, otherwise keep size // Optionally read contents, otherwise keep size
@ -130,21 +131,26 @@ Foam::Zones<ZoneType, ZonesType, MeshType>::Zones
const PtrList<ZoneType>& mpz const PtrList<ZoneType>& mpz
) )
: :
PtrList<ZoneType>(),
regIOobject(io), regIOobject(io),
PtrListDictionary<ZoneType>(0),
mesh_(mesh) mesh_(mesh)
{ {
if (!read()) if (!read())
{ {
// Nothing read. Use supplied zones // Nothing read. Use supplied zones
PtrList<ZoneType>& zones = *this; PtrListDictionary<ZoneType>& zones = *this;
zones.setSize(mpz.size()); zones.setSize(mpz.size());
forAll(zones, zi) forAll(zones, zi)
{ {
zones.set(zi, mpz[zi].clone zones.set
(
zi,
mpz[zi].name(),
mpz[zi].clone
( (
static_cast<const ZonesType&>(*this) static_cast<const ZonesType&>(*this)
).ptr()); )
);
} }
} }
} }
@ -202,7 +208,7 @@ Foam::labelList Foam::Zones<ZoneType, ZonesType, MeshType>::whichZones
template<class ZoneType, class ZonesType, class MeshType> template<class ZoneType, class ZonesType, class MeshType>
Foam::wordList Foam::Zones<ZoneType, ZonesType, MeshType>::types() const Foam::wordList Foam::Zones<ZoneType, ZonesType, MeshType>::types() const
{ {
const PtrList<ZoneType>& zones = *this; const PtrListDictionary<ZoneType>& zones = *this;
wordList lst(zones.size()); wordList lst(zones.size());
@ -215,124 +221,6 @@ Foam::wordList Foam::Zones<ZoneType, ZonesType, MeshType>::types() const
} }
template<class ZoneType, class ZonesType, class MeshType>
Foam::wordList Foam::Zones<ZoneType, ZonesType, MeshType>::names() const
{
const PtrList<ZoneType>& zones = *this;
wordList lst(zones.size());
forAll(zones, zi)
{
lst[zi] = zones[zi].name();
}
return lst;
}
template<class ZoneType, class ZonesType, class MeshType>
bool Foam::Zones<ZoneType, ZonesType, MeshType>::found
(
const word& zoneName
) const
{
if (zoneName != word::null)
{
forAll(*this, i)
{
if (zoneName == operator[](i).name())
{
return true;
}
}
}
// Not found
return false;
}
template<class ZoneType, class ZonesType, class MeshType>
Foam::label Foam::Zones<ZoneType, ZonesType, MeshType>::findIndex
(
const word& zoneName
) const
{
const PtrList<ZoneType>& zones = *this;
forAll(zones, zi)
{
if (zones[zi].name() == zoneName)
{
return zi;
}
}
// Zone not found
if (debug)
{
InfoInFunction
<< "Zone named " << zoneName << " not found. "
<< "List of available zone names: " << names() << endl;
}
// not found
return -1;
}
template<class ZoneType, class ZonesType, class MeshType>
Foam::labelList Foam::Zones<ZoneType, ZonesType, MeshType>::findIndices
(
const wordRe& key
) const
{
labelList indices;
if (!key.empty())
{
if (key.isPattern())
{
indices = findStrings(key, this->names());
}
else
{
indices.setSize(this->size());
label nFound = 0;
forAll(*this, i)
{
if (key == operator[](i).name())
{
indices[nFound++] = i;
}
}
indices.setSize(nFound);
}
}
return indices;
}
template<class ZoneType, class ZonesType, class MeshType>
Foam::PackedBoolList Foam::Zones<ZoneType, ZonesType, MeshType>::findMatching
(
const wordRe& key
) const
{
PackedBoolList lst;
const labelList indices = this->findIndices(key);
forAll(indices, i)
{
lst |= static_cast<const labelList&>(this->operator[](indices[i]));
}
return lst;
}
template<class ZoneType, class ZonesType, class MeshType> template<class ZoneType, class ZonesType, class MeshType>
void Foam::Zones<ZoneType, ZonesType, MeshType>::append(ZoneType* zonePtr) const void Foam::Zones<ZoneType, ZonesType, MeshType>::append(ZoneType* zonePtr) const
{ {
@ -346,7 +234,11 @@ void Foam::Zones<ZoneType, ZonesType, MeshType>::append(ZoneType* zonePtr) const
} }
else else
{ {
zones.PtrList<ZoneType>::append(zonePtr); zones.PtrListDictionary<ZoneType>::append
(
zonePtr->name(),
zonePtr
);
} }
} }
@ -366,7 +258,11 @@ void Foam::Zones<ZoneType, ZonesType, MeshType>::append
} }
else else
{ {
zones.PtrList<ZoneType>::append(zone.clone(*this)); zones.PtrListDictionary<ZoneType>::append
(
zone.name(),
zone.clone(*this)
);
} }
} }
@ -374,7 +270,7 @@ void Foam::Zones<ZoneType, ZonesType, MeshType>::append
template<class ZoneType, class ZonesType, class MeshType> template<class ZoneType, class ZonesType, class MeshType>
void Foam::Zones<ZoneType, ZonesType, MeshType>::clearAddressing() void Foam::Zones<ZoneType, ZonesType, MeshType>::clearAddressing()
{ {
PtrList<ZoneType>& zones = *this; PtrListDictionary<ZoneType>& zones = *this;
forAll(zones, zi) forAll(zones, zi)
{ {
@ -387,7 +283,7 @@ template<class ZoneType, class ZonesType, class MeshType>
void Foam::Zones<ZoneType, ZonesType, MeshType>::clear() void Foam::Zones<ZoneType, ZonesType, MeshType>::clear()
{ {
clearAddressing(); clearAddressing();
PtrList<ZoneType>::clear(); PtrListDictionary<ZoneType>::clear();
} }
@ -399,7 +295,7 @@ bool Foam::Zones<ZoneType, ZonesType, MeshType>::checkDefinition
{ {
bool inError = false; bool inError = false;
const PtrList<ZoneType>& zones = *this; const PtrListDictionary<ZoneType>& zones = *this;
forAll(zones, zi) forAll(zones, zi)
{ {
@ -421,13 +317,13 @@ bool Foam::Zones<ZoneType, ZonesType, MeshType>::checkParallelSync
} }
const PtrList<ZoneType>& zones = *this; const PtrListDictionary<ZoneType>& zones = *this;
bool hasError = false; bool hasError = false;
// Collect all names // Collect all names
List<wordList> allNames(Pstream::nProcs()); List<wordList> allNames(Pstream::nProcs());
allNames[Pstream::myProcNo()] = this->names(); allNames[Pstream::myProcNo()] = this->toc();
Pstream::gatherList(allNames); Pstream::gatherList(allNames);
Pstream::scatterList(allNames); Pstream::scatterList(allNames);
@ -493,7 +389,7 @@ void Foam::Zones<ZoneType, ZonesType, MeshType>::insert
const List<labelHashSet>& zonesIndices const List<labelHashSet>& zonesIndices
) )
{ {
PtrList<ZoneType>& zones = *this; PtrListDictionary<ZoneType>& zones = *this;
if (zonesIndices.size() != zones.size()) if (zonesIndices.size() != zones.size())
{ {
@ -513,7 +409,7 @@ void Foam::Zones<ZoneType, ZonesType, MeshType>::insert
template<class ZoneType, class ZonesType, class MeshType> template<class ZoneType, class ZonesType, class MeshType>
void Foam::Zones<ZoneType, ZonesType, MeshType>::movePoints(const pointField& p) void Foam::Zones<ZoneType, ZonesType, MeshType>::movePoints(const pointField& p)
{ {
PtrList<ZoneType>& zones = *this; PtrListDictionary<ZoneType>& zones = *this;
forAll(zones, zi) forAll(zones, zi)
{ {
@ -528,7 +424,7 @@ void Foam::Zones<ZoneType, ZonesType, MeshType>::topoChange
const polyTopoChangeMap& map const polyTopoChangeMap& map
) )
{ {
PtrList<ZoneType>& zones = *this; PtrListDictionary<ZoneType>& zones = *this;
forAll(zones, zi) forAll(zones, zi)
{ {
@ -540,7 +436,7 @@ void Foam::Zones<ZoneType, ZonesType, MeshType>::topoChange
template<class ZoneType, class ZonesType, class MeshType> template<class ZoneType, class ZonesType, class MeshType>
void Foam::Zones<ZoneType, ZonesType, MeshType>::mapMesh(const polyMeshMap& map) void Foam::Zones<ZoneType, ZonesType, MeshType>::mapMesh(const polyMeshMap& map)
{ {
PtrList<ZoneType>& zones = *this; PtrListDictionary<ZoneType>& zones = *this;
forAll(zones, zi) forAll(zones, zi)
{ {
@ -555,7 +451,7 @@ void Foam::Zones<ZoneType, ZonesType, MeshType>::distribute
const polyDistributionMap& map const polyDistributionMap& map
) )
{ {
PtrList<ZoneType>& zones = *this; PtrListDictionary<ZoneType>& zones = *this;
forAll(zones, zi) forAll(zones, zi)
{ {
@ -570,7 +466,7 @@ void Foam::Zones<ZoneType, ZonesType, MeshType>::swap(ZonesType& otherZones)
clearAddressing(); clearAddressing();
otherZones.clearAddressing(); otherZones.clearAddressing();
PtrList<ZoneType>& zones = *this; PtrListDictionary<ZoneType>& zones = *this;
DynamicList<label> toOtherZone; DynamicList<label> toOtherZone;
@ -586,15 +482,19 @@ void Foam::Zones<ZoneType, ZonesType, MeshType>::swap(ZonesType& otherZones)
forAll(otherZones, ozi) forAll(otherZones, ozi)
{ {
const label zi = findIndex(otherZones[ozi].name()); const label zi = this->findIndex(otherZones[ozi].name());
if (zi < 0) if (zi < 0)
{ {
zones.append(otherZones[ozi].clone zones.append
( (
static_cast<const ZonesType&>(*this)) otherZones[ozi].name(),
otherZones[ozi].clone
(
static_cast<const ZonesType&>(*this)
)
); );
otherZones.set(ozi, nullptr); otherZones.set(ozi, otherZones[ozi].name(), nullptr);
} }
else else
{ {
@ -604,11 +504,12 @@ void Foam::Zones<ZoneType, ZonesType, MeshType>::swap(ZonesType& otherZones)
forAll(toOtherZone, i) forAll(toOtherZone, i)
{ {
otherZones.PtrList<ZoneType>::append otherZones.PtrListDictionary<ZoneType>::append
( (
zones[toOtherZone[i]].name(),
zones[toOtherZone[i]].clone(otherZones) zones[toOtherZone[i]].clone(otherZones)
); );
zones.set(toOtherZone[i], nullptr); zones.set(toOtherZone[i], zones[toOtherZone[i]].name(), nullptr);
} }
zones.shrink(); zones.shrink();
@ -624,48 +525,6 @@ bool Foam::Zones<ZoneType, ZonesType, MeshType>::writeData(Ostream& os) const
} }
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
template<class ZoneType, class ZonesType, class MeshType>
const ZoneType& Foam::Zones<ZoneType, ZonesType, MeshType>::operator[]
(
const word& zoneName
) const
{
const label zi = findIndex(zoneName);
if (zi < 0)
{
FatalErrorInFunction
<< "Zone named " << zoneName << " not found." << nl
<< "Available zone names: " << names() << endl
<< abort(FatalError);
}
return operator[](zi);
}
template<class ZoneType, class ZonesType, class MeshType>
ZoneType& Foam::Zones<ZoneType, ZonesType, MeshType>::operator[]
(
const word& zoneName
)
{
const label zi = findIndex(zoneName);
if (zi < 0)
{
FatalErrorInFunction
<< "Zone named " << zoneName << " not found." << nl
<< "Available zone names: " << names() << endl
<< abort(FatalError);
}
return operator[](zi);
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class ZoneType, class ZonesType, class MeshType> template<class ZoneType, class ZonesType, class MeshType>

View File

@ -35,6 +35,7 @@ SourceFiles
#ifndef Zones_H #ifndef Zones_H
#define Zones_H #define Zones_H
#include "PtrListDictionary.H"
#include "regIOobject.H" #include "regIOobject.H"
#include "pointFieldFwd.H" #include "pointFieldFwd.H"
#include "Map.H" #include "Map.H"
@ -66,8 +67,8 @@ Ostream& operator<<(Ostream&, const Zones<ZoneType, ZonesType, MeshType>&);
template<class ZoneType, class ZonesType, class MeshType> template<class ZoneType, class ZonesType, class MeshType>
class Zones class Zones
: :
public PtrList<ZoneType>, public regIOobject,
public regIOobject public PtrListDictionary<ZoneType>
{ {
// Private Data // Private Data
@ -127,6 +128,8 @@ public:
return mesh_; return mesh_;
} }
using PtrListDictionary<ZoneType>::found;
//- Return true if objectIndex is in any zone //- Return true if objectIndex is in any zone
bool found(const label objectIndex) const; bool found(const label objectIndex) const;
@ -136,21 +139,6 @@ public:
//- Return a list of zone types //- Return a list of zone types
wordList types() const; wordList types() const;
//- Return a list of zone names
wordList names() const;
//- Return true if the given zoneName is present
bool found(const word& zoneName) const;
//- Find the zone index given the zone name
label findIndex(const word& zoneName) const;
//- Find and return the zone indices for all matches
labelList findIndices(const wordRe&) const;
//- Mark cells that match the zone specification
PackedBoolList findMatching(const wordRe&) const;
//- Append or update a zone //- Append or update a zone
void append(ZoneType*) const; void append(ZoneType*) const;
@ -196,13 +184,7 @@ public:
// Member Operators // Member Operators
//- Return const and non-const reference to ZoneType by index. //- Return const and non-const reference to ZoneType by index.
using PtrList<ZoneType>::operator[]; using PtrListDictionary<ZoneType>::operator[];
//- Return const reference to ZoneType by name.
const ZoneType& operator[](const word&) const;
//- Return reference to ZoneType by name.
ZoneType& operator[](const word&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const Zones<ZoneType, ZonesType, MeshType>&) = delete; void operator=(const Zones<ZoneType, ZonesType, MeshType>&) = delete;

View File

@ -70,7 +70,7 @@ lookup
void Foam::meshReader::addCellZones(polyMesh& mesh) const void Foam::meshReader::addCellZones(polyMesh& mesh) const
{ {
cellTable_.addCellZones(mesh, cellTableId_); cellTable_.addCellZones(mesh, cellTableId_);
warnDuplicates("cellZones", mesh.cellZones().names()); warnDuplicates("cellZones", mesh.cellZones().toc());
} }
@ -112,7 +112,7 @@ void Foam::meshReader::addFaceZones(polyMesh& mesh) const
nZone++; nZone++;
} }
mesh.faceZones().writeOpt() = IOobject::AUTO_WRITE; mesh.faceZones().writeOpt() = IOobject::AUTO_WRITE;
warnDuplicates("faceZones", mesh.faceZones().names()); warnDuplicates("faceZones", mesh.faceZones().toc());
} }

View File

@ -399,7 +399,7 @@ void Foam::cellTable::operator=(const polyMesh& mesh)
// create cellTableId and cellTable based on cellZones // create cellTableId and cellTable based on cellZones
label nZoneCells = 0; label nZoneCells = 0;
wordList zoneNames = mesh.cellZones().names(); wordList zoneNames = mesh.cellZones().toc();
label unZonedType = zoneNames.size() + 1; label unZonedType = zoneNames.size() + 1;
// do cell zones // do cell zones

View File

@ -292,14 +292,14 @@ void Foam::singleCellFvMesh::agglomerateMesh
{ {
forAll(mesh.cellZones(), zoneI) forAll(mesh.cellZones(), zoneI)
{ {
const cellZone& oldFz = mesh.cellZones()[zoneI]; const cellZone& oldCz = mesh.cellZones()[zoneI];
DynamicList<label> newAddressing; DynamicList<label> newAddressing;
cellZones().set cellZones().set
( (
zoneI, zoneI,
oldFz.clone oldCz.clone
( (
newAddressing, newAddressing,
cellZones() cellZones()
@ -348,13 +348,13 @@ void Foam::singleCellFvMesh::agglomerateMesh
{ {
forAll(mesh.pointZones(), zoneI) forAll(mesh.pointZones(), zoneI)
{ {
const pointZone& oldFz = mesh.pointZones()[zoneI]; const pointZone& oldPz = mesh.pointZones()[zoneI];
DynamicList<label> newAddressing(oldFz.size()); DynamicList<label> newAddressing(oldPz.size());
forAll(oldFz, i) forAll(oldPz, i)
{ {
label newPointi = reversePointMap_[oldFz[i]]; label newPointi = reversePointMap_[oldPz[i]];
if (newPointi != -1) if (newPointi != -1)
{ {
newAddressing.append(newPointi); newAddressing.append(newPointi);
@ -364,7 +364,7 @@ void Foam::singleCellFvMesh::agglomerateMesh
pointZones().set pointZones().set
( (
zoneI, zoneI,
oldFz.clone oldPz.clone
( (
newAddressing, newAddressing,
pointZones() pointZones()

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -112,7 +112,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
<< selectionTypeNames[selectionType_] << selectionTypeNames[selectionType_]
<< "(" << selectionName_ << "):" << nl << "(" << selectionName_ << "):" << nl
<< " Unknown face zone name: " << selectionName_ << " Unknown face zone name: " << selectionName_
<< ". Valid face zones are: " << mesh_.faceZones().names() << ". Valid face zones are: " << mesh_.faceZones().toc()
<< nl << exit(FatalError); << nl << exit(FatalError);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -250,7 +250,7 @@ bool Foam::functionObjects::layerAverage::read(const dictionary& dict)
findStrings findStrings
( (
dict.lookupOrDefault<wordReList>("zones", wordReList()), dict.lookupOrDefault<wordReList>("zones", wordReList()),
mesh_.faceZones().names() mesh_.faceZones().toc()
); );
if (patchIndices_.empty() && zoneIndices_.empty()) if (patchIndices_.empty() && zoneIndices_.empty())

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -75,7 +75,7 @@ void Foam::fv::effectivenessHeatExchanger::setZone()
FatalErrorInFunction FatalErrorInFunction
<< type() << " " << this->name() << ": " << type() << " " << this->name() << ": "
<< " Unknown face zone name: " << faceZoneName_ << " Unknown face zone name: " << faceZoneName_
<< ". Valid face zones are: " << mesh().faceZones().names() << ". Valid face zones are: " << mesh().faceZones().toc()
<< nl << exit(FatalError); << nl << exit(FatalError);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -223,7 +223,7 @@ void Foam::CellZoneInjection<CloudType>::topoChange()
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unknown cell zone name: " << cellZoneName_ << "Unknown cell zone name: " << cellZoneName_
<< ". Valid cell zones are: " << mesh.cellZones().names() << ". Valid cell zones are: " << mesh.cellZones().toc()
<< nl << exit(FatalError); << nl << exit(FatalError);
} }

View File

@ -1807,7 +1807,7 @@ void Foam::meshRefinement::checkCoupledFaceZones(const polyMesh& mesh)
{ {
List<wordList> zoneNames(Pstream::nProcs()); List<wordList> zoneNames(Pstream::nProcs());
zoneNames[Pstream::myProcNo()] = fZones.names(); zoneNames[Pstream::myProcNo()] = fZones.toc();
Pstream::gatherList(zoneNames); Pstream::gatherList(zoneNames);
Pstream::scatterList(zoneNames); Pstream::scatterList(zoneNames);
// All have same data now. Check. // All have same data now. Check.

View File

@ -374,7 +374,7 @@ Foam::labelList Foam::surfaceZonesInfo::addCellZonesToMesh
// Check they are synced // Check they are synced
List<wordList> allCellZones(Pstream::nProcs()); List<wordList> allCellZones(Pstream::nProcs());
allCellZones[Pstream::myProcNo()] = cellZones.names(); allCellZones[Pstream::myProcNo()] = cellZones.toc();
Pstream::gatherList(allCellZones); Pstream::gatherList(allCellZones);
Pstream::scatterList(allCellZones); Pstream::scatterList(allCellZones);
@ -436,7 +436,7 @@ Foam::labelList Foam::surfaceZonesInfo::addFaceZonesToMesh
// Check they are synced // Check they are synced
List<wordList> allFaceZones(Pstream::nProcs()); List<wordList> allFaceZones(Pstream::nProcs());
allFaceZones[Pstream::myProcNo()] = faceZones.names(); allFaceZones[Pstream::myProcNo()] = faceZones.toc();
Pstream::gatherList(allFaceZones); Pstream::gatherList(allFaceZones);
Pstream::scatterList(allFaceZones); Pstream::scatterList(allFaceZones);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -91,7 +91,7 @@ void Foam::faceZoneToCell::combine(topoSet& set, const bool add) const
{ {
WarningInFunction WarningInFunction
<< "Cannot find any faceZone named " << zoneName_ << endl << "Cannot find any faceZone named " << zoneName_ << endl
<< "Valid names are " << mesh_.faceZones().names() << endl; << "Valid names are " << mesh_.faceZones().toc() << endl;
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -71,7 +71,7 @@ void Foam::zoneToCell::combine(topoSet& set, const bool add) const
{ {
WarningInFunction WarningInFunction
<< "Cannot find any cellZone named " << zoneName_ << endl << "Cannot find any cellZone named " << zoneName_ << endl
<< "Valid names are " << mesh_.cellZones().names() << endl; << "Valid names are " << mesh_.cellZones().toc() << endl;
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -71,7 +71,7 @@ void Foam::zoneToFace::combine(topoSet& set, const bool add) const
{ {
WarningInFunction WarningInFunction
<< "Cannot find any faceZone named " << zoneName_ << endl << "Cannot find any faceZone named " << zoneName_ << endl
<< "Valid names are " << mesh_.faceZones().names() << endl; << "Valid names are " << mesh_.faceZones().toc() << endl;
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -72,7 +72,7 @@ void Foam::zoneToPoint::combine(topoSet& set, const bool add) const
{ {
WarningInFunction WarningInFunction
<< "Cannot find any pointZone named " << zoneName_ << endl << "Cannot find any pointZone named " << zoneName_ << endl
<< "Valid names are " << mesh_.pointZones().names() << endl; << "Valid names are " << mesh_.pointZones().toc() << endl;
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -102,7 +102,7 @@ void Foam::polyCellSet::setCells()
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Cannot find cellZone " << cellSetName_ << endl << "Cannot find cellZone " << cellSetName_ << endl
<< "Valid cellZones are " << mesh_.cellZones().names() << "Valid cellZones are " << mesh_.cellZones().toc()
<< exit(FatalError); << exit(FatalError);
} }

View File

@ -309,7 +309,7 @@ void Foam::displacementLayeredMotionMotionSolver::cellZoneSolve
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Cannot find faceZone " << faceZoneName << "Cannot find faceZone " << faceZoneName
<< endl << "Valid zones are " << mesh().faceZones().names() << endl << "Valid zones are " << mesh().faceZones().toc()
<< exit(FatalError); << exit(FatalError);
} }
@ -543,7 +543,7 @@ void Foam::displacementLayeredMotionMotionSolver::solve()
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Cannot find cellZone " << cellZoneName << "Cannot find cellZone " << cellZoneName
<< endl << "Valid zones are " << mesh().cellZones().names() << endl << "Valid zones are " << mesh().cellZones().toc()
<< exit(FatalError); << exit(FatalError);
} }

View File

@ -72,7 +72,7 @@ Foam::multiSolidBodyMotionSolver::multiSolidBodyMotionSolver
( (
coeffDict() coeffDict()
) << "Cannot find cellZone named " << iter().keyword() ) << "Cannot find cellZone named " << iter().keyword()
<< ". Valid zones are " << mesh.cellZones().names() << ". Valid zones are " << mesh.cellZones().toc()
<< exit(FatalIOError); << exit(FatalIOError);
} }

View File

@ -99,7 +99,7 @@ void Foam::decompositionConstraints::preserveFaceZonesConstraint::add
const faceZones& fZones = mesh.faceZones(); const faceZones& fZones = mesh.faceZones();
const labelList zoneIDs = findStrings(zones_, fZones.names()); const labelList zoneIDs = findStrings(zones_, fZones.toc());
label nUnblocked = 0; label nUnblocked = 0;
@ -169,7 +169,7 @@ void Foam::decompositionConstraints::preserveFaceZonesConstraint::apply
const faceZones& fZones = mesh.faceZones(); const faceZones& fZones = mesh.faceZones();
const labelList zoneIDs = findStrings(zones_, fZones.names()); const labelList zoneIDs = findStrings(zones_, fZones.toc());
label nChanged = 0; label nChanged = 0;

View File

@ -1879,9 +1879,9 @@ Foam::autoPtr<Foam::polyDistributionMap> Foam::fvMeshDistribute::distribute
// Collect any zone names // Collect any zone names
const wordList pointZoneNames(mergeWordList(mesh_.pointZones().names())); const wordList pointZoneNames(mergeWordList(mesh_.pointZones().toc()));
const wordList faceZoneNames(mergeWordList(mesh_.faceZones().names())); const wordList faceZoneNames(mergeWordList(mesh_.faceZones().toc()));
const wordList cellZoneNames(mergeWordList(mesh_.cellZones().names())); const wordList cellZoneNames(mergeWordList(mesh_.cellZones().toc()));
// Local environment of all boundary faces // Local environment of all boundary faces

View File

@ -573,7 +573,7 @@ void Foam::polyMeshAdder::mergePointZones
) )
{ {
zoneNames.setCapacity(pz0.size() + pz1.size()); zoneNames.setCapacity(pz0.size() + pz1.size());
zoneNames.append(pz0.names()); zoneNames.append(pz0.toc());
from1ToAll.setSize(pz1.size()); from1ToAll.setSize(pz1.size());
@ -719,7 +719,7 @@ void Foam::polyMeshAdder::mergeFaceZones
zoneNames.setCapacity(fz0.size() + fz1.size()); zoneNames.setCapacity(fz0.size() + fz1.size());
zoneNames.append(fz0.names()); zoneNames.append(fz0.toc());
from1ToAll.setSize(fz1.size()); from1ToAll.setSize(fz1.size());
@ -900,7 +900,7 @@ void Foam::polyMeshAdder::mergeCellZones
) )
{ {
zoneNames.setCapacity(cz0.size() + cz1.size()); zoneNames.setCapacity(cz0.size() + cz1.size());
zoneNames.append(cz0.names()); zoneNames.append(cz0.toc());
from1ToAll.setSize(cz1.size()); from1ToAll.setSize(cz1.size());
forAll(cz1, zoneI) forAll(cz1, zoneI)