functionObject::fieldExpression: Corrected construction of the result field name
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -74,6 +74,7 @@ Foam::functionObjects::ddt::ddt
|
|||||||
:
|
:
|
||||||
fieldExpression(name, runTime, dict)
|
fieldExpression(name, runTime, dict)
|
||||||
{
|
{
|
||||||
|
setResultName(typeName);
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -63,7 +63,9 @@ Foam::functionObjects::div::div
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fieldExpression(name, runTime, dict)
|
fieldExpression(name, runTime, dict)
|
||||||
{}
|
{
|
||||||
|
setResultName(typeName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -41,24 +41,19 @@ namespace functionObjects
|
|||||||
|
|
||||||
void Foam::functionObjects::fieldExpression::setResultName
|
void Foam::functionObjects::fieldExpression::setResultName
|
||||||
(
|
(
|
||||||
const word& typeName,
|
const word& functionName,
|
||||||
const word& defaultArg
|
const word& defaultFieldName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (fieldName_.empty())
|
|
||||||
{
|
|
||||||
fieldName_ = defaultArg;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resultName_.empty())
|
if (resultName_.empty())
|
||||||
{
|
{
|
||||||
if (fieldName_ != defaultArg)
|
if (defaultFieldName.empty() || fieldName_ != defaultFieldName)
|
||||||
{
|
{
|
||||||
resultName_ = typeName + '(' + fieldName_ + ')';
|
resultName_ = functionName + '(' + fieldName_ + ')';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
resultName_ = typeName;
|
resultName_ = functionName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,11 @@ protected:
|
|||||||
|
|
||||||
virtual bool calc() = 0;
|
virtual bool calc() = 0;
|
||||||
|
|
||||||
void setResultName(const word& typeName, const word& defaultArg);
|
void setResultName
|
||||||
|
(
|
||||||
|
const word& functionName,
|
||||||
|
const word& defaultFieldName = word::null
|
||||||
|
);
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool foundObject(const word& name);
|
bool foundObject(const word& name);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -41,20 +41,20 @@ namespace functionObjects
|
|||||||
|
|
||||||
void Foam::functionObjects::fieldsExpression::setResultName
|
void Foam::functionObjects::fieldsExpression::setResultName
|
||||||
(
|
(
|
||||||
const word& typeName,
|
const word& functionName,
|
||||||
const wordList& defaultArgs
|
const wordList& defaultFieldNames
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (fieldNames_.empty())
|
if (fieldNames_.empty())
|
||||||
{
|
{
|
||||||
fieldNames_ = defaultArgs;
|
fieldNames_ = defaultFieldNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resultName_.empty())
|
if (resultName_.empty())
|
||||||
{
|
{
|
||||||
if (!fieldNames_.empty())
|
if (!fieldNames_.empty())
|
||||||
{
|
{
|
||||||
resultName_ = typeName + '(' + fieldNames_[0];
|
resultName_ = functionName + '(' + fieldNames_[0];
|
||||||
for (label i=1; i<fieldNames_.size(); i++)
|
for (label i=1; i<fieldNames_.size(); i++)
|
||||||
{
|
{
|
||||||
resultName_ += ',' + fieldNames_[i];
|
resultName_ += ',' + fieldNames_[i];
|
||||||
@ -63,7 +63,7 @@ void Foam::functionObjects::fieldsExpression::setResultName
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
resultName_ = typeName;
|
resultName_ = functionName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,8 +70,8 @@ protected:
|
|||||||
|
|
||||||
void setResultName
|
void setResultName
|
||||||
(
|
(
|
||||||
const word& typeName,
|
const word& functionName,
|
||||||
const wordList& defaultArg = wordList::null()
|
const wordList& defaultFieldNames = wordList::null()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Call 'calcFieldType' for the given functionObject
|
//- Call 'calcFieldType' for the given functionObject
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -62,6 +62,7 @@ Foam::functionObjects::grad::grad
|
|||||||
:
|
:
|
||||||
fieldExpression(name, runTime, dict)
|
fieldExpression(name, runTime, dict)
|
||||||
{
|
{
|
||||||
|
setResultName(typeName);
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -99,6 +99,7 @@ Foam::functionObjects::log::log
|
|||||||
clipValue_(0),
|
clipValue_(0),
|
||||||
checkDimensions_(true)
|
checkDimensions_(true)
|
||||||
{
|
{
|
||||||
|
setResultName(typeName);
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -65,6 +65,7 @@ Foam::functionObjects::mag::mag
|
|||||||
:
|
:
|
||||||
fieldExpression(name, runTime, dict)
|
fieldExpression(name, runTime, dict)
|
||||||
{
|
{
|
||||||
|
setResultName(typeName);
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -65,6 +65,7 @@ Foam::functionObjects::magSqr::magSqr
|
|||||||
:
|
:
|
||||||
fieldExpression(name, runTime, dict)
|
fieldExpression(name, runTime, dict)
|
||||||
{
|
{
|
||||||
|
setResultName(typeName);
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -65,6 +65,7 @@ Foam::functionObjects::randomise::randomise
|
|||||||
:
|
:
|
||||||
fieldExpression(name, runTime, dict)
|
fieldExpression(name, runTime, dict)
|
||||||
{
|
{
|
||||||
|
setResultName(typeName);
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -66,6 +66,7 @@ Foam::functionObjects::scale::scale
|
|||||||
fieldExpression(name, runTime, dict),
|
fieldExpression(name, runTime, dict),
|
||||||
scale_(0)
|
scale_(0)
|
||||||
{
|
{
|
||||||
|
setResultName(typeName);
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,12 +82,6 @@ Foam::functionObjects::scale::~scale()
|
|||||||
bool Foam::functionObjects::scale::read(const dictionary& dict)
|
bool Foam::functionObjects::scale::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
fieldExpression::read(dict);
|
fieldExpression::read(dict);
|
||||||
|
|
||||||
if (resultName_.empty())
|
|
||||||
{
|
|
||||||
resultName_ = "scale(" + fieldName_ + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
dict.lookup("scale") >> scale_;
|
dict.lookup("scale") >> scale_;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user