From a43eb01b7e949cc628595ca828fe287e5c84af60 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 7 Jan 2019 09:20:51 +0100 Subject: [PATCH] ENH: for-range, forAllIters() ... in finiteVolume/ - reduced clutter when iterating over containers --- .../solutionControlTemplates.C | 25 +++++---- .../singleCellFvMesh/singleCellFvMesh.C | 18 +++---- .../multivariateScheme/multivariateScheme.C | 7 ++- .../multivariateSelectionScheme.C | 7 ++- .../volPointInterpolation/pointConstraints.C | 51 ++++++++++--------- .../pairPatchAgglomeration.C | 2 +- .../oversetPolyPatch/oversetGAMGInterface.C | 16 +++--- ...sRadiativeCoupledMixedFvPatchScalarField.C | 10 ++-- 8 files changed, 67 insertions(+), 69 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlTemplates.C b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlTemplates.C index f7f0425e54..4c62431f92 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlTemplates.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2013 OpenFOAM Foundation @@ -36,24 +36,23 @@ void Foam::solutionControl::storePrevIter() const { typedef GeometricField GeoField; - HashTable - flds(mesh_.objectRegistry::lookupClass()); + HashTable flds(mesh_.objectRegistry::lookupClass()); - forAllIter(typename HashTable, flds, iter) + forAllIters(flds, iter) { GeoField& fld = *iter(); - const word& fName = fld.name(); + const word& fldName = fld.name(); - size_t prevIterField = fName.find("PrevIter"); - - if ((prevIterField == word::npos) && mesh_.relaxField(fName)) + if + ( + (fldName.find("PrevIter") == std::string::npos) + && mesh_.relaxField(fldName) + ) { - if (debug) - { - Info<< algorithmName_ << ": storing previous iter for " - << fName << endl; - } + DebugInfo + << algorithmName_ << ": storing previous iter for " + << fldName << endl; fld.storePrevIter(); } diff --git a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C index 074c0c447a..0b149f1317 100644 --- a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C +++ b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C @@ -104,18 +104,12 @@ void Foam::singleCellFvMesh::agglomerateMesh label myZone = agglom[patchi][i]; label nbrZone = nbrAgglom[bFacei]; - Map