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:
@ -72,7 +72,7 @@ public:
|
||||
|
||||
void testCallbackFunction() const
|
||||
{
|
||||
forAllConstIter(callbackRegistry, *this, iter)
|
||||
forAllConstIters(*this, iter)
|
||||
{
|
||||
iter().testCallbackFunction();
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< fvc::div(U);
|
||||
|
||||
Info<< "end" << endl;
|
||||
Info<< "End" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ int main()
|
||||
a = h + i + j;
|
||||
Info<< a << endl;
|
||||
|
||||
Info<< "end" << endl;
|
||||
Info<< "End" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ int main(int argc, char *argv[])
|
||||
Info<< (gradx4a - gradx4[i])/gradx4a << endl;
|
||||
}
|
||||
|
||||
Info<< "end" << endl;
|
||||
Info<< "End" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ int main(int argc, char *argv[])
|
||||
mesh
|
||||
);
|
||||
|
||||
Info<< "end" << endl;
|
||||
Info<< "End" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ int main()
|
||||
);
|
||||
phi.write("phi", "xmgr");
|
||||
|
||||
Info<< "end" << endl;
|
||||
Info<< "End" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ int main()
|
||||
"xmgr"
|
||||
);
|
||||
|
||||
Info<< "end" << endl;
|
||||
Info<< "End" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ int main()
|
||||
|
||||
graph("r", "x", "r", x, r).write("r", "xmgr");
|
||||
|
||||
Info<< "end" << endl;
|
||||
Info<< "End" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -59,11 +59,11 @@ int main(int argc, char *argv[])
|
||||
Pout<< "Adding a particle." << endl;
|
||||
particles.addParticle(new passiveParticle(mesh, Zero, -1));
|
||||
|
||||
forAllConstIter(passiveParticleCloud, particles, iter)
|
||||
for (const passiveParticle& p : particles)
|
||||
{
|
||||
Pout<< " " << iter().position() << " cell:" << iter().cell()
|
||||
<< " origProc:" << iter().origProc()
|
||||
<< " origId:" << iter().origId()
|
||||
Pout<< " " << p.position() << " cell:" << p.cell()
|
||||
<< " origProc:" << p.origProc()
|
||||
<< " origId:" << p.origId()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -80,11 +80,11 @@ int main(int argc, char *argv[])
|
||||
passiveParticleCloud particles(mesh, cloudName);
|
||||
Pout<< "Reread particles:" << particles.size() << endl;
|
||||
|
||||
forAllConstIter(passiveParticleCloud, particles, iter)
|
||||
for (const passiveParticle& p : particles)
|
||||
{
|
||||
Pout<< " " << iter().position() << " cell:" << iter().cell()
|
||||
<< " origProc:" << iter().origProc()
|
||||
<< " origId:" << iter().origId()
|
||||
Pout<< " " << p.position() << " cell:" << p.cell()
|
||||
<< " origProc:" << p.origProc()
|
||||
<< " origId:" << p.origId()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,10 +261,10 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
|
||||
}
|
||||
|
||||
// 2. Does sparseData contain more?
|
||||
forAllConstIter(Map<point>, sparseData, iter)
|
||||
forAllConstIters(sparseData, iter)
|
||||
{
|
||||
const point& sparsePt = iter();
|
||||
label meshPointi = iter.key();
|
||||
const label meshPointi = iter.key();
|
||||
const point& sparsePt = iter.val();
|
||||
const point& fullPt = fullData[meshPointi];
|
||||
|
||||
if (fullPt != sparsePt)
|
||||
@ -350,9 +350,9 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
|
||||
{
|
||||
const edge& e = mesh.edges()[meshEdgeI];
|
||||
|
||||
EdgeMap<point>::const_iterator iter = sparseData.find(e);
|
||||
const auto iter = sparseData.cfind(e);
|
||||
|
||||
if (iter != sparseData.end())
|
||||
if (iter.found())
|
||||
{
|
||||
const point& sparsePt = iter();
|
||||
const point& fullPt = fullData[meshEdgeI];
|
||||
|
||||
Reference in New Issue
Block a user