1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
for (label i=0; i < nTypes; i++)
{
wordList fieldNames = objects.names(fieldTypes[i]);
if (fieldTypes[i] == "volScalarField")
{
gmvFile << "variable" << nl;
}
forAll(fieldNames, j)
{
const word& fieldName = fieldNames[j];
IOobject fieldObject
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (fieldTypes[i] == "volScalarField")
{
volScalarField fld(fieldObject, mesh);
gmvFile << fieldName << " 0" << nl;
for (label indx=0;indx<mesh.nCells();indx++)
{
gmvFile << fld[indx] << " ";
}
gmvFile << nl;
}
if (fieldTypes[i] == "volVectorField")
{
if (fieldName == vComp)
{
volVectorField fld(fieldObject, mesh);
gmvFile << "velocity 0" << nl;
for (label indx=0;indx<mesh.nCells();indx++)
{
gmvFile << fld[indx].x() << " ";
}
for (label indx=0;indx<mesh.nCells();indx++)
{
gmvFile << fld[indx].y() << " ";
}
for (label indx=0;indx<mesh.nCells();indx++)
{
gmvFile << fld[indx].z() << " ";
}
gmvFile << nl;
}
}
if (fieldTypes[i] == "surfaceScalarField")
{
// ...
}
}
if (fieldTypes[i] == cloud::prefix)
{
IOobject lagrangianHeader
(
"positions",
runTime.timeName(),
cloud::prefix,
mesh,
IOobject::NO_READ
);
if (lagrangianHeader.headerOk())
{
Cloud<passiveParticle> particles(mesh);
IOobjectList objects(mesh, runTime.timeName(), cloud::prefix);
wordList lagrangianScalarNames = objects.names("scalarField");
wordList lagrangianVectorNames = objects.names("vectorField");
if (particles.size())
{
#include "gmvOutputLagrangian.H"
}
}
}
if (fieldTypes[i] == "volScalarField")
{
gmvFile << "endvars" << nl;
}
}
|