diff --git a/src/OpenFOAM/expressions/exprDriver/exprDriver.H b/src/OpenFOAM/expressions/exprDriver/exprDriver.H index d94a0a82cd..968030cd2b 100644 --- a/src/OpenFOAM/expressions/exprDriver/exprDriver.H +++ b/src/OpenFOAM/expressions/exprDriver/exprDriver.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2010-2018 Bernhard Gschaider - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -284,7 +284,7 @@ public: //- Return the expression result as a tmp field template - tmp> getResult(bool isPointVal=false); + tmp> getResult(bool wantPointData=false); //- The result type as word - same as result().valueType() virtual word getResultType() const @@ -388,7 +388,7 @@ public: bool isLocalVariable ( const word& name, - bool isPointVal, + bool wantPointData = false, label expectedSize = -1 ) const; @@ -424,7 +424,7 @@ public: evaluate ( const expressions::exprString& expr, - bool isPointVal = false + bool wantPointData = false ); //- Evaluate the expression and return a single value @@ -432,7 +432,7 @@ public: inline Type evaluateUniform ( const expressions::exprString& expr, - bool isPointVal = false + bool wantPointData = false ); diff --git a/src/OpenFOAM/expressions/exprDriver/exprDriverI.H b/src/OpenFOAM/expressions/exprDriver/exprDriverI.H index 5c5342e641..6924af55e1 100644 --- a/src/OpenFOAM/expressions/exprDriver/exprDriverI.H +++ b/src/OpenFOAM/expressions/exprDriver/exprDriverI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2010-2018 Bernhard Gschaider - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -75,12 +75,12 @@ template Foam::tmp> Foam::expressions::exprDriver::evaluate ( const expressions::exprString& expr, - bool isPointVal + bool wantPointData ) { parse(expr); - return getResult(isPointVal); + return getResult(wantPointData); } @@ -89,7 +89,7 @@ template inline Type Foam::expressions::exprDriver::evaluateUniform ( const expressions::exprString& expr, - bool isPointVal + bool wantPointData ) { parse(expr); diff --git a/src/OpenFOAM/expressions/exprDriver/exprDriverTemplates.C b/src/OpenFOAM/expressions/exprDriver/exprDriverTemplates.C index 063230b19f..1a33ecee4a 100644 --- a/src/OpenFOAM/expressions/exprDriver/exprDriverTemplates.C +++ b/src/OpenFOAM/expressions/exprDriver/exprDriverTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2010-2018 Bernhard Gschaider - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -145,13 +145,13 @@ Type Foam::expressions::exprDriver::exprDriver::weightedSum template Foam::tmp> -Foam::expressions::exprDriver::getResult(bool isPointVal) +Foam::expressions::exprDriver::getResult(bool wantPointData) { - if (!result_.isPointValue(isPointVal)) + if (!result_.isPointData(wantPointData)) { FatalErrorInFunction - << "Expected a" << (isPointVal ? " point" : "") - << " field, but found a" << (!isPointVal ? " point" : "") + << "Expected a" << (wantPointData ? " point" : "") + << " field, but found a" << (!wantPointData ? " point" : "") << " field" << nl << exit(FatalError); } @@ -166,15 +166,16 @@ template bool Foam::expressions::exprDriver::isLocalVariable ( const word& name, - bool isPointVal, + bool wantPointData, label expectedSize ) const { DebugInfo - << "Looking for local" << (isPointVal ? " point" : "") + << "Looking for local" << (wantPointData ? " point" : "") << " field name:" << name << " type:" << pTraits::typeName << " size:" << expectedSize; + bool good = hasVariable(name); if (good) @@ -182,10 +183,11 @@ bool Foam::expressions::exprDriver::isLocalVariable const exprResult& var = variable(name); DebugInfo - << " - found (" << var.valueType() << ' ' << var.isPointValue() << ')'; + << " - found (" << var.valueType() << ' ' + << var.isPointData() << ')'; - good = (var.isType() && var.isPointValue(isPointVal)); + good = (var.isType() && var.isPointData(wantPointData)); // Do size checking if requested if (good && expectedSize >= 0) diff --git a/src/OpenFOAM/expressions/exprResult/exprResult.C b/src/OpenFOAM/expressions/exprResult/exprResult.C index 43de67484d..afe1ae9b4c 100644 --- a/src/OpenFOAM/expressions/exprResult/exprResult.C +++ b/src/OpenFOAM/expressions/exprResult/exprResult.C @@ -166,7 +166,7 @@ bool Foam::expressions::exprResult::getUniformCheckedBool // TODO? } - result.setResult(avg, size); + result.setResult(avg, size); return true; } @@ -207,7 +207,7 @@ Foam::expressions::exprResult::exprResult() refCount(), valType_(), isUniform_(false), - isPointVal_(false), + isPointData_(false), noReset_(false), needsReset_(false), size_(0), @@ -245,7 +245,7 @@ Foam::expressions::exprResult::exprResult refCount(), valType_(dict.getOrDefault("valueType", "")), isUniform_(dict.getOrDefault("isSingleValue", uniform)), - isPointVal_(dict.getOrDefault("isPointValue", false)), + isPointData_(dict.getOrDefault("isPointValue", false)), noReset_(dict.getOrDefault("noReset", false)), needsReset_(false), size_(0), @@ -268,20 +268,21 @@ Foam::expressions::exprResult::exprResult const bool ok = ( - readChecked("value", dict, len, uniform) - || readChecked("value", dict, len, uniform) + // Just use for