openfoam/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H
Mark Olesen 784461b2fa ENH: make search of instances in IOobject::typeHeaderOk optional (issue #245)
- in specific cases it can be useful to suppress searching the instances.
  For example, if one only wishes to check if a "points" is available at
  the given time instance, without searching backwards through all
  times.
2016-11-21 14:28:40 +01:00

47 lines
1.0 KiB
C

// check for "points" in any of the result directories
bool meshMoving = false;
if (timeDirs.size() > 1 && Pstream::master())
{
// We already loaded a mesh (usually from constant).
// See if any other "polyMesh/points" files exist too.
Info<< "Search for moving mesh ... " << flush;
forAll(timeDirs, timeI)
{
const word& timeName = timeDirs[timeI].name();
meshMoving =
(
timeName != mesh.pointsInstance()
&& IOobject
(
"points",
timeName,
polyMesh::meshSubDir,
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false // no register
).typeHeaderOk<pointIOField>(true, false)
);
if (meshMoving)
{
break;
}
}
if (meshMoving)
{
Info<< "found. Writing meshes for every timestep." << endl;
}
else
{
Info<< "none detected." << endl;
}
}
reduce(meshMoving, orOp<bool>());