openfoam/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H
Mark Olesen 7b4680482e ENH: use string endsWith in a few places
fieldName.endsWith("_0")
vs
    fieldName.size() > 2 && fieldName(fieldName.size()-2, 2) == "_0"
2016-12-18 23:58:45 +01:00

35 lines
800 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.endsWith("_0")
&& 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);
}