diff --git a/applications/solvers/electromagnetics/magneticFoam/createFields.H b/applications/solvers/electromagnetics/magneticFoam/createFields.H index 1a5b7095a94fad3a24d42dfad1ed17fddfe4a1a1..a3712c19aa1d7baaa5c2a03572b22938d30d6cbc 100644 --- a/applications/solvers/electromagnetics/magneticFoam/createFields.H +++ b/applications/solvers/electromagnetics/magneticFoam/createFields.H @@ -63,8 +63,7 @@ << exit(FatalIOError); } - const labelList& faces = - mesh.faceZones()[magnetZonei]; + const labelList& faces = mesh.faceZones()[magnetZonei]; const scalar muri = magnets[i].mur(); const scalar Mri = magnets[i].Mr().value(); diff --git a/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H b/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H index dd2f6416ee4db07dddb4474aad05b89da70aee59..0c8c1bd1157e6d1266f2a66cc1d55d88581b2a4e 100644 --- a/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H +++ b/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H @@ -1,4 +1,4 @@ - Info << "Reading field p\n" << endl; + Info<< "Reading field p\n" << endl; volScalarField p ( IOobject @@ -12,7 +12,7 @@ mesh ); - Info << "Reading field U\n" << endl; + Info<< "Reading field U\n" << endl; volVectorField U ( IOobject @@ -34,7 +34,7 @@ setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue); - Info << "Reading field pa\n" << endl; + Info<< "Reading field pa\n" << endl; volScalarField pa ( IOobject @@ -48,7 +48,7 @@ mesh ); - Info << "Reading field Ua\n" << endl; + Info<< "Reading field Ua\n" << endl; volVectorField Ua ( IOobject @@ -84,10 +84,8 @@ dimensionedScalar lambda(laminarTransport.lookup("lambda")); dimensionedScalar alphaMax(laminarTransport.lookup("alphaMax")); - const labelList& inletCells = - mesh.boundary()[mesh.boundaryMesh().findPatchID("inlet")].faceCells(); - //const labelList& outletCells = - // mesh.boundary()[mesh.boundaryMesh().findPatchID("outlet")].faceCells(); + const labelList& inletCells = mesh.boundary()["inlet"].faceCells(); + //const labelList& outletCells = mesh.boundary()["outlet"].faceCells(); volScalarField alpha ( diff --git a/applications/test/primitivePatch/testPrimitivePatch.C b/applications/test/primitivePatch/testPrimitivePatch.C index e2336530e6c39fa20d6554eeaa8137491ea99e3f..f85b65435b0ccda5943097387784a1ce29d585b9 100644 --- a/applications/test/primitivePatch/testPrimitivePatch.C +++ b/applications/test/primitivePatch/testPrimitivePatch.C @@ -220,10 +220,7 @@ int main(int argc, char *argv[]) # include "createPolyMesh.H" const word patchName = args[1]; - - label patchI = mesh.boundaryMesh().findPatchID(patchName); - - const polyPatch& patch = mesh.boundaryMesh()[patchI]; + const polyPatch& patch = mesh.boundaryMesh()[patchName]; Info<< "Patch:" << patch.name() << endl; diff --git a/applications/utilities/mesh/conversion/fluentMeshToFoam/README.txt b/applications/utilities/mesh/conversion/fluentMeshToFoam/README.txt index 1dcfe05a8ea4fd6cba73e7f5499323d2ef6b9ca7..43c096374648f28f58f345a77752df0c18872ff9 100644 --- a/applications/utilities/mesh/conversion/fluentMeshToFoam/README.txt +++ b/applications/utilities/mesh/conversion/fluentMeshToFoam/README.txt @@ -20,8 +20,7 @@ Notes for fluentMeshToFoam with zone preservation with the cellZones(), faceZones() and pointZones() member functions - Example (Members from polyMesh.H and ZoneMesh.H): - label thisCellZoneID = mesh.cellZones().findZoneID("thisZoneName"); - const labelList& thisCellZone = mesh.cellZones()[thisCellZoneID]; + const labelList& thisCellZone = mesh.cellZones()["thisZoneName"]; - Zone integrity is preserved during mesh modification and decompomposition. diff --git a/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.H b/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.H index c8a25abeec781b83f3c8f487fd90d91cde82d04b..fa25d815eab6e3a873ec6288a48adcd84c81b43b 100644 --- a/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.H +++ b/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.H @@ -27,10 +27,7 @@ // Master patch const word masterPatchName(mergePatchPairs[pairI].first()); const polyPatch& masterPatch = - mesh.boundaryMesh() - [ - mesh.boundaryMesh().findPatchID(masterPatchName) - ]; + mesh.boundaryMesh()[masterPatchName]; labelList isf(masterPatch.size()); @@ -51,10 +48,7 @@ // Slave patch const word slavePatchName(mergePatchPairs[pairI].second()); const polyPatch& slavePatch = - mesh.boundaryMesh() - [ - mesh.boundaryMesh().findPatchID(slavePatchName) - ]; + mesh.boundaryMesh()[slavePatchName]; labelList osf(slavePatch.size()); diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C index d325f159f9d152711c8836669487a039a981e142..1d0ce53e738dbca14b26132551ef01904b74d590 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C @@ -123,7 +123,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) label findPatchID(const polyBoundaryMesh& patches, const word& name) { - label patchID = patches.findPatchID(name); + const label patchID = patches.findPatchID(name); if (patchID == -1) { diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C index 2a5aef33d1a2ce7d525bbbe7078d346f97546ff6..6a3b7dd7eadd0a926c8dabc1b9823be7d101caeb 100644 --- a/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -849,8 +849,7 @@ int main(int argc, char *argv[]) nExtrudeFaces = 0; forAll(zoneNames, i) { - label zoneI = faceZones.findZoneID(zoneNames[i]); - const faceZone& fz = faceZones[zoneI]; + const faceZone& fz = faceZones[zoneNames[i]]; forAll(fz, j) { extrudeTopPatchID[nExtrudeFaces] = interRegionTopPatch[i]; diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index 97a75718073b91e8ea698a825c89d7c65e7275d1..22720cbf65a0b20b8e71c7edc43f89ab7a84ac34 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -107,7 +107,7 @@ void modifyOrAddFace label findPatchID(const polyMesh& mesh, const word& name) { - label patchI = mesh.boundaryMesh().findPatchID(name); + const label patchI = mesh.boundaryMesh().findPatchID(name); if (patchI == -1) { diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index 1cd681b5f5f98a888c17168fa94927956865a3c5..21df0de62a574d2c421733dd54f4d70816642753 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -678,17 +678,17 @@ int main(int argc, char *argv[]) { const dictionary& dict = patchSources[addedI]; - word patchName(dict.lookup("name")); - + const word patchName(dict.lookup("name")); label destPatchI = patches.findPatchID(patchName); if (destPatchI == -1) { - FatalErrorIn(args.executable()) << "patch " << patchName - << " not added. Problem." << abort(FatalError); + FatalErrorIn(args.executable()) + << "patch " << patchName << " not added. Problem." + << abort(FatalError); } - word sourceType(dict.lookup("constructFrom")); + const word sourceType(dict.lookup("constructFrom")); if (sourceType == "patches") { @@ -716,7 +716,7 @@ int main(int argc, char *argv[]) } else if (sourceType == "set") { - word setName(dict.lookup("set")); + const word setName(dict.lookup("set")); faceSet faces(mesh, setName); diff --git a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C index 49de532ee100e358420571a0c5bac0f48cfefef2..dfff8d477994d9fcc9336a87ee75dd533a715bce 100644 --- a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C +++ b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C @@ -85,12 +85,12 @@ label findEdge(const primitiveMesh& mesh, const label v0, const label v1) // Checks whether patch present void checkPatch(const polyBoundaryMesh& bMesh, const word& name) { - label patchI = bMesh.findPatchID(name); + const label patchI = bMesh.findPatchID(name); if (patchI == -1) { FatalErrorIn("checkPatch(const polyBoundaryMesh&, const word&)") - << "Cannot find patch " << name << endl + << "Cannot find patch " << name << nl << "It should be present but of zero size" << endl << "Valid patches are " << bMesh.names() << exit(FatalError); diff --git a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C index 05c02464733d31daf27bf3a33713ff84bb6c5460..733cef024b8bd8a44f9d3ab80e8b56a6e58b9a7d 100644 --- a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C +++ b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C @@ -170,7 +170,7 @@ label addCellZone(const polyMesh& mesh, const word& name) // Checks whether patch present void checkPatch(const polyBoundaryMesh& bMesh, const word& name) { - label patchI = bMesh.findPatchID(name); + const label patchI = bMesh.findPatchID(name); if (patchI == -1) { @@ -312,11 +312,7 @@ int main(int argc, char *argv[]) // Create and add face zones and mesh modifiers // Master patch - const polyPatch& masterPatch = - mesh.boundaryMesh() - [ - mesh.boundaryMesh().findPatchID(masterPatchName) - ]; + const polyPatch& masterPatch = mesh.boundaryMesh()[masterPatchName]; // Make list of masterPatch faces labelList isf(masterPatch.size()); @@ -373,11 +369,7 @@ int main(int argc, char *argv[]) ); // Slave patch - const polyPatch& slavePatch = - mesh.boundaryMesh() - [ - mesh.boundaryMesh().findPatchID(slavePatchName) - ]; + const polyPatch& slavePatch = mesh.boundaryMesh()[slavePatchName]; labelList osf(slavePatch.size()); diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionDistribute.C b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionDistribute.C index 7a19700ebdc696db13091e13430b950449f26086..36ce46e454db12d95b1d108269d1d931b6d4f23b 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionDistribute.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionDistribute.C @@ -55,7 +55,7 @@ void Foam::domainDecomposition::distributeCells() forAll(pNames, i) { - label patchI = patches.findPatchID(pNames[i]); + const label patchI = patches.findPatchID(pNames[i]); if (patchI == -1) { diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C index 855c0d2b3ed68ab7fe8ae1235b4f5b5c73094c9f..96884fae24926206f6f7a25162f7528f6f49be69 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C @@ -328,7 +328,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh VTK_POLYHEDRON, nodeCount, uniqueNodeIds.data(), - faceCount, + nFaces, faceLabels.data() ); #else diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.C b/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.C index 28fd075179a80ab1062ab2a81086dd2e82599865..009e28329e39fb75517a2ba1c204285b44955904 100644 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.C +++ b/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.C @@ -236,7 +236,7 @@ Foam::channelIndex::channelIndex forAll(patchNames, i) { - label patchI = patches.findPatchID(patchNames[i]); + const label patchI = patches.findPatchID(patchNames[i]); if (patchI == -1) { @@ -254,7 +254,7 @@ Foam::channelIndex::channelIndex forAll(patchNames, i) { - const polyPatch& pp = patches[patches.findPatchID(patchNames[i])]; + const polyPatch& pp = patches[patchNames[i]]; forAll(pp, j) { diff --git a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C b/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C index 2875818005b4945449d332158d9efa8f9c546a39..55c6ae29633184352f79ee5ce75715f6e192c1bd 100644 --- a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C +++ b/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C @@ -65,8 +65,8 @@ int main(int argc, char *argv[]) { mesh.readUpdate(); - label patchi = mesh.boundaryMesh().findPatchID(patchName); - if (patchi < 0) + const label patchI = mesh.boundaryMesh().findPatchID(patchName); + if (patchI < 0) { FatalError << "Unable to find patch " << patchName << nl @@ -78,20 +78,20 @@ int main(int argc, char *argv[]) Info<< " Reading volScalarField " << fieldName << endl; volScalarField field(fieldHeader, mesh); - scalar area = gSum(mesh.magSf().boundaryField()[patchi]); + scalar area = gSum(mesh.magSf().boundaryField()[patchI]); scalar sumField = 0; if (area > 0) { sumField = gSum ( - mesh.magSf().boundaryField()[patchi] - * field.boundaryField()[patchi] + mesh.magSf().boundaryField()[patchI] + * field.boundaryField()[patchI] ) / area; } Info<< " Average of " << fieldName << " over patch " - << patchName << '[' << patchi << ']' << " = " + << patchName << '[' << patchI << ']' << " = " << sumField << endl; } else diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C index 06eef0339c5606f85b157dd94cd9532d1000ca42..9dbe43a8b3ec07e5069e92c26776908fa74a1081 100644 --- a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C +++ b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C @@ -67,8 +67,8 @@ int main(int argc, char *argv[]) { mesh.readUpdate(); - label patchi = mesh.boundaryMesh().findPatchID(patchName); - if (patchi < 0) + const label patchI = mesh.boundaryMesh().findPatchID(patchName); + if (patchI < 0) { FatalError << "Unable to find patch " << patchName << nl @@ -76,16 +76,16 @@ int main(int argc, char *argv[]) } // Give patch area - if (isA<cyclicPolyPatch>(mesh.boundaryMesh()[patchi])) + if (isA<cyclicPolyPatch>(mesh.boundaryMesh()[patchI])) { Info<< " Cyclic patch vector area: " << nl; - label nFaces = mesh.boundaryMesh()[patchi].size(); + label nFaces = mesh.boundaryMesh()[patchI].size(); vector sum1 = vector::zero; vector sum2 = vector::zero; for (label i=0; i<nFaces/2; i++) { - sum1 += mesh.Sf().boundaryField()[patchi][i]; - sum2 += mesh.Sf().boundaryField()[patchi][i+nFaces/2]; + sum1 += mesh.Sf().boundaryField()[patchI][i]; + sum2 += mesh.Sf().boundaryField()[patchI][i+nFaces/2]; } reduce(sum1, sumOp<vector>()); reduce(sum2, sumOp<vector>()); @@ -94,16 +94,16 @@ int main(int argc, char *argv[]) << " - total = " << (sum1 + sum2) << ", " << mag(sum1 + sum2) << endl; Info<< " Cyclic patch area magnitude = " - << gSum(mesh.magSf().boundaryField()[patchi])/2.0 << endl; + << gSum(mesh.magSf().boundaryField()[patchI])/2.0 << endl; } else { Info<< " Area vector of patch " - << patchName << '[' << patchi << ']' << " = " - << gSum(mesh.Sf().boundaryField()[patchi]) << endl; + << patchName << '[' << patchI << ']' << " = " + << gSum(mesh.Sf().boundaryField()[patchI]) << endl; Info<< " Area magnitude of patch " - << patchName << '[' << patchi << ']' << " = " - << gSum(mesh.magSf().boundaryField()[patchi]) << endl; + << patchName << '[' << patchI << ']' << " = " + << gSum(mesh.magSf().boundaryField()[patchI]) << endl; } // Read field and calc integral @@ -116,21 +116,21 @@ int main(int argc, char *argv[]) Info<< " Integral of " << fieldName << " over vector area of patch " - << patchName << '[' << patchi << ']' << " = " + << patchName << '[' << patchI << ']' << " = " << gSum ( - mesh.Sf().boundaryField()[patchi] - *field.boundaryField()[patchi] + mesh.Sf().boundaryField()[patchI] + *field.boundaryField()[patchI] ) << nl; Info<< " Integral of " << fieldName << " over area magnitude of patch " - << patchName << '[' << patchi << ']' << " = " + << patchName << '[' << patchI << ']' << " = " << gSum ( - mesh.magSf().boundaryField()[patchi] - *field.boundaryField()[patchi] + mesh.magSf().boundaryField()[patchI] + *field.boundaryField()[patchI] ) << nl; } @@ -143,10 +143,10 @@ int main(int argc, char *argv[]) << fieldName << endl; surfaceScalarField field(fieldHeader, mesh); - scalar sumField = gSum(field.boundaryField()[patchi]); + scalar sumField = gSum(field.boundaryField()[patchI]); Info<< " Integral of " << fieldName << " over patch " - << patchName << '[' << patchi << ']' << " = " + << patchName << '[' << patchI << ']' << " = " << sumField << nl; } else diff --git a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C index f797213a1b81265fc4ecc8a8d3827845c6b59267..14fd9525a5e3dce40f4d56e8e9a5ebb36d65a1a5 100644 --- a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C +++ b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) forAll(patchNames, patchNameI) { const word& patchName = patchNames[patchNameI]; - label patchI = bMesh.findPatchID(patchName); + const label patchI = bMesh.findPatchID(patchName); if (patchI == -1) { diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index 1c351ab61d2bdc13896ff10c2fed138b76a469c7..f23a05879f63f1b6a85096743241b4e9aeb94142 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -120,9 +120,9 @@ Foam::polyBoundaryMesh::~polyBoundaryMesh() void Foam::polyBoundaryMesh::clearGeom() { - forAll(*this, patchi) + forAll(*this, patchI) { - operator[](patchi).clearGeom(); + operator[](patchI).clearGeom(); } } @@ -132,9 +132,9 @@ void Foam::polyBoundaryMesh::clearAddressing() neighbourEdgesPtr_.clear(); patchIDPtr_.clear(); - forAll(*this, patchi) + forAll(*this, patchI) { - operator[](patchi).clearAddressing(); + operator[](patchI).clearAddressing(); } } @@ -151,16 +151,16 @@ void Foam::polyBoundaryMesh::calcGeometry() || Pstream::defaultCommsType == Pstream::nonBlocking ) { - forAll(*this, patchi) + forAll(*this, patchI) { - operator[](patchi).initGeometry(pBufs); + operator[](patchI).initGeometry(pBufs); } pBufs.finishedSends(); - forAll(*this, patchi) + forAll(*this, patchI) { - operator[](patchi).calcGeometry(pBufs); + operator[](patchI).calcGeometry(pBufs); } } else if (Pstream::defaultCommsType == Pstream::scheduled) @@ -172,15 +172,15 @@ void Foam::polyBoundaryMesh::calcGeometry() forAll(patchSchedule, patchEvali) { - label patchi = patchSchedule[patchEvali].patch; + const label patchI = patchSchedule[patchEvali].patch; if (patchSchedule[patchEvali].init) { - operator[](patchi).initGeometry(pBufs); + operator[](patchI).initGeometry(pBufs); } else { - operator[](patchi).calcGeometry(pBufs); + operator[](patchI).calcGeometry(pBufs); } } } @@ -204,15 +204,15 @@ Foam::polyBoundaryMesh::neighbourEdges() const // Initialize. label nEdgePairs = 0; - forAll(*this, patchi) + forAll(*this, patchI) { - const polyPatch& pp = operator[](patchi); + const polyPatch& pp = operator[](patchI); - neighbourEdges[patchi].setSize(pp.nEdges() - pp.nInternalEdges()); + neighbourEdges[patchI].setSize(pp.nEdges() - pp.nInternalEdges()); - forAll(neighbourEdges[patchi], i) + forAll(neighbourEdges[patchI], i) { - labelPair& edgeInfo = neighbourEdges[patchi][i]; + labelPair& edgeInfo = neighbourEdges[patchI][i]; edgeInfo[0] = -1; edgeInfo[1] = -1; @@ -225,9 +225,9 @@ Foam::polyBoundaryMesh::neighbourEdges() const // point addressing) to patch + relative edge index. HashTable<labelPair, edge, Hash<edge> > pointsToEdge(nEdgePairs); - forAll(*this, patchi) + forAll(*this, patchI) { - const polyPatch& pp = operator[](patchi); + const polyPatch& pp = operator[](patchI); const edgeList& edges = pp.edges(); @@ -256,7 +256,7 @@ Foam::polyBoundaryMesh::neighbourEdges() const meshEdge, labelPair ( - patchi, + patchI, edgei - pp.nInternalEdges() ) ); @@ -266,11 +266,11 @@ Foam::polyBoundaryMesh::neighbourEdges() const // Second occurrence. Store. const labelPair& edgeInfo = fnd(); - neighbourEdges[patchi][edgei - pp.nInternalEdges()] = + neighbourEdges[patchI][edgei - pp.nInternalEdges()] = edgeInfo; neighbourEdges[edgeInfo[0]][edgeInfo[1]] - = labelPair(patchi, edgei - pp.nInternalEdges()); + = labelPair(patchI, edgei - pp.nInternalEdges()); // Found all two occurrences of this edge so remove from // hash to save space. Note that this will give lots of @@ -288,11 +288,11 @@ Foam::polyBoundaryMesh::neighbourEdges() const << abort(FatalError); } - forAll(*this, patchi) + forAll(*this, patchI) { - const polyPatch& pp = operator[](patchi); + const polyPatch& pp = operator[](patchI); - const labelPairList& nbrEdges = neighbourEdges[patchi]; + const labelPairList& nbrEdges = neighbourEdges[patchI]; forAll(nbrEdges, i) { @@ -409,8 +409,7 @@ Foam::label Foam::polyBoundaryMesh::findPatchID(const word& patchName) const // Patch not found if (debug) { - Pout<< "label polyBoundaryMesh::findPatchID(const word& " - << "patchName) const" + Pout<< "label polyBoundaryMesh::findPatchID(const word&) const" << "Patch named " << patchName << " not found. " << "List of available patch names: " << names() << endl; } @@ -641,16 +640,16 @@ void Foam::polyBoundaryMesh::movePoints(const pointField& p) || Pstream::defaultCommsType == Pstream::nonBlocking ) { - forAll(*this, patchi) + forAll(*this, patchI) { - operator[](patchi).initMovePoints(pBufs, p); + operator[](patchI).initMovePoints(pBufs, p); } pBufs.finishedSends(); - forAll(*this, patchi) + forAll(*this, patchI) { - operator[](patchi).movePoints(pBufs, p); + operator[](patchI).movePoints(pBufs, p); } } else if (Pstream::defaultCommsType == Pstream::scheduled) @@ -662,15 +661,15 @@ void Foam::polyBoundaryMesh::movePoints(const pointField& p) forAll(patchSchedule, patchEvali) { - label patchi = patchSchedule[patchEvali].patch; + const label patchI = patchSchedule[patchEvali].patch; if (patchSchedule[patchEvali].init) { - operator[](patchi).initMovePoints(pBufs, p); + operator[](patchI).initMovePoints(pBufs, p); } else { - operator[](patchi).movePoints(pBufs, p); + operator[](patchI).movePoints(pBufs, p); } } } @@ -690,16 +689,16 @@ void Foam::polyBoundaryMesh::updateMesh() || Pstream::defaultCommsType == Pstream::nonBlocking ) { - forAll(*this, patchi) + forAll(*this, patchI) { - operator[](patchi).initUpdateMesh(pBufs); + operator[](patchI).initUpdateMesh(pBufs); } pBufs.finishedSends(); - forAll(*this, patchi) + forAll(*this, patchI) { - operator[](patchi).updateMesh(pBufs); + operator[](patchI).updateMesh(pBufs); } } else if (Pstream::defaultCommsType == Pstream::scheduled) @@ -711,15 +710,15 @@ void Foam::polyBoundaryMesh::updateMesh() forAll(patchSchedule, patchEvali) { - label patchi = patchSchedule[patchEvali].patch; + const label patchI = patchSchedule[patchEvali].patch; if (patchSchedule[patchEvali].init) { - operator[](patchi).initUpdateMesh(pBufs); + operator[](patchI).initUpdateMesh(pBufs); } else { - operator[](patchi).updateMesh(pBufs); + operator[](patchI).updateMesh(pBufs); } } } @@ -734,9 +733,9 @@ void Foam::polyBoundaryMesh::reorder(const UList<label>& oldToNew) // Adapt indices polyPatchList& patches = *this; - forAll(patches, patchi) + forAll(patches, patchI) { - patches[patchi].index() = patchi; + patches[patchI].index() = patchI; } updateMesh(); @@ -749,11 +748,11 @@ bool Foam::polyBoundaryMesh::writeData(Ostream& os) const os << patches.size() << nl << token::BEGIN_LIST << incrIndent << nl; - forAll(patches, patchi) + forAll(patches, patchI) { - os << indent << patches[patchi].name() << nl + os << indent << patches[patchI].name() << nl << indent << token::BEGIN_BLOCK << nl - << incrIndent << patches[patchi] << decrIndent + << incrIndent << patches[patchI] << decrIndent << indent << token::END_BLOCK << endl; } @@ -776,6 +775,49 @@ bool Foam::polyBoundaryMesh::writeObject return regIOobject::writeObject(fmt, ver, IOstream::UNCOMPRESSED); } +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + +const Foam::polyPatch& Foam::polyBoundaryMesh::operator[] +( + const word& patchName +) const +{ + const label patchI = findPatchID(patchName); + + if (patchI < 0) + { + FatalErrorIn + ( + "polyBoundaryMesh::operator[](const word&) const" + ) << "Patch named " << patchName << " not found." << nl + << "Available patch names: " << names() << endl + << abort(FatalError); + } + + return operator[](patchI); +} + + +Foam::polyPatch& Foam::polyBoundaryMesh::operator[] +( + const word& patchName +) +{ + const label patchI = findPatchID(patchName); + + if (patchI < 0) + { + FatalErrorIn + ( + "polyBoundaryMesh::operator[](const word&)" + ) << "Patch named " << patchName << " not found." << nl + << "Available patch names: " << names() << endl + << abort(FatalError); + } + + return operator[](patchI); +} + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H index 8fa0eca53497d45e833638013764337e56b09e3b..4b687ad5180686ff902dafcadfa05019112f8f2a 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H @@ -126,7 +126,7 @@ public: void clearAddressing(); - // Member functions + // Member Functions //- Return the mesh reference const polyMesh& mesh() const @@ -194,6 +194,17 @@ public: IOstream::compressionType cmp ) const; + // Member Operators + + //- Return const and non-const reference to polyPatch by index. + using polyPatchList::operator[]; + + //- Return const reference to polyPatch by name. + const polyPatch& operator[](const word&) const; + + //- Return reference to polyPatch by name. + polyPatch& operator[](const word&); + // Ostream operator diff --git a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C index 7ad51549b1c84f343dbb4720148d0662feffeb4b..fe1c6de03ec9a9ca370ce1ec67093e48930e7f88 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,15 +27,10 @@ License #include "entry.H" #include "demandDrivenData.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template<class ZoneType, class MeshType> -void ZoneMesh<ZoneType, MeshType>::calcZoneMap() const +void Foam::ZoneMesh<ZoneType, MeshType>::calcZoneMap() const { // It is an error to attempt to recalculate cellEdges // if the pointer is already set @@ -77,7 +72,7 @@ void ZoneMesh<ZoneType, MeshType>::calcZoneMap() const // Read constructor given IOobject and a MeshType reference template<class ZoneType, class MeshType> -ZoneMesh<ZoneType, MeshType>::ZoneMesh +Foam::ZoneMesh<ZoneType, MeshType>::ZoneMesh ( const IOobject& io, const MeshType& mesh @@ -136,7 +131,7 @@ ZoneMesh<ZoneType, MeshType>::ZoneMesh // Construct given size. Zones will be set later template<class ZoneType, class MeshType> -ZoneMesh<ZoneType, MeshType>::ZoneMesh +Foam::ZoneMesh<ZoneType, MeshType>::ZoneMesh ( const IOobject& io, const MeshType& mesh, @@ -153,7 +148,7 @@ ZoneMesh<ZoneType, MeshType>::ZoneMesh // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template<class ZoneType, class MeshType> -ZoneMesh<ZoneType, MeshType>::~ZoneMesh() +Foam::ZoneMesh<ZoneType, MeshType>::~ZoneMesh() { clearAddressing(); } @@ -163,7 +158,8 @@ ZoneMesh<ZoneType, MeshType>::~ZoneMesh() // Map of zones for quick zone lookup template<class ZoneType, class MeshType> -const Map<label>& ZoneMesh<ZoneType, MeshType>::zoneMap() const +const Foam::Map<Foam::label>& +Foam::ZoneMesh<ZoneType, MeshType>::zoneMap() const { if (!zoneMapPtr_) { @@ -177,7 +173,10 @@ const Map<label>& ZoneMesh<ZoneType, MeshType>::zoneMap() const // Given a global object index, return the zone it is in. // If object does not belong to any zones, return -1 template<class ZoneType, class MeshType> -label ZoneMesh<ZoneType, MeshType>::whichZone(const label objectIndex) const +Foam::label Foam::ZoneMesh<ZoneType, MeshType>::whichZone +( + const label objectIndex +) const { const Map<label>& zm = zoneMap(); Map<label>::const_iterator zmIter = zm.find(objectIndex); @@ -195,40 +194,43 @@ label ZoneMesh<ZoneType, MeshType>::whichZone(const label objectIndex) const // Return a list of zone names template<class ZoneType, class MeshType> -wordList ZoneMesh<ZoneType, MeshType>::types() const +Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::types() const { const PtrList<ZoneType>& zones = *this; - wordList t(zones.size()); + wordList lst(zones.size()); forAll(zones, zoneI) { - t[zoneI] = zones[zoneI].type(); + lst[zoneI] = zones[zoneI].type(); } - return t; + return lst; } // Return a list of zone names template<class ZoneType, class MeshType> -wordList ZoneMesh<ZoneType, MeshType>::names() const +Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::names() const { const PtrList<ZoneType>& zones = *this; - wordList t(zones.size()); + wordList lst(zones.size()); forAll(zones, zoneI) { - t[zoneI] = zones[zoneI].name(); + lst[zoneI] = zones[zoneI].name(); } - return t; + return lst; } template<class ZoneType, class MeshType> -label ZoneMesh<ZoneType, MeshType>::findZoneID(const word& zoneName) const +Foam::label Foam::ZoneMesh<ZoneType, MeshType>::findZoneID +( + const word& zoneName +) const { const PtrList<ZoneType>& zones = *this; @@ -243,19 +245,18 @@ label ZoneMesh<ZoneType, MeshType>::findZoneID(const word& zoneName) const // Zone not found if (debug) { - Info<< "label ZoneMesh<ZoneType>::findZoneID(const word& " - << "zoneName) const : " + Info<< "label ZoneMesh<ZoneType>::findZoneID(const word&) const : " << "Zone named " << zoneName << " not found. " << "List of available zone names: " << names() << endl; } - // A dummy return to kep the compiler happy + // A dummy return to keep the compiler happy return -1; } template<class ZoneType, class MeshType> -void ZoneMesh<ZoneType, MeshType>::clearAddressing() +void Foam::ZoneMesh<ZoneType, MeshType>::clearAddressing() { deleteDemandDrivenData(zoneMapPtr_); @@ -269,7 +270,7 @@ void ZoneMesh<ZoneType, MeshType>::clearAddressing() template<class ZoneType, class MeshType> -void ZoneMesh<ZoneType, MeshType>::clear() +void Foam::ZoneMesh<ZoneType, MeshType>::clear() { clearAddressing(); PtrList<ZoneType>::clear(); @@ -278,7 +279,10 @@ void ZoneMesh<ZoneType, MeshType>::clear() // Check zone definition template<class ZoneType, class MeshType> -bool ZoneMesh<ZoneType, MeshType>::checkDefinition(const bool report) const +bool Foam::ZoneMesh<ZoneType, MeshType>::checkDefinition +( + const bool report +) const { bool inError = false; @@ -294,7 +298,7 @@ bool ZoneMesh<ZoneType, MeshType>::checkDefinition(const bool report) const // Correct zone mesh after moving points template<class ZoneType, class MeshType> -void ZoneMesh<ZoneType, MeshType>::movePoints(const pointField& p) +void Foam::ZoneMesh<ZoneType, MeshType>::movePoints(const pointField& p) { PtrList<ZoneType>& zones = *this; @@ -307,17 +311,66 @@ void ZoneMesh<ZoneType, MeshType>::movePoints(const pointField& p) // writeData member function required by regIOobject template<class ZoneType, class MeshType> -bool ZoneMesh<ZoneType, MeshType>::writeData(Ostream& os) const +bool Foam::ZoneMesh<ZoneType, MeshType>::writeData(Ostream& os) const { - os << *this; + os << *this; return os.good(); } +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + +template<class ZoneType, class MeshType> +const ZoneType& Foam::ZoneMesh<ZoneType, MeshType>::operator[] +( + const word& zoneName +) const +{ + const label zoneI = findZoneID(zoneName); + + if (zoneI < 0) + { + FatalErrorIn + ( + "ZoneMesh<ZoneType>::operator[](const word&) const" + ) << "Zone named " << zoneName << " not found." << nl + << "Available zone names: " << names() << endl + << abort(FatalError); + } + + return operator[](zoneI); +} + + +template<class ZoneType, class MeshType> +ZoneType& Foam::ZoneMesh<ZoneType, MeshType>::operator[] +( + const word& zoneName +) +{ + const label zoneI = findZoneID(zoneName); + + if (zoneI < 0) + { + FatalErrorIn + ( + "ZoneMesh<ZoneType>::operator[](const word&)" + ) << "Zone named " << zoneName << " not found." << nl + << "Available zone names: " << names() << endl + << abort(FatalError); + } + + return operator[](zoneI); +} + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // template<class ZoneType, class MeshType> -Ostream& operator<<(Ostream& os, const ZoneMesh<ZoneType, MeshType>& zones) +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const ZoneMesh<ZoneType, MeshType>& zones +) { os << zones.size() << nl << token::BEGIN_LIST; @@ -332,8 +385,4 @@ Ostream& operator<<(Ostream& os, const ZoneMesh<ZoneType, MeshType>& zones) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H index ca1a2dce860d9626349ecd3639e6d07f03ec2d3e..03b9c216becd4de67a54c8aabdb11a83be1f9db9 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -109,7 +109,7 @@ public: ~ZoneMesh(); - // Member functions + // Member Functions //- Return the mesh reference const MeshType& mesh() const @@ -149,6 +149,17 @@ public: //- writeData member function required by regIOobject bool writeData(Ostream&) const; + // Member Operators + + //- Return const and non-const reference to ZoneType by index. + using PtrList<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&); + // Ostream operator diff --git a/src/dynamicMesh/boundaryMesh/boundaryMesh.C b/src/dynamicMesh/boundaryMesh/boundaryMesh.C index 436cc18601c17e63061b472c125774ebc340ab26..877f10f80ebd38304d66efdaef1b9b1bb99b10dd 100644 --- a/src/dynamicMesh/boundaryMesh/boundaryMesh.C +++ b/src/dynamicMesh/boundaryMesh/boundaryMesh.C @@ -1125,13 +1125,11 @@ void Foam::boundaryMesh::patchify forAll(oldPatches, oldPatchI) { const polyPatch& patch = oldPatches[oldPatchI]; - - label newPatchI = findPatchID(patch.name()); + const label newPatchI = findPatchID(patch.name()); if (newPatchI != -1) { nameToIndex.insert(patch.name(), newPatchI); - indexToName.insert(newPatchI, patch.name()); } } @@ -1145,7 +1143,6 @@ void Foam::boundaryMesh::patchify if (!nameToIndex.found(bp.name())) { nameToIndex.insert(bp.name(), bPatchI); - indexToName.insert(bPatchI, bp.name()); } } @@ -1167,10 +1164,10 @@ void Foam::boundaryMesh::patchify { const boundaryPatch& bp = patches_[bPatchI]; - label newPatchI = nameToIndex[bp.name()]; + const label newPatchI = nameToIndex[bp.name()]; // Find corresponding patch in polyMesh - label oldPatchI = findPatchID(oldPatches, bp.name()); + const label oldPatchI = findPatchID(oldPatches, bp.name()); if (oldPatchI == -1) { @@ -1599,7 +1596,7 @@ void Foam::boundaryMesh::addPatch(const word& patchName) void Foam::boundaryMesh::deletePatch(const word& patchName) { - label delPatchI = findPatchID(patchName); + const label delPatchI = findPatchID(patchName); if (delPatchI == -1) { @@ -1658,7 +1655,7 @@ void Foam::boundaryMesh::changePatchType const word& patchType ) { - label changeI = findPatchID(patchName); + const label changeI = findPatchID(patchName); if (changeI == -1) { diff --git a/src/dynamicMesh/meshCut/directions/directions.C b/src/dynamicMesh/meshCut/directions/directions.C index b49dc435dcbd7f6f0c60704828bc44efc8b7a9b4..c404504326a622dcdf7d7d2c2ea70a9b9ca115d7 100644 --- a/src/dynamicMesh/meshCut/directions/directions.C +++ b/src/dynamicMesh/meshCut/directions/directions.C @@ -343,7 +343,7 @@ Foam::directions::directions const word patchName(patchDict.lookup("patch")); - label patchI = mesh.boundaryMesh().findPatchID(patchName); + const label patchI = mesh.boundaryMesh().findPatchID(patchName); if (patchI == -1) { diff --git a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C index 92bb9f42d0ea2a122587cfb1d5bf6369ca735a81..eec1fb13c24b8351b0886bd6cdbb3f1b46a5bff2 100644 --- a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C +++ b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -70,16 +70,33 @@ Foam::fvBoundaryMesh::fvBoundaryMesh // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::label Foam::fvBoundaryMesh::findPatchID(const word& patchName) const +{ + const fvPatchList& patches = *this; + + forAll(patches, patchI) + { + if (patches[patchI].name() == patchName) + { + return patchI; + } + } + + // Not found, return -1 + return -1; +} + + void Foam::fvBoundaryMesh::movePoints() { - forAll(*this, patchi) + forAll(*this, patchI) { - operator[](patchi).initMovePoints(); + operator[](patchI).initMovePoints(); } - forAll(*this, patchi) + forAll(*this, patchI) { - operator[](patchi).movePoints(); + operator[](patchI).movePoints(); } } @@ -88,14 +105,14 @@ Foam::lduInterfacePtrsList Foam::fvBoundaryMesh::interfaces() const { lduInterfacePtrsList interfaces(size()); - forAll(interfaces, patchi) + forAll(interfaces, patchI) { - if (isA<lduInterface>(this->operator[](patchi))) + if (isA<lduInterface>(this->operator[](patchI))) { interfaces.set ( - patchi, - &refCast<const lduInterface>(this->operator[](patchi)) + patchI, + &refCast<const lduInterface>(this->operator[](patchI)) ); } } @@ -111,4 +128,46 @@ void Foam::fvBoundaryMesh::readUpdate(const polyBoundaryMesh& basicBdry) } +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + +const Foam::fvPatch& Foam::fvBoundaryMesh::operator[] +( + const word& patchName +) const +{ + const label patchI = findPatchID(patchName); + + if (patchI < 0) + { + FatalErrorIn + ( + "fvBoundaryMesh::operator[](const word&) const" + ) << "Patch named " << patchName << " not found." << nl + << abort(FatalError); + } + + return operator[](patchI); +} + + +Foam::fvPatch& Foam::fvBoundaryMesh::operator[] +( + const word& patchName +) +{ + const label patchI = findPatchID(patchName); + + if (patchI < 0) + { + FatalErrorIn + ( + "fvBoundaryMesh::operator[](const word&)" + ) << "Patch named " << patchName << " not found." << nl + << abort(FatalError); + } + + return operator[](patchI); +} + + // ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H index 75175dd28feabdf164a08986c3b0440a4bd27d95..13707bf0a50e9843941753a382dbbf1082820cde 100644 --- a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H +++ b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H @@ -54,8 +54,6 @@ class fvBoundaryMesh : public fvPatchList { -private: - // Private data //- Reference to mesh @@ -101,7 +99,7 @@ public: ); - // Member functions + // Member Functions // Access @@ -115,9 +113,24 @@ public: // with only those pointing to interfaces being set lduInterfacePtrsList interfaces() const; + //- Find patch index given a name + label findPatchID(const word& patchName) const; + //- Correct patches after moving points void movePoints(); + + // Member Operators + + //- Return const and non-const reference to fvPatch by index. + using fvPatchList::operator[]; + + //- Return const reference to fvPatch by name. + const fvPatch& operator[](const word&) const; + + //- Return reference to fvPatch by name. + fvPatch& operator[](const word&); + }; diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C index e3a7e72b3cad7fde5eee0447ccf7cae1acde65d7..977fdb89a0b422ff261b4964251ebe35f7ee7649 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C @@ -148,8 +148,7 @@ displacementInterpolationFvMotionSolver forAll(faceZoneToTable, i) { const word& zoneName = faceZoneToTable[i][0]; - label zoneI = fZones.findZoneID(zoneName); - const faceZone& fz = fZones[zoneI]; + const faceZone& fz = fZones[zoneName]; scalar minCoord = VGREAT; scalar maxCoord = -VGREAT; diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.C index 8ade7abb4947e8d4be961a3bdd654a626a018bdc..bcc694c38548fae3baa21a746bf162353e22667a 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.C @@ -353,8 +353,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::cellZoneSolve const dictionary& faceZoneDict = patchIter().dict(); // Determine the points of the faceZone within the cellZone - label zoneI = mesh().faceZones().findZoneID(faceZoneName); - const faceZone& fz = mesh().faceZones()[zoneI]; + const faceZone& fz = mesh().faceZones()[faceZoneName]; const labelList& fzMeshPoints = fz().meshPoints(); DynamicList<label> meshPoints(fzMeshPoints.size()); forAll(fzMeshPoints, i) diff --git a/src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C index 934f29e018063f63d0b44fcd41f55bb794e559b5..583ef450b1cf778cfd9a4f16914ad8338c292338 100644 --- a/src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C @@ -78,7 +78,7 @@ void Foam::inverseFaceDistanceDiffusivity::correct() forAll(patchNames_, i) { - label pID = bdry.findPatchID(patchNames_[i]); + const label pID = bdry.findPatchID(patchNames_[i]); if (pID > -1) { diff --git a/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C index 00063e203cd993fee49a096c800055216da9e554..8cd891ea1f13ee6132c3ff5908fa3d25cb110a04 100644 --- a/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C @@ -78,7 +78,7 @@ void Foam::inversePointDistanceDiffusivity::correct() forAll(patchNames_, i) { - label pID = bdry.findPatchID(patchNames_[i]); + const label pID = bdry.findPatchID(patchNames_[i]); if (pID > -1) { diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C index eb46df52340bb6f89bde58560f5e134aa85616e8..5188b7bc13895b89bcbce846d160f4cee0f8bb82 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C @@ -87,7 +87,7 @@ void surfaceDisplacementPointPatchVectorField::calcProjection { const pointZoneMesh& pZones = mesh.pointZones(); - zonePtr = &pZones[pZones.findZoneID(frozenPointsZone_)]; + zonePtr = &pZones[frozenPointsZone_]; Pout<< "surfaceDisplacementPointPatchVectorField : Fixing all " << zonePtr->size() << " points in pointZone " << zonePtr->name() diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C index 1c3ebb9f7a1f80cf64b444763da83df1232e2dd8..cd75617b9b7ffbb8804f8402803433c2da0ca620 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C @@ -86,7 +86,7 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection { const pointZoneMesh& pZones = mesh.pointZones(); - zonePtr = &pZones[pZones.findZoneID(frozenPointsZone_)]; + zonePtr = &pZones[frozenPointsZone_]; Pout<< "surfaceSlipDisplacementPointPatchVectorField : Fixing all " << zonePtr->size() << " points in pointZone " << zonePtr->name() diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C index 661c7e566fbd15a7fc0b872f16539e13d63c2c0e..1ac661095efa05e3a14ab65875293b016f83a3f6 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C @@ -101,7 +101,7 @@ Foam::PatchInjection<CloudType>::PatchInjection cellOwners_(), fraction_(1.0) { - label patchId = owner.mesh().boundaryMesh().findPatchID(patchName_); + const label patchId = owner.mesh().boundaryMesh().findPatchID(patchName_); if (patchId < 0) { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PatchPostProcessing/PatchPostProcessing.C b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PatchPostProcessing/PatchPostProcessing.C index 51f0e6e31d6755e434d334381f1eb445cb529a51..8845b3e697d592a7264bf126f6caabc1fcd31e0b 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PatchPostProcessing/PatchPostProcessing.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PatchPostProcessing/PatchPostProcessing.C @@ -128,7 +128,7 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing { forAll(patchNames_, patchI) { - label id = mesh_.boundaryMesh().findPatchID(patchNames_[patchI]); + const label id = mesh_.boundaryMesh().findPatchID(patchNames_[patchI]); if (id < 0) { FatalErrorIn diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index 7ec3d369f140467f0457b24464604af88750f75d..a73e7bdcf606b1bd05b253cc612da9a159ab4396 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -70,9 +70,7 @@ Foam::Map<Foam::label> Foam::autoSnapDriver::getZoneBafflePatches if (faceZoneNames[surfI].size()) { // Get zone - label zoneI = fZones.findZoneID(faceZoneNames[surfI]); - - const faceZone& fZone = fZones[zoneI]; + const faceZone& fZone = fZones[faceZoneNames[surfI]]; //// Get patch allocated for zone //label patchI = surfaceToCyclicPatch_[surfI]; @@ -1311,11 +1309,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface forAll(zonedSurfaces, i) { - label zoneSurfI = zonedSurfaces[i]; - - label zoneI = fZones.findZoneID(faceZoneNames[zoneSurfI]); - - const faceZone& fZone = fZones[zoneI]; + const label zoneSurfI = zonedSurfaces[i]; + const faceZone& fZone = fZones[faceZoneNames[zoneSurfI]]; forAll(fZone, i) { diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index d56ad740a12f2a6925a32272511376a4f7d4da11..7d90fdc4507a286f78d36118fe9412680a2cd464 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C @@ -1119,9 +1119,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance if (fzNames[surfI].size()) { // Get zone - label zoneI = fZones.findZoneID(fzNames[surfI]); - - const faceZone& fZone = fZones[zoneI]; + const faceZone& fZone = fZones[fzNames[surfI]]; forAll(fZone, i) { @@ -1540,7 +1538,7 @@ Foam::label Foam::meshRefinement::addPatch polyBoundaryMesh& polyPatches = const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()); - label patchI = polyPatches.findPatchID(patchName); + const label patchI = polyPatches.findPatchID(patchName); if (patchI != -1) { if (polyPatches[patchI].type() == patchType) diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C index 91c24ecf28f07ca09c8d3538b406afdf95a34777..1c9b5dd5cac9577b71a5178b197b68c7dba99b20 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C @@ -744,7 +744,7 @@ const Foam::polyPatch& Foam::directMappedPatchBase::samplePolyPatch() const { const polyMesh& nbrMesh = sampleMesh(); - label patchI = nbrMesh.boundaryMesh().findPatchID(samplePatch_); + const label patchI = nbrMesh.boundaryMesh().findPatchID(samplePatch_); if (patchI == -1) { diff --git a/src/meshTools/searchableSurface/searchableSurfaces.C b/src/meshTools/searchableSurface/searchableSurfaces.C index 752113cd17001a278e543be69afa42c141ac1336..e659a88d185c319bbb01eedf970b9403d8ad071d 100644 --- a/src/meshTools/searchableSurface/searchableSurfaces.C +++ b/src/meshTools/searchableSurface/searchableSurfaces.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,12 +30,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -defineTypeNameAndDebug(searchableSurfaces, 0); - -} +defineTypeNameAndDebug(Foam::searchableSurfaces, 0); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -256,8 +251,10 @@ Foam::searchableSurfaces::searchableSurfaces // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::label Foam::searchableSurfaces::findSurfaceID(const word& wantedName) - const +Foam::label Foam::searchableSurfaces::findSurfaceID +( + const word& wantedName +) const { return findIndex(names_, wantedName); } @@ -344,5 +341,48 @@ Foam::pointIndexHit Foam::searchableSurfaces::facesIntersection ); } +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + +const Foam::searchableSurface& Foam::searchableSurfaces::operator[] +( + const word& surfName +) const +{ + const label surfI = findSurfaceID(surfName); + + if (surfI < 0) + { + FatalErrorIn + ( + "searchableSurfaces::operator[](const word&) const" + ) << "Surface named " << surfName << " not found." << nl + << "Available surface names: " << names_ << endl + << abort(FatalError); + } + + return operator[](surfI); +} + + +Foam::searchableSurface& Foam::searchableSurfaces::operator[] +( + const word& surfName +) +{ + const label surfI = findSurfaceID(surfName); + + if (surfI < 0) + { + FatalErrorIn + ( + "searchableSurfaces::operator[](const word&)" + ) << "Surface named " << surfName << " not found." << nl + << "Available surface names: " << names_ << endl + << abort(FatalError); + } + + return operator[](surfI); +} + // ************************************************************************* // diff --git a/src/meshTools/searchableSurface/searchableSurfaces.H b/src/meshTools/searchableSurface/searchableSurfaces.H index 34a121128801e0aea2fa4c72c7de673bb5e1b5dd..40bcf8488593d89156f7c672dc975c95c7543d3b 100644 --- a/src/meshTools/searchableSurface/searchableSurfaces.H +++ b/src/meshTools/searchableSurface/searchableSurfaces.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -174,6 +174,19 @@ public: const point& start ) const; + + // Member Operators + + //- Return const and non-const reference to searchableSurface by index. + using PtrList<searchableSurface>::operator[]; + + //- Return const reference to searchableSurface by name. + const searchableSurface& operator[](const word&) const; + + //- Return reference to searchableSurface by name. + searchableSurface& operator[](const word&); + + }; diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C index e19a80dc2a08b32065b2989bc474341ced02fbce..517e5803b74c637eba7d25f895346ead24c46b98 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C @@ -161,7 +161,7 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces() void Foam::fieldValues::faceSource::setPatchFaces() { - label patchId = mesh().boundaryMesh().findPatchID(sourceName_); + const label patchId = mesh().boundaryMesh().findPatchID(sourceName_); if (patchId < 0) { diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C index c337b4d3fe506cb637d8dfa9472d2f4b64b325ed..b0df5966f889b8fc33f935615f6f99efe2b29184 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C @@ -304,7 +304,7 @@ bool Foam::sampledIsoSurface::updateGeometry() const const polyBoundaryMesh& patches = mesh().boundaryMesh(); // Patch to put exposed internal faces into - label exposedPatchI = patches.findPatchID(exposedPatchName_); + const label exposedPatchI = patches.findPatchID(exposedPatchName_); if (debug) { diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C index 9be34f131fbf03ef392b662cd9c60adbfba04b1f..dc677cf823ead693952f861d8c61cb1875aeb8b5 100644 --- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C +++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C @@ -67,7 +67,7 @@ void Foam::sampledCuttingPlane::createGeometry() const polyBoundaryMesh& patches = mesh().boundaryMesh(); // Patch to put exposed internal faces into - label exposedPatchI = patches.findPatchID(exposedPatchName_); + const label exposedPatchI = patches.findPatchID(exposedPatchName_); if (debug) { diff --git a/src/sampling/sampledSurface/sampledPatch/sampledPatch.C b/src/sampling/sampledSurface/sampledPatch/sampledPatch.C index 4dcc59c85c7dc1e1a8b44772a38108da14efe34f..aefa3038a5a29ff86a0262848a690c4180be78c0 100644 --- a/src/sampling/sampledSurface/sampledPatch/sampledPatch.C +++ b/src/sampling/sampledSurface/sampledPatch/sampledPatch.C @@ -111,7 +111,7 @@ bool Foam::sampledPatch::update() return false; } - label patchI = mesh().boundaryMesh().findPatchID(patchName_); + const label patchI = mesh().boundaryMesh().findPatchID(patchName_); if (patchI != -1) { diff --git a/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C b/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C index ac416f50dac770f755035724c32eb7c68e5d32ec..44d22a111534bc5e0ce9b720934326af858d55f1 100644 --- a/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C +++ b/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C @@ -84,8 +84,7 @@ void Foam::linearValveFvMesh::addZonesAndModifiers() // Inner slider const word innerSliderName(motionDict_.subDict("slider").lookup("inside")); - const polyPatch& innerSlider = - boundaryMesh()[boundaryMesh().findPatchID(innerSliderName)]; + const polyPatch& innerSlider = boundaryMesh()[innerSliderName]; labelList isf(innerSlider.size()); @@ -105,8 +104,7 @@ void Foam::linearValveFvMesh::addZonesAndModifiers() // Outer slider const word outerSliderName(motionDict_.subDict("slider").lookup("outside")); - const polyPatch& outerSlider = - boundaryMesh()[boundaryMesh().findPatchID(outerSliderName)]; + const polyPatch& outerSlider = boundaryMesh()[outerSliderName]; labelList osf(outerSlider.size()); diff --git a/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C b/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C index 9723dcb3201cc2898b84141166183da1005aea83..636e440b31e8f1da04b7b698f55d51de4f8c9cf4 100644 --- a/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C +++ b/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C @@ -37,7 +37,6 @@ License namespace Foam { defineTypeNameAndDebug(linearValveLayersFvMesh, 0); - addToRunTimeSelectionTable(topoChangerFvMesh, linearValveLayersFvMesh, IOobject); } @@ -87,8 +86,7 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers() // Inner slider const word innerSliderName(motionDict_.subDict("slider").lookup("inside")); - const polyPatch& innerSlider = - boundaryMesh()[boundaryMesh().findPatchID(innerSliderName)]; + const polyPatch& innerSlider = boundaryMesh()[innerSliderName]; labelList isf(innerSlider.size()); @@ -108,8 +106,7 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers() // Outer slider const word outerSliderName(motionDict_.subDict("slider").lookup("outside")); - const polyPatch& outerSlider = - boundaryMesh()[boundaryMesh().findPatchID(outerSliderName)]; + const polyPatch& outerSlider = boundaryMesh()[outerSliderName]; labelList osf(outerSlider.size()); @@ -143,8 +140,7 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers() motionDict_.subDict("layer").lookup("patch") ); - const polyPatch& layerPatch = - boundaryMesh()[boundaryMesh().findPatchID(layerPatchName)]; + const polyPatch& layerPatch = boundaryMesh()[layerPatchName]; labelList lpf(layerPatch.size()); @@ -317,8 +313,7 @@ Foam::tmp<Foam::pointField> Foam::linearValveLayersFvMesh::newPoints() const motionDict_.subDict("layer").lookup("patch") ); - const polyPatch& layerPatch = - boundaryMesh()[boundaryMesh().findPatchID(layerPatchName)]; + const polyPatch& layerPatch = boundaryMesh()[layerPatchName]; const labelList& patchPoints = layerPatch.meshPoints(); diff --git a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C b/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C index 693e080bd61df04d08873f2a05f41046dd4b1edc..6a050e1c701b66b84a5c961f3a3a35c233682e85 100644 --- a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C +++ b/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C @@ -84,8 +84,7 @@ void Foam::mixerFvMesh::addZonesAndModifiers() // Inner slider const word innerSliderName(motionDict_.subDict("slider").lookup("inside")); - const polyPatch& innerSlider = - boundaryMesh()[boundaryMesh().findPatchID(innerSliderName)]; + const polyPatch& innerSlider = boundaryMesh()[innerSliderName]; labelList isf(innerSlider.size()); @@ -105,8 +104,7 @@ void Foam::mixerFvMesh::addZonesAndModifiers() // Outer slider const word outerSliderName(motionDict_.subDict("slider").lookup("outside")); - const polyPatch& outerSlider = - boundaryMesh()[boundaryMesh().findPatchID(outerSliderName)]; + const polyPatch& outerSlider = boundaryMesh()[outerSliderName]; labelList osf(outerSlider.size()); @@ -217,8 +215,7 @@ void Foam::mixerFvMesh::calcMovingMasks() const const cellList& c = cells(); const faceList& f = faces(); - const labelList& cellAddr = - cellZones()[cellZones().findZoneID("movingCells")]; + const labelList& cellAddr = cellZones()["movingCells"]; forAll(cellAddr, cellI) { @@ -242,8 +239,7 @@ void Foam::mixerFvMesh::calcMovingMasks() const + "Zone" ); - const labelList& innerSliderAddr = - faceZones()[faceZones().findZoneID(innerSliderZoneName)]; + const labelList& innerSliderAddr = faceZones()[innerSliderZoneName]; forAll(innerSliderAddr, faceI) { @@ -261,8 +257,7 @@ void Foam::mixerFvMesh::calcMovingMasks() const + "Zone" ); - const labelList& outerSliderAddr = - faceZones()[faceZones().findZoneID(outerSliderZoneName)]; + const labelList& outerSliderAddr = faceZones()[outerSliderZoneName]; forAll(outerSliderAddr, faceI) { diff --git a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C index 497c1ec8055d11c81a0cbfdb2cf66caaac903aa0..7de4dcce20f1f38f784852f51d2ad6ac06cb353a 100644 --- a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C +++ b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C @@ -290,18 +290,12 @@ Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io) curLeft_ = average ( - faceZones() - [ - faceZones().findZoneID("leftExtrusionFaces") - ]().localPoints() + faceZones()["leftExtrusionFaces"]().localPoints() ).x() - SMALL; curRight_ = average ( - faceZones() - [ - faceZones().findZoneID("rightExtrusionFaces") - ]().localPoints() + faceZones()["rightExtrusionFaces"]().localPoints() ).x() + SMALL; } @@ -448,18 +442,12 @@ bool Foam::movingConeTopoFvMesh::update() // curRight_ += curMotionVel_.x()*time().deltaTValue(); curLeft_ = average ( - faceZones() - [ - faceZones().findZoneID("leftExtrusionFaces") - ]().localPoints() + faceZones()["leftExtrusionFaces"]().localPoints() ).x() - SMALL; curRight_ = average ( - faceZones() - [ - faceZones().findZoneID("rightExtrusionFaces") - ]().localPoints() + faceZones()["rightExtrusionFaces"]().localPoints() ).x() + SMALL;