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,6 +75,8 @@ void Foam::fieldMinMax::calcMinMaxFields
forAll(magFieldBoundary, patchI) forAll(magFieldBoundary, patchI)
{ {
const scalarField& mfp = magFieldBoundary[patchI]; const scalarField& mfp = magFieldBoundary[patchI];
if (mfp.size())
{
const vectorField& Cfp = CfBoundary[patchI]; const vectorField& Cfp = CfBoundary[patchI];
label minPI = findMin(mfp); label minPI = findMin(mfp);
@ -91,6 +93,7 @@ void Foam::fieldMinMax::calcMinMaxFields
maxCs[procI] = Cfp[maxPI]; maxCs[procI] = Cfp[maxPI];
} }
} }
}
Pstream::gatherList(minVs); Pstream::gatherList(minVs);
Pstream::gatherList(minCs); Pstream::gatherList(minCs);
@ -173,6 +176,8 @@ void Foam::fieldMinMax::calcMinMaxFields
forAll(fieldBoundary, patchI) forAll(fieldBoundary, patchI)
{ {
const Field<Type>& fp = fieldBoundary[patchI]; const Field<Type>& fp = fieldBoundary[patchI];
if (fp.size())
{
const vectorField& Cfp = CfBoundary[patchI]; const vectorField& Cfp = CfBoundary[patchI];
label minPI = findMin(fp); label minPI = findMin(fp);
@ -189,6 +194,7 @@ void Foam::fieldMinMax::calcMinMaxFields
maxCs[procI] = Cfp[maxPI]; maxCs[procI] = Cfp[maxPI];
} }
} }
}
Pstream::gatherList(minVs); Pstream::gatherList(minVs);
Pstream::gatherList(minCs); Pstream::gatherList(minCs);
@ -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);
} }