openfoam/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputLagrangian.H
Mark Olesen 02ad76df4f ENH: allow wordHashSet filter for IOobjectList::names
- simplifies usage.
  Support syncPar check on names() to detect inconsistencies.

- simplify readFields, ReadFields and other routines by using these
  new methods.
2018-07-26 14:56:52 +02:00

95 lines
1.7 KiB
C

gmvFile << "tracers " << particles.size() << nl;
forAllConstIter(Cloud<passiveParticle>, particles, iter)
{
gmvFile << iter().position().x() << ' ';
}
gmvFile << nl;
forAllConstIter(Cloud<passiveParticle>, particles, iter)
{
gmvFile << iter().position().y() << ' ';
}
gmvFile << nl;
forAllConstIter(Cloud<passiveParticle>, particles, iter)
{
gmvFile << iter().position().z() << ' ';
}
gmvFile << nl;
for (const word& name : lagrangianScalarNames)
{
IOField<scalar> fld
(
IOobject
(
name,
runTime.timeName(),
cloud::prefix,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
if (fld.size())
{
gmvFile << name << nl;
forAll(fld, n)
{
gmvFile << fld[n] << token::SPACE;
}
gmvFile << nl;
}
}
for (const word& name : lagrangianVectorNames)
{
IOField<vector> fld
(
IOobject
(
name,
runTime.timeName(),
cloud::prefix,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
if (fld.size())
{
gmvFile << name + "x" << nl;
forAll(fld, n)
{
gmvFile << fld[n].x() << token::SPACE;
}
gmvFile << nl;
gmvFile << name + "y" << nl;
forAll(fld, n)
{
gmvFile << fld[n].y() << token::SPACE;
}
gmvFile << nl;
gmvFile << name + "z" << nl;
forAll(fld, n)
{
gmvFile << fld[n].z() << token::SPACE;
}
gmvFile << nl;
}
}
gmvFile << "endtrace"<< nl;