openfoam/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.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

36 lines
857 B
C

// ignore special fields (_0 fields),
// ignore fields we don't handle,
// ignore fields that are not available for all time-steps
// hash by field-name in fieldsToUse
if (!fieldsToUse.found(fieldName))
{
bool variableGood = false;
forAll(timeDirs, n1)
{
variableGood =
(
fieldName.size() > 2 && fieldName(fieldName.size()-2, 2) == "_0"
? false
: IOobject
(
fieldName,
timeDirs[n1].name(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false // no register
).typeHeaderOk<volScalarField>(false, false)
);
if (variableGood)
{
break;
}
}
reduce(variableGood, andOp<bool>());
fieldsToUse.set(fieldName, variableGood);
}