diff --git a/src/functionObjects/field/ddt/ddt.C b/src/functionObjects/field/ddt/ddt.C index 26452c7673..0909fba34f 100644 --- a/src/functionObjects/field/ddt/ddt.C +++ b/src/functionObjects/field/ddt/ddt.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -74,6 +74,7 @@ Foam::functionObjects::ddt::ddt : fieldExpression(name, runTime, dict) { + setResultName(typeName); read(dict); } diff --git a/src/functionObjects/field/div/div.C b/src/functionObjects/field/div/div.C index e1df394a5d..aead880845 100644 --- a/src/functionObjects/field/div/div.C +++ b/src/functionObjects/field/div/div.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,7 +63,9 @@ Foam::functionObjects::div::div ) : fieldExpression(name, runTime, dict) -{} +{ + setResultName(typeName); +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/functionObjects/field/fieldExpression/fieldExpression.C b/src/functionObjects/field/fieldExpression/fieldExpression.C index 1b7eedcdbd..8b2fda1e69 100644 --- a/src/functionObjects/field/fieldExpression/fieldExpression.C +++ b/src/functionObjects/field/fieldExpression/fieldExpression.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,24 +41,19 @@ namespace functionObjects void Foam::functionObjects::fieldExpression::setResultName ( - const word& typeName, - const word& defaultArg + const word& functionName, + const word& defaultFieldName ) { - if (fieldName_.empty()) - { - fieldName_ = defaultArg; - } - if (resultName_.empty()) { - if (fieldName_ != defaultArg) + if (defaultFieldName.empty() || fieldName_ != defaultFieldName) { - resultName_ = typeName + '(' + fieldName_ + ')'; + resultName_ = functionName + '(' + fieldName_ + ')'; } else { - resultName_ = typeName; + resultName_ = functionName; } } } diff --git a/src/functionObjects/field/fieldExpression/fieldExpression.H b/src/functionObjects/field/fieldExpression/fieldExpression.H index 4216886c17..20e7b3dacb 100644 --- a/src/functionObjects/field/fieldExpression/fieldExpression.H +++ b/src/functionObjects/field/fieldExpression/fieldExpression.H @@ -70,7 +70,11 @@ protected: virtual bool calc() = 0; - void setResultName(const word& typeName, const word& defaultArg); + void setResultName + ( + const word& functionName, + const word& defaultFieldName = word::null + ); template bool foundObject(const word& name); diff --git a/src/functionObjects/field/fieldsExpression/fieldsExpression.C b/src/functionObjects/field/fieldsExpression/fieldsExpression.C index ae096995c1..6a5f56eadd 100644 --- a/src/functionObjects/field/fieldsExpression/fieldsExpression.C +++ b/src/functionObjects/field/fieldsExpression/fieldsExpression.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,20 +41,20 @@ namespace functionObjects void Foam::functionObjects::fieldsExpression::setResultName ( - const word& typeName, - const wordList& defaultArgs + const word& functionName, + const wordList& defaultFieldNames ) { if (fieldNames_.empty()) { - fieldNames_ = defaultArgs; + fieldNames_ = defaultFieldNames; } if (resultName_.empty()) { if (!fieldNames_.empty()) { - resultName_ = typeName + '(' + fieldNames_[0]; + resultName_ = functionName + '(' + fieldNames_[0]; for (label i=1; i> scale_; return true;