Skip to content
Snippets Groups Projects
Commit c3f2a01f authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: use range-for when iterating labelHashSet

parent f6deaeef
Branches
Tags
No related merge requests found
...@@ -75,10 +75,9 @@ objectivePartialVolume::objectivePartialVolume ...@@ -75,10 +75,9 @@ objectivePartialVolume::objectivePartialVolume
if (!dict.readIfPresent("initialVolume", initVol_)) if (!dict.readIfPresent("initialVolume", initVol_))
{ {
const scalar oneThird(1.0/3.0); const scalar oneThird(1.0/3.0);
forAllConstIters(objectivePatches_, iter) for (const label patchi : objectivePatches_)
{ {
label patchI = iter.key(); const fvPatch& patch = mesh_.boundary()[patchi];
const fvPatch& patch = mesh_.boundary()[patchI];
initVol_ -= oneThird*gSum(patch.Sf() & patch.Cf()); initVol_ -= oneThird*gSum(patch.Sf() & patch.Cf());
} }
} }
...@@ -95,10 +94,9 @@ scalar objectivePartialVolume::J() ...@@ -95,10 +94,9 @@ scalar objectivePartialVolume::J()
{ {
J_ = Zero; J_ = Zero;
const scalar oneThird(1.0/3.0); const scalar oneThird(1.0/3.0);
forAllConstIters(objectivePatches_, iter) for (const label patchi : objectivePatches_)
{ {
label patchI = iter.key(); const fvPatch& patch = mesh_.boundary()[patchi];
const fvPatch& patch = mesh_.boundary()[patchI];
J_ -= oneThird*gSum(patch.Sf() & patch.Cf()); J_ -= oneThird*gSum(patch.Sf() & patch.Cf());
} }
J_ -= initVol_; J_ -= initVol_;
...@@ -110,13 +108,12 @@ scalar objectivePartialVolume::J() ...@@ -110,13 +108,12 @@ scalar objectivePartialVolume::J()
void objectivePartialVolume::update_dxdbDirectMultiplier() void objectivePartialVolume::update_dxdbDirectMultiplier()
{ {
const scalar oneThird(1.0/3.0); const scalar oneThird(1.0/3.0);
forAllConstIter(labelHashSet, objectivePatches_, iter) for (const label patchi : objectivePatches_)
{ {
label pI = iter.key(); const fvPatch& patch = mesh_.boundary()[patchi];
const fvPatch& patch = mesh_.boundary()[pI];
tmp<vectorField> tnf = patch.nf(); tmp<vectorField> tnf = patch.nf();
const vectorField& nf = tnf(); const vectorField& nf = tnf();
bdxdbDirectMultPtr_()[pI] = -oneThird*nf/initVol_; bdxdbDirectMultPtr_()[patchi] = -oneThird*nf/initVol_;
} }
} }
...@@ -124,11 +121,10 @@ void objectivePartialVolume::update_dxdbDirectMultiplier() ...@@ -124,11 +121,10 @@ void objectivePartialVolume::update_dxdbDirectMultiplier()
void objectivePartialVolume::update_dSdbMultiplier() void objectivePartialVolume::update_dSdbMultiplier()
{ {
const scalar oneThird(1.0/3.0); const scalar oneThird(1.0/3.0);
forAllConstIter(labelHashSet, objectivePatches_, iter) for (const label patchi : objectivePatches_)
{ {
label pI = iter.key(); const fvPatch& patch = mesh_.boundary()[patchi];
const fvPatch& patch = mesh_.boundary()[pI]; bdSdbMultPtr_()[patchi] = -oneThird*patch.Cf()/initVol_;
bdSdbMultPtr_()[pI] = -oneThird*patch.Cf()/initVol_;
} }
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment