BUG: Updated fieldMinMax function object to handle empty patches

This commit is contained in:
andy
2012-11-22 12:15:56 +00:00
parent 9f850b6cea
commit f6e02c19c7

View File

@ -75,20 +75,23 @@ void Foam::fieldMinMax::calcMinMaxFields
forAll(magFieldBoundary, patchI) forAll(magFieldBoundary, patchI)
{ {
const scalarField& mfp = magFieldBoundary[patchI]; const scalarField& mfp = magFieldBoundary[patchI];
const vectorField& Cfp = CfBoundary[patchI]; if (mfp.size())
label minPI = findMin(mfp);
if (mfp[minPI] < minVs[procI])
{ {
minVs[procI] = mfp[minPI]; const vectorField& Cfp = CfBoundary[patchI];
minCs[procI] = Cfp[minPI];
}
label maxPI = findMax(mfp); label minPI = findMin(mfp);
if (mfp[maxPI] > maxVs[procI]) if (mfp[minPI] < minVs[procI])
{ {
maxVs[procI] = mfp[maxPI]; minVs[procI] = mfp[minPI];
maxCs[procI] = Cfp[maxPI]; minCs[procI] = Cfp[minPI];
}
label maxPI = findMax(mfp);
if (mfp[maxPI] > maxVs[procI])
{
maxVs[procI] = mfp[maxPI];
maxCs[procI] = Cfp[maxPI];
}
} }
} }
@ -173,20 +176,23 @@ void Foam::fieldMinMax::calcMinMaxFields
forAll(fieldBoundary, patchI) forAll(fieldBoundary, patchI)
{ {
const Field<Type>& fp = fieldBoundary[patchI]; const Field<Type>& fp = fieldBoundary[patchI];
const vectorField& Cfp = CfBoundary[patchI]; if (fp.size())
label minPI = findMin(fp);
if (fp[minPI] < minVs[procI])
{ {
minVs[procI] = fp[minPI]; const vectorField& Cfp = CfBoundary[patchI];
minCs[procI] = Cfp[minPI];
}
label maxPI = findMax(fp); label minPI = findMin(fp);
if (fp[maxPI] > maxVs[procI]) if (fp[minPI] < minVs[procI])
{ {
maxVs[procI] = fp[maxPI]; minVs[procI] = fp[minPI];
maxCs[procI] = Cfp[maxPI]; minCs[procI] = Cfp[minPI];
}
label maxPI = findMax(fp);
if (fp[maxPI] > maxVs[procI])
{
maxVs[procI] = fp[maxPI];
maxCs[procI] = Cfp[maxPI];
}
} }
} }
@ -250,7 +256,14 @@ void Foam::fieldMinMax::calcMinMaxFields
} }
default: default:
{ {
FatalErrorIn("Foam::fieldMinMax::calcMinMaxFields(const word&)") FatalErrorIn
(
"Foam::fieldMinMax::calcMinMaxFields"
"("
"const word&, "
"const modeType&"
")"
)
<< "Unknown min/max mode: " << modeTypeNames_[mode_] << "Unknown min/max mode: " << modeTypeNames_[mode_]
<< exit(FatalError); << exit(FatalError);
} }