Commit 32bd3800 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Improved backwards compatibility for pressure FO

parent 355d6c4c
......@@ -281,10 +281,17 @@ bool Foam::functionObjects::pressure::read(const dictionary& dict)
rhoInfInitialised_ = true;
}
if (dict.found("calcTotal"))
if (!modeNames.readIfPresent("mode", dict, mode_))
{
// Backwards compatibility - check for the presence of 'calcTotal'
if (dict.getCompat<bool>("mode", {{"calcTotal", 1812}}))
// Backwards compatibility
// - check for the presence of 'calcTotal' and 'calcCoeff'
bool calcTotal =
dict.getOrDefaultCompat<bool>("mode", {{"calcTotal", 1812}}, false);
bool calcCoeff =
dict.getOrDefaultCompat<bool>("mode", {{"calcCoeff", 1812}}, false);
if (calcTotal)
{
mode_ = TOTAL;
}
......@@ -293,15 +300,11 @@ bool Foam::functionObjects::pressure::read(const dictionary& dict)
mode_ = STATIC;
}
if (dict.getCompat<bool>("mode", {{"calcCoeff", 1812}}))
if (calcCoeff)
{
mode_ = static_cast<mode>(COEFF | mode_);
}
}
else
{
mode_ = modeNames.get("mode", dict);
}
pRef_ = dict.lookupOrDefault<scalar>("pRef", 0);
......
......@@ -82,8 +82,7 @@ Usage
type pressure;
libs ("libfieldFunctionObjects.so");
...
calcTotal no;
calcCoeff yes;
mode staticCoeff;
}
\endverbatim
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment