diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C index a9952b293e..0666eec59b 100644 --- a/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -1209,7 +1209,7 @@ int main(int argc, char *argv[]) { FatalIOErrorIn(args.executable().c_str(), dict) << "Cannot find zone " << zoneNames[zonei] - << endl << "Valid zones are " << mesh.faceZones().names() + << endl << "Valid zones are " << mesh.faceZones().toc() << exit(FatalIOError); } @@ -1222,7 +1222,7 @@ int main(int argc, char *argv[]) { FatalIOErrorIn(args.executable().c_str(), dict) << "Cannot find opposite zone " << oppositeZoneNames[zonei] - << endl << "Valid zones are " << mesh.faceZones().names() + << endl << "Valid zones are " << mesh.faceZones().toc() << exit(FatalIOError); } } diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.C b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.C index 1d4450571c..0ffad0fd5a 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.C +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.C @@ -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); } diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C index 4e6065ab93..45b80bc907 100644 --- a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C +++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C @@ -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()) { diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index ec57a96e8d..afdcd89e0a 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -1196,7 +1196,7 @@ void matchRegions labelList zoneSizes(cellZones.size(), 0); { List zoneNames(Pstream::nProcs()); - zoneNames[Pstream::myProcNo()] = cellZones.names(); + zoneNames[Pstream::myProcNo()] = cellZones.toc(); Pstream::gatherList(zoneNames); Pstream::scatterList(zoneNames); diff --git a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C index 16206b13ea..a32fed2d92 100644 --- a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C +++ b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C @@ -272,11 +272,11 @@ Foam::autoPtr Foam::loadOrCreateMesh // Determine zones // ~~~~~~~~~~~~~~~ - wordList pointZoneNames(mesh.pointZones().names()); + wordList pointZoneNames(mesh.pointZones().toc()); Pstream::scatter(pointZoneNames); - wordList faceZoneNames(mesh.faceZones().names()); + wordList faceZoneNames(mesh.faceZones().toc()); Pstream::scatter(faceZoneNames); - wordList cellZoneNames(mesh.cellZones().names()); + wordList cellZoneNames(mesh.cellZones().toc()); Pstream::scatter(cellZoneNames); if (!haveMesh) diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C index e5ec8cf357..53aee8aea2 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C @@ -261,7 +261,7 @@ void Foam::ensightMesh::correct() // 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 // from processor to processor... sort(faceZoneNamesAll); diff --git a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C index 8a8266126b..8c5e072d0c 100644 --- a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C +++ b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C @@ -148,7 +148,7 @@ int main(int argc, char *argv[]) if (args.optionFound("faceZones")) { wordReList zoneNames(args.optionLookup("faceZones")()); - const wordList allZoneNames(mfz.names()); + const wordList allZoneNames(mfz.toc()); forAll(zoneNames, i) { const wordRe& zoneName = zoneNames[i]; diff --git a/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.C b/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.C index 243f9a2a0f..fe5f06764e 100644 --- a/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.C +++ b/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,9 +69,56 @@ Foam::PtrListDictionary::PtrListDictionary(Istream& is) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -inline Foam::autoPtr Foam::PtrListDictionary::set +Foam::label Foam::PtrListDictionary::findIndex(const word& key) const +{ + forAll(*this, i) + { + if (operator[](i).keyword() == key) + { + return i; + } + } + + return -1; +} + + +template +Foam::List Foam::PtrListDictionary::findIndices +( + const wordRe& key +) const +{ + List