functionObjects::fieldExpression: fieldName is now const as it cannot be changed after construction

This commit is contained in:
Henry Weller
2019-11-29 16:54:54 +00:00
parent 8a6800abfe
commit da50aba2c4
5 changed files with 6 additions and 12 deletions

View File

@ -78,8 +78,6 @@ bool Foam::functionObjects::blendingFactor::read(const dictionary& dict)
{
phiName_ = dict.lookupOrDefault<word>("phi", "phi");
resultName_ = "blendingFactor:" + fieldName_;
return true;
}

View File

@ -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,10 +41,8 @@ bool Foam::functionObjects::components::calcFieldComponents()
for (direction i=0; i<Type::nComponents; i++)
{
resultName_ = fieldName_ + word(Type::componentNames[i]);
resultNames_[i] = resultName_;
stored = stored && store(resultName_, field.component(i));
resultNames_[i] = fieldName_ + word(Type::componentNames[i]);
stored = stored && store(resultNames_[i], field.component(i));
}
return stored;

View File

@ -60,7 +60,7 @@ protected:
// Protected member data
//- Name of field to process
word fieldName_;
const word fieldName_;
//- Name of result field
word resultName_;

View File

@ -63,7 +63,7 @@ Foam::functionObjects::randomise::randomise
const dictionary& dict
)
:
fieldExpression(name, runTime, dict, typeName)
fieldExpression(name, runTime, dict, fieldName_ + "Random", fieldName_)
{
read(dict);
}

View File

@ -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
@ -37,8 +37,6 @@ bool Foam::functionObjects::randomise::calcRandomised()
{
const VolFieldType& field = lookupObject<VolFieldType>(fieldName_);
resultName_ = fieldName_ + "Random";
tmp<VolFieldType> rfieldt(new VolFieldType(field));
VolFieldType& rfield = rfieldt.ref();