ENH: for-range, forAllIters() ... in applications/utilities

- reduced clutter when iterating over containers
This commit is contained in:
Mark Olesen
2019-01-07 09:20:51 +01:00
parent 1458b4f689
commit 14a404170b
76 changed files with 592 additions and 728 deletions

View File

@ -74,7 +74,7 @@ if (doLagrangian)
forAllConstIters(theseCloudFields, fieldIter)
{
const word& fieldName = fieldIter.key();
const word& fieldType = fieldIter.object();
const word& fieldType = fieldIter.val();
IOobject fieldObject
(

View File

@ -73,7 +73,7 @@ if (doLagrangian)
forAllConstIters(theseCloudFields, fieldIter)
{
const word& fieldName = fieldIter.key();
const word& fieldType = fieldIter.object();
const word& fieldType = fieldIter.val();
IOobject fieldObject
(

View File

@ -1,19 +1,19 @@
gmvFile << "tracers " << particles.size() << nl;
forAllConstIter(Cloud<passiveParticle>, particles, iter)
for (const passiveParticle& p : particles)
{
gmvFile << iter().position().x() << ' ';
gmvFile << p.position().x() << ' ';
}
gmvFile << nl;
forAllConstIter(Cloud<passiveParticle>, particles, iter)
for (const passiveParticle& p : particles)
{
gmvFile << iter().position().y() << ' ';
gmvFile << p.position().y() << ' ';
}
gmvFile << nl;
forAllConstIter(Cloud<passiveParticle>, particles, iter)
for (const passiveParticle& p : particles)
{
gmvFile << iter().position().z() << ' ';
gmvFile << p.position().z() << ' ';
}
gmvFile << nl;
@ -36,9 +36,9 @@ for (const word& name : lagrangianScalarNames)
{
gmvFile << name << nl;
forAll(fld, n)
for (const scalar& val : fld)
{
gmvFile << fld[n] << token::SPACE;
gmvFile << val << token::SPACE;
}
gmvFile << nl;
}

View File

@ -1,48 +1,48 @@
gmvFile << "tracers " << particles.size() << nl;
forAllConstIter(discretePhase, particles, iter)
for (const passiveParticle& p : particles)
{
gmvFile << iter().position().x() << " ";
gmvFile << p.position().x() << " ";
}
gmvFile << nl;
forAllConstIter(discretePhase, particles, iter)
for (const passiveParticle& p : particles)
{
gmvFile << iter().position().y() << " ";
gmvFile << p.position().y() << " ";
}
gmvFile << nl;
forAllConstIter(discretePhase, particles, iter)
for (const passiveParticle& p : particles)
{
gmvFile << iter().position().z() << " ";
gmvFile << p.position().z() << " ";
}
gmvFile << nl;
gmvFile << "U" << nl;
forAllConstIter(discretePhase, particles, iter)
for (const passiveParticle& p : particles)
{
gmvFile << iter().velocity().x() << " ";
gmvFile << p.velocity().x() << " ";
}
gmvFile << nl;
gmvFile << "V" << nl;
forAllConstIter(discretePhase, particles, iter)
for (const passiveParticle& p : particles)
{
gmvFile << iter().velocity().y() << " ";
gmvFile << p.velocity().y() << " ";
}
gmvFile << nl;
gmvFile << "W" << nl;
forAllConstIter(discretePhase, particles, iter)
for (const passiveParticle& p : particles)
{
{
gmvFile << iter().velocity().z() << " ";
gmvFile << p.velocity().z() << " ";
}
gmvFile << nl;
gmvFile << "Diam" << nl;
forAllConstIter(discretePhase, particles, iter)
for (const passiveParticle& p : particles)
{
gmvFile << iter().d() << " ";
gmvFile << p.d() << " ";
}
gmvFile << "endtrace"<< nl;

View File

@ -1,19 +1,19 @@
gmvFile << "tracers " << particles.size() << nl;
forAllConstIter(Cloud<passiveParticle>, particles, iter)
for (const passiveParticle& p : particles)
{
gmvFile << iter().position().x() << " ";
gmvFile << p.position().x() << " ";
}
gmvFile << nl;
forAllConstIter(Cloud<passiveParticle>, particles, iter)
for (const passiveParticle& p : particles)
{
gmvFile << iter().position().y() << " ";
gmvFile << p.position().y() << " ";
}
gmvFile << nl;
forAllConstIter(Cloud<passiveParticle>, particles, iter)
for (const passiveParticle& p : particles)
{
gmvFile << iter().position().z() << " ";
gmvFile << p.position().z() << " ";
}
gmvFile << nl;