Commit b006d337 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Improved backwards compatibility for pressure FO

parent 45b0aed8
...@@ -281,10 +281,17 @@ bool Foam::functionObjects::pressure::read(const dictionary& dict) ...@@ -281,10 +281,17 @@ bool Foam::functionObjects::pressure::read(const dictionary& dict)
rhoInfInitialised_ = true; rhoInfInitialised_ = true;
} }
if (dict.found("calcTotal")) if (!modeNames.readIfPresent("mode", dict, mode_))
{ {
// Backwards compatibility - check for the presence of 'calcTotal' // Backwards compatibility
if (dict.getCompat<bool>("mode", {{"calcTotal", 1812}})) // - 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; mode_ = TOTAL;
} }
...@@ -293,15 +300,11 @@ bool Foam::functionObjects::pressure::read(const dictionary& dict) ...@@ -293,15 +300,11 @@ bool Foam::functionObjects::pressure::read(const dictionary& dict)
mode_ = STATIC; mode_ = STATIC;
} }
if (dict.getCompat<bool>("mode", {{"calcCoeff", 1812}})) if (calcCoeff)
{ {
mode_ = static_cast<mode>(COEFF | mode_); mode_ = static_cast<mode>(COEFF | mode_);
} }
} }
else
{
mode_ = modeNames.get("mode", dict);
}
pRef_ = dict.lookupOrDefault<scalar>("pRef", 0); pRef_ = dict.lookupOrDefault<scalar>("pRef", 0);
......
...@@ -82,8 +82,7 @@ Usage ...@@ -82,8 +82,7 @@ Usage
type pressure; type pressure;
libs ("libfieldFunctionObjects.so"); libs ("libfieldFunctionObjects.so");
... ...
calcTotal no; mode staticCoeff;
calcCoeff yes;
} }
\endverbatim \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