From 83c7e97655034bd6e65322a40719c1f5695242e8 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 18 May 2016 23:10:42 +0100 Subject: [PATCH] dynamicCode: Renamed 'redirectType' to 'name' to clarify the purpose of the entry which is to provide the name of the generated class. 'redirectType' is supported for backward-compatibility. --- .../dynamicCode/codedFvOptionTemplate.H | 2 +- .../db/dynamicLibrary/codedBase/codedBase.C | 12 +++---- .../db/dynamicLibrary/codedBase/codedBase.H | 4 +-- .../codedFixedValuePointPatchField.C | 31 +++++++++++-------- .../codedFixedValuePointPatchField.H | 4 +-- .../codedFixedValueFvPatchField.C | 31 +++++++++++-------- .../codedFixedValueFvPatchField.H | 4 +-- .../codedMixed/codedMixedFvPatchField.C | 31 +++++++++++-------- .../codedMixed/codedMixedFvPatchField.H | 6 ++-- .../sources/general/codedSource/CodedSource.C | 16 +++++----- .../sources/general/codedSource/CodedSource.H | 4 +-- .../general/codedSource/CodedSourceIO.C | 13 ++++++-- .../codedFunctionObject/codedFunctionObject.C | 28 +++++++++++------ .../codedFunctionObject/codedFunctionObject.H | 4 +-- .../potentialFoam/cylinder/system/controlDict | 6 ++-- .../engineFoam/kivaTest/system/controlDict | 2 +- .../simpleFoam/pipeCyclic/0.orig/U | 2 +- .../system/continuityFunctions | 2 +- 18 files changed, 117 insertions(+), 85 deletions(-) diff --git a/etc/codeTemplates/dynamicCode/codedFvOptionTemplate.H b/etc/codeTemplates/dynamicCode/codedFvOptionTemplate.H index 700ed050c5..2a10ff9b35 100644 --- a/etc/codeTemplates/dynamicCode/codedFvOptionTemplate.H +++ b/etc/codeTemplates/dynamicCode/codedFvOptionTemplate.H @@ -56,7 +56,7 @@ Description scalarCodedSourceCoeffs { fieldNames (h); - redirectType sourceTime; + name sourceTime; codeInclude #{ diff --git a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C index 17aad06a00..81ccc9a008 100644 --- a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C +++ b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -280,7 +280,7 @@ void Foam::codedBase::createLibrary void Foam::codedBase::updateLibrary ( - const word& redirectType + const word& name ) const { const dictionary& dict = this->codeDict(); @@ -293,12 +293,12 @@ void Foam::codedBase::updateLibrary dynamicCodeContext context(dict); - // codeName: redirectType + _ - // codeDir : redirectType + // codeName: name + _ + // codeDir : name dynamicCode dynCode ( - redirectType + context.sha1().str(true), - redirectType + name + context.sha1().str(true), + name ); const fileName libPath = dynCode.libPath(); diff --git a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H index 8ac7114ce6..0c18c05756 100644 --- a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H +++ b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -94,7 +94,7 @@ protected: //- Update library as required void updateLibrary ( - const word& redirectType + const word& name ) const; //- Get the loaded dynamic libraries diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C index 52ab53336d..cbb31724ea 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C @@ -107,8 +107,8 @@ void Foam::codedFixedValuePointPatchField::prepare const dynamicCodeContext& context ) const { - // take no chances - typeName must be identical to redirectType_ - dynCode.setFilterVariable("typeName", redirectType_); + // take no chances - typeName must be identical to name_ + dynCode.setFilterVariable("typeName", name_); // set TemplateType and FieldType filter variables // (for pointPatchField) @@ -123,7 +123,7 @@ void Foam::codedFixedValuePointPatchField::prepare // debugging: make BC verbose // dynCode.setFilterVariable("verbose", "true"); - // Info<<"compile " << redirectType_ << " sha1: " + // Info<<"compile " << name_ << " sha1: " // << context.sha1() << endl; // define Make/options @@ -149,7 +149,7 @@ const ( dict_.found("code") ? dict_ - : this->dict().subDict(redirectType_) + : this->dict().subDict(name_) ); } @@ -200,7 +200,7 @@ Foam::codedFixedValuePointPatchField::codedFixedValuePointPatchField fixedValuePointPatchField(ptf, p, iF, mapper), codedBase(), dict_(ptf.dict_), - redirectType_(ptf.redirectType_), + name_(ptf.name_), redirectPatchFieldPtr_() {} @@ -217,10 +217,15 @@ Foam::codedFixedValuePointPatchField::codedFixedValuePointPatchField fixedValuePointPatchField(p, iF, dict, valueRequired), codedBase(), dict_(dict), - redirectType_(dict.lookup("redirectType")), + name_ + ( + dict.found("redirectType") + ? dict.lookup("redirectType") + : dict.lookup("name") + ), redirectPatchFieldPtr_() { - updateLibrary(redirectType_); + updateLibrary(name_); } @@ -233,7 +238,7 @@ Foam::codedFixedValuePointPatchField::codedFixedValuePointPatchField fixedValuePointPatchField(ptf), codedBase(), dict_(ptf.dict_), - redirectType_(ptf.redirectType_), + name_(ptf.name_), redirectPatchFieldPtr_() {} @@ -248,7 +253,7 @@ Foam::codedFixedValuePointPatchField::codedFixedValuePointPatchField fixedValuePointPatchField(ptf, iF), codedBase(), dict_(ptf.dict_), - redirectType_(ptf.redirectType_), + name_(ptf.name_), redirectPatchFieldPtr_() {} @@ -265,7 +270,7 @@ Foam::codedFixedValuePointPatchField::redirectPatchField() const // Make sure to construct the patchfield with up-to-date value OStringStream os; - os.writeKeyword("type") << redirectType_ << token::END_STATEMENT + os.writeKeyword("type") << name_ << token::END_STATEMENT << nl; static_cast&>(*this).writeEntry("value", os); IStringStream is(os.str()); @@ -294,7 +299,7 @@ void Foam::codedFixedValuePointPatchField::updateCoeffs() } // Make sure library containing user-defined pointPatchField is up-to-date - updateLibrary(redirectType_); + updateLibrary(name_); const pointPatchField& fvp = redirectPatchField(); @@ -314,7 +319,7 @@ void Foam::codedFixedValuePointPatchField::evaluate ) { // Make sure library containing user-defined pointPatchField is up-to-date - updateLibrary(redirectType_); + updateLibrary(name_); const pointPatchField& fvp = redirectPatchField(); @@ -328,7 +333,7 @@ template void Foam::codedFixedValuePointPatchField::write(Ostream& os) const { fixedValuePointPatchField::write(os); - os.writeKeyword("redirectType") << redirectType_ + os.writeKeyword("name") << name_ << token::END_STATEMENT << nl; if (dict_.found("codeInclude")) diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H index 36ff3fdf95..5349af3ab5 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H @@ -34,7 +34,7 @@ Description { type codedFixedValue; value uniform 0; - redirectType rampedFixedValue; // name of generated bc + name rampedFixedValue; // name of generated bc code #{ @@ -110,7 +110,7 @@ class codedFixedValuePointPatchField //- Dictionary contents for the boundary condition mutable dictionary dict_; - const word redirectType_; + const word name_; mutable autoPtr> redirectPatchFieldPtr_; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C index 43c3cebcbb..6cb0865017 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C @@ -106,8 +106,8 @@ void Foam::codedFixedValueFvPatchField::prepare const dynamicCodeContext& context ) const { - // take no chances - typeName must be identical to redirectType_ - dynCode.setFilterVariable("typeName", redirectType_); + // take no chances - typeName must be identical to name_ + dynCode.setFilterVariable("typeName", name_); // set TemplateType and FieldType filter variables // (for fvPatchField) @@ -122,7 +122,7 @@ void Foam::codedFixedValueFvPatchField::prepare // debugging: make BC verbose // dynCode.setFilterVariable("verbose", "true"); - // Info<<"compile " << redirectType_ << " sha1: " + // Info<<"compile " << name_ << " sha1: " // << context.sha1() << endl; // define Make/options @@ -148,7 +148,7 @@ const ( dict_.found("code") ? dict_ - : this->dict().subDict(redirectType_) + : this->dict().subDict(name_) ); } @@ -199,7 +199,7 @@ Foam::codedFixedValueFvPatchField::codedFixedValueFvPatchField fixedValueFvPatchField(ptf, p, iF, mapper), codedBase(), dict_(ptf.dict_), - redirectType_(ptf.redirectType_), + name_(ptf.name_), redirectPatchFieldPtr_() {} @@ -215,10 +215,15 @@ Foam::codedFixedValueFvPatchField::codedFixedValueFvPatchField fixedValueFvPatchField(p, iF, dict), codedBase(), dict_(dict), - redirectType_(dict.lookup("redirectType")), + name_ + ( + dict.found("redirectType") + ? dict.lookup("redirectType") + : dict.lookup("name") + ), redirectPatchFieldPtr_() { - updateLibrary(redirectType_); + updateLibrary(name_); } @@ -231,7 +236,7 @@ Foam::codedFixedValueFvPatchField::codedFixedValueFvPatchField fixedValueFvPatchField(ptf), codedBase(), dict_(ptf.dict_), - redirectType_(ptf.redirectType_), + name_(ptf.name_), redirectPatchFieldPtr_() {} @@ -246,7 +251,7 @@ Foam::codedFixedValueFvPatchField::codedFixedValueFvPatchField fixedValueFvPatchField(ptf, iF), codedBase(), dict_(ptf.dict_), - redirectType_(ptf.redirectType_), + name_(ptf.name_), redirectPatchFieldPtr_() {} @@ -263,7 +268,7 @@ Foam::codedFixedValueFvPatchField::redirectPatchField() const // Make sure to construct the patchfield with up-to-date value OStringStream os; - os.writeKeyword("type") << redirectType_ << token::END_STATEMENT + os.writeKeyword("type") << name_ << token::END_STATEMENT << nl; static_cast&>(*this).writeEntry("value", os); IStringStream is(os.str()); @@ -292,7 +297,7 @@ void Foam::codedFixedValueFvPatchField::updateCoeffs() } // Make sure library containing user-defined fvPatchField is up-to-date - updateLibrary(redirectType_); + updateLibrary(name_); const fvPatchField& fvp = redirectPatchField(); @@ -312,7 +317,7 @@ void Foam::codedFixedValueFvPatchField::evaluate ) { // Make sure library containing user-defined fvPatchField is up-to-date - updateLibrary(redirectType_); + updateLibrary(name_); const fvPatchField& fvp = redirectPatchField(); @@ -326,7 +331,7 @@ template void Foam::codedFixedValueFvPatchField::write(Ostream& os) const { fixedValueFvPatchField::write(os); - os.writeKeyword("redirectType") << redirectType_ + os.writeKeyword("name") << name_ << token::END_STATEMENT << nl; if (dict_.found("codeInclude")) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H index 60e58bb399..c3c95eca4c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H @@ -39,7 +39,7 @@ Description { type codedFixedValue; value uniform 0; - redirectType rampedFixedValue; // name of generated BC + name rampedFixedValue; // name of generated BC code #{ @@ -112,7 +112,7 @@ class codedFixedValueFvPatchField //- Dictionary contents for the boundary condition const dictionary dict_; - const word redirectType_; + const word name_; mutable autoPtr> redirectPatchFieldPtr_; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C index dc0a2e1e2a..27cdf08c0e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C @@ -106,8 +106,8 @@ void Foam::codedMixedFvPatchField::prepare const dynamicCodeContext& context ) const { - // take no chances - typeName must be identical to redirectType_ - dynCode.setFilterVariable("typeName", redirectType_); + // take no chances - typeName must be identical to name_ + dynCode.setFilterVariable("typeName", name_); // set TemplateType and FieldType filter variables // (for fvPatchField) @@ -122,7 +122,7 @@ void Foam::codedMixedFvPatchField::prepare // debugging: make BC verbose // dynCode.setFilterVariable("verbose", "true"); - // Info<<"compile " << redirectType_ << " sha1: " + // Info<<"compile " << name_ << " sha1: " // << context.sha1() << endl; // define Make/options @@ -148,7 +148,7 @@ const ( dict_.found("code") ? dict_ - : this->dict().subDict(redirectType_) + : this->dict().subDict(name_) ); } @@ -199,7 +199,7 @@ Foam::codedMixedFvPatchField::codedMixedFvPatchField mixedFvPatchField(ptf, p, iF, mapper), codedBase(), dict_(ptf.dict_), - redirectType_(ptf.redirectType_), + name_(ptf.name_), redirectPatchFieldPtr_() {} @@ -215,10 +215,15 @@ Foam::codedMixedFvPatchField::codedMixedFvPatchField mixedFvPatchField(p, iF, dict), codedBase(), dict_(dict), - redirectType_(dict.lookup("redirectType")), + name_ + ( + dict.found("redirectType") + ? dict.lookup("redirectType") + : dict.lookup("name") + ), redirectPatchFieldPtr_() { - updateLibrary(redirectType_); + updateLibrary(name_); } @@ -231,7 +236,7 @@ Foam::codedMixedFvPatchField::codedMixedFvPatchField mixedFvPatchField(ptf), codedBase(), dict_(ptf.dict_), - redirectType_(ptf.redirectType_), + name_(ptf.name_), redirectPatchFieldPtr_() {} @@ -246,7 +251,7 @@ Foam::codedMixedFvPatchField::codedMixedFvPatchField mixedFvPatchField(ptf, iF), codedBase(), dict_(ptf.dict_), - redirectType_(ptf.redirectType_), + name_(ptf.name_), redirectPatchFieldPtr_() {} @@ -271,7 +276,7 @@ Foam::codedMixedFvPatchField::redirectPatchField() const // Override the type to enforce the fvPatchField::New constructor // to choose our type - dict.set("type", redirectType_); + dict.set("type", name_); redirectPatchFieldPtr_.set ( @@ -299,7 +304,7 @@ void Foam::codedMixedFvPatchField::updateCoeffs() } // Make sure library containing user-defined fvPatchField is up-to-date - updateLibrary(redirectType_); + updateLibrary(name_); const mixedFvPatchField& fvp = redirectPatchField(); @@ -321,7 +326,7 @@ void Foam::codedMixedFvPatchField::evaluate ) { // Make sure library containing user-defined fvPatchField is up-to-date - updateLibrary(redirectType_); + updateLibrary(name_); const mixedFvPatchField& fvp = redirectPatchField(); @@ -338,7 +343,7 @@ template void Foam::codedMixedFvPatchField::write(Ostream& os) const { mixedFvPatchField::write(os); - os.writeKeyword("redirectType") << redirectType_ + os.writeKeyword("name") << name_ << token::END_STATEMENT << nl; if (dict_.found("codeInclude")) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H index 9d6cf1ae72..19f5a589a5 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H @@ -43,7 +43,7 @@ Description refGradient uniform (0 0 0); valueFraction uniform 1; - redirectType rampedMixed; // name of generated BC + name rampedMixed; // name of generated BC code #{ @@ -122,7 +122,7 @@ class codedMixedFvPatchField //- Dictionary contents for the boundary condition mutable dictionary dict_; - const word redirectType_; + const word name_; mutable autoPtr> redirectPatchFieldPtr_; @@ -236,7 +236,7 @@ public: virtual void updateCoeffs(); //- Evaluate the patch field - // This is only needed to set the updated() flag of the redirectType + // This is only needed to set the updated() flag of the name // to false. virtual void evaluate ( diff --git a/src/fvOptions/sources/general/codedSource/CodedSource.C b/src/fvOptions/sources/general/codedSource/CodedSource.C index b605061495..3933d87f8d 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSource.C +++ b/src/fvOptions/sources/general/codedSource/CodedSource.C @@ -41,7 +41,7 @@ void Foam::fv::CodedSource::prepare word sourceType(pTraits::typeName); // Set additional rewrite rules - dynCode.setFilterVariable("typeName", redirectType_); + dynCode.setFilterVariable("typeName", name_); dynCode.setFilterVariable("TemplateType", sourceType); dynCode.setFilterVariable("SourceType", sourceType + "Source"); @@ -58,7 +58,7 @@ void Foam::fv::CodedSource::prepare // debugging: make BC verbose // dynCode.setFilterVariable("verbose", "true"); - // Info<<"compile " << redirectType_ << " sha1: " + // Info<<"compile " << name_ << " sha1: " // << context.sha1() << endl; // define Make/options @@ -132,11 +132,11 @@ Foam::fv::option& Foam::fv::CodedSource::redirectFvOption() const if (!redirectFvOptionPtr_.valid()) { dictionary constructDict(dict_); - constructDict.set("type", redirectType_); + constructDict.set("type", name_); redirectFvOptionPtr_ = option::New ( - redirectType_, + name_, constructDict, mesh_ ); @@ -157,7 +157,7 @@ void Foam::fv::CodedSource::correct << ">::correct for source " << name_ << endl; } - updateLibrary(redirectType_); + updateLibrary(name_); redirectFvOption().correct(field); } @@ -175,7 +175,7 @@ void Foam::fv::CodedSource::addSup << ">::addSup for source " << name_ << endl; } - updateLibrary(redirectType_); + updateLibrary(name_); redirectFvOption().addSup(eqn, fieldi); } @@ -194,7 +194,7 @@ void Foam::fv::CodedSource::addSup << ">::addSup for source " << name_ << endl; } - updateLibrary(redirectType_); + updateLibrary(name_); redirectFvOption().addSup(rho, eqn, fieldi); } @@ -212,7 +212,7 @@ void Foam::fv::CodedSource::constrain << ">::constrain for source " << name_ << endl; } - updateLibrary(redirectType_); + updateLibrary(name_); redirectFvOption().constrain(eqn, fieldi); } diff --git a/src/fvOptions/sources/general/codedSource/CodedSource.H b/src/fvOptions/sources/general/codedSource/CodedSource.H index ef2b130f62..e5dd819464 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSource.H +++ b/src/fvOptions/sources/general/codedSource/CodedSource.H @@ -65,7 +65,7 @@ Description selectionMode all; fieldNames (h); - redirectType sourceTime; + name sourceTime; codeInclude #{ @@ -141,7 +141,7 @@ protected: // Protected data - word redirectType_; + word name_; string codeCorrect_; string codeAddSup_; diff --git a/src/fvOptions/sources/general/codedSource/CodedSourceIO.C b/src/fvOptions/sources/general/codedSource/CodedSourceIO.C index b605302b96..9c6514f435 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSourceIO.C +++ b/src/fvOptions/sources/general/codedSource/CodedSourceIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,16 @@ bool Foam::fv::CodedSource::read(const dictionary& dict) { coeffs_.lookup("fieldNames") >> fieldNames_; applied_.setSize(fieldNames_.size(), false); - coeffs_.lookup("redirectType") >> redirectType_; + + // Backward compatibility + if (dict.found("redirectType")) + { + dict.lookup("redirectType") >> name_; + } + else + { + dict.lookup("name") >> name_; + } // Code snippets { diff --git a/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C b/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C index 8eb568a95c..1c9e5ada63 100644 --- a/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C +++ b/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C @@ -56,7 +56,7 @@ void Foam::codedFunctionObject::prepare ) const { // Set additional rewrite rules - dynCode.setFilterVariable("typeName", redirectType_); + dynCode.setFilterVariable("typeName", name_); dynCode.setFilterVariable("codeData", codeData_); dynCode.setFilterVariable("codeRead", codeRead_); dynCode.setFilterVariable("codeExecute", codeExecute_); @@ -71,7 +71,7 @@ void Foam::codedFunctionObject::prepare // Debugging: make BC verbose // dynCode.setFilterVariable("verbose", "true"); - // Info<<"compile " << redirectType_ << " sha1: " + // Info<<"compile " << name_ << " sha1: " // << context.sha1() << endl; // Define Make/options @@ -130,7 +130,7 @@ Foam::codedFunctionObject::codedFunctionObject { read(dict_); - updateLibrary(redirectType_); + updateLibrary(name_); redirectFunctionObject(); } @@ -148,11 +148,11 @@ Foam::functionObject& Foam::codedFunctionObject::redirectFunctionObject() const if (!redirectFunctionObjectPtr_.valid()) { dictionary constructDict(dict_); - constructDict.set("type", redirectType_); + constructDict.set("type", name_); redirectFunctionObjectPtr_ = functionObject::New ( - redirectType_, + name_, time_, constructDict ); @@ -163,28 +163,36 @@ Foam::functionObject& Foam::codedFunctionObject::redirectFunctionObject() const bool Foam::codedFunctionObject::execute(const bool postProcess) { - updateLibrary(redirectType_); + updateLibrary(name_); return redirectFunctionObject().execute(postProcess); } bool Foam::codedFunctionObject::write(const bool postProcess) { - updateLibrary(redirectType_); + updateLibrary(name_); return redirectFunctionObject().write(postProcess); } bool Foam::codedFunctionObject::end() { - updateLibrary(redirectType_); + updateLibrary(name_); return redirectFunctionObject().end(); } bool Foam::codedFunctionObject::read(const dictionary& dict) { - dict.lookup("redirectType") >> redirectType_; + // Backward compatibility + if (dict.found("redirectType")) + { + dict.lookup("redirectType") >> name_; + } + else + { + dict.lookup("name") >> name_; + } const entry* dataPtr = dict.lookupEntryPtr ( @@ -276,7 +284,7 @@ bool Foam::codedFunctionObject::read(const dictionary& dict) ); } - updateLibrary(redirectType_); + updateLibrary(name_); return redirectFunctionObject().read(dict); } diff --git a/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H b/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H index 3e0377dcdf..2b9cad4f78 100644 --- a/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H +++ b/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H @@ -51,7 +51,7 @@ Description type coded; // Name of on-the-fly generated functionObject - redirectType writeMagU; + name writeMagU; code #{ // Lookup U @@ -102,7 +102,7 @@ protected: //- Input dictionary dictionary dict_; - word redirectType_; + word name_; string codeData_; string codeRead_; diff --git a/tutorials/basic/potentialFoam/cylinder/system/controlDict b/tutorials/basic/potentialFoam/cylinder/system/controlDict index 88dbc9a997..e333169a9b 100644 --- a/tutorials/basic/potentialFoam/cylinder/system/controlDict +++ b/tutorials/basic/potentialFoam/cylinder/system/controlDict @@ -47,7 +47,7 @@ runTimeModifiable true; functions { - difference + error { // Load the library containing the 'coded' functionObject libs ("libutilityFunctionObjects.so"); @@ -55,7 +55,7 @@ functions type coded; // Name of on-the-fly generated functionObject - redirectType error; + name error; codeEnd #{ @@ -63,7 +63,7 @@ functions Info<< "Looking up field U\n" << endl; const volVectorField& U = mesh().lookupObject("U"); - Info<< "Reading inlet velocity uInfX\n" << endl; + Info<< "Reading inlet velocity uInfX\n" << endl; scalar ULeft = 0.0; label leftI = mesh().boundaryMesh().findPatchID("left"); diff --git a/tutorials/combustion/engineFoam/kivaTest/system/controlDict b/tutorials/combustion/engineFoam/kivaTest/system/controlDict index 485cc686bd..700c6f6abe 100644 --- a/tutorials/combustion/engineFoam/kivaTest/system/controlDict +++ b/tutorials/combustion/engineFoam/kivaTest/system/controlDict @@ -57,7 +57,7 @@ functions { type coded; libs ("libutilityFunctionObjects.so"); - redirectType setDeltaT; + name setDeltaT; code #{ diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/0.orig/U b/tutorials/incompressible/simpleFoam/pipeCyclic/0.orig/U index dbc94abc5e..ea884a3ac7 100644 --- a/tutorials/incompressible/simpleFoam/pipeCyclic/0.orig/U +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/0.orig/U @@ -26,7 +26,7 @@ boundaryField inlet { type codedFixedValue; - redirectType swirl; + name swirl; code #{ diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/bubbleColumnEvaporating/system/continuityFunctions b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/bubbleColumnEvaporating/system/continuityFunctions index bb04d87da1..fa05777fbb 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/bubbleColumnEvaporating/system/continuityFunctions +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/bubbleColumnEvaporating/system/continuityFunctions @@ -56,7 +56,7 @@ totalMass { type coded; libs ("libutilityFunctionObjects.so"); - redirectType error; + name error; code #{