mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: for-range, forAllIters() ... in applications/utilities
- reduced clutter when iterating over containers
This commit is contained in:
@ -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
|
||||
(
|
||||
|
||||
@ -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
|
||||
(
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user