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

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

View File

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

View File

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