mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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.
This commit is contained in:
@ -56,7 +56,7 @@ Description
|
||||
scalarCodedSourceCoeffs
|
||||
{
|
||||
fieldNames (h);
|
||||
redirectType sourceTime;
|
||||
name sourceTime;
|
||||
|
||||
codeInclude
|
||||
#{
|
||||
|
||||
@ -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 + _<sha1>
|
||||
// codeDir : redirectType
|
||||
// codeName: name + _<sha1>
|
||||
// codeDir : name
|
||||
dynamicCode dynCode
|
||||
(
|
||||
redirectType + context.sha1().str(true),
|
||||
redirectType
|
||||
name + context.sha1().str(true),
|
||||
name
|
||||
);
|
||||
const fileName libPath = dynCode.libPath();
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -107,8 +107,8 @@ void Foam::codedFixedValuePointPatchField<Type>::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<Type>::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<Type>::codedFixedValuePointPatchField
|
||||
fixedValuePointPatchField<Type>(ptf, p, iF, mapper),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
redirectType_(ptf.redirectType_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
{}
|
||||
|
||||
@ -217,10 +217,15 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
||||
fixedValuePointPatchField<Type>(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<Type>::codedFixedValuePointPatchField
|
||||
fixedValuePointPatchField<Type>(ptf),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
redirectType_(ptf.redirectType_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
{}
|
||||
|
||||
@ -248,7 +253,7 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
||||
fixedValuePointPatchField<Type>(ptf, iF),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
redirectType_(ptf.redirectType_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
{}
|
||||
|
||||
@ -265,7 +270,7 @@ Foam::codedFixedValuePointPatchField<Type>::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<const Field<Type>&>(*this).writeEntry("value", os);
|
||||
IStringStream is(os.str());
|
||||
@ -294,7 +299,7 @@ void Foam::codedFixedValuePointPatchField<Type>::updateCoeffs()
|
||||
}
|
||||
|
||||
// Make sure library containing user-defined pointPatchField is up-to-date
|
||||
updateLibrary(redirectType_);
|
||||
updateLibrary(name_);
|
||||
|
||||
const pointPatchField<Type>& fvp = redirectPatchField();
|
||||
|
||||
@ -314,7 +319,7 @@ void Foam::codedFixedValuePointPatchField<Type>::evaluate
|
||||
)
|
||||
{
|
||||
// Make sure library containing user-defined pointPatchField is up-to-date
|
||||
updateLibrary(redirectType_);
|
||||
updateLibrary(name_);
|
||||
|
||||
const pointPatchField<Type>& fvp = redirectPatchField();
|
||||
|
||||
@ -328,7 +333,7 @@ template<class Type>
|
||||
void Foam::codedFixedValuePointPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
fixedValuePointPatchField<Type>::write(os);
|
||||
os.writeKeyword("redirectType") << redirectType_
|
||||
os.writeKeyword("name") << name_
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
if (dict_.found("codeInclude"))
|
||||
|
||||
@ -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<pointPatchField<Type>> redirectPatchFieldPtr_;
|
||||
|
||||
|
||||
@ -106,8 +106,8 @@ void Foam::codedFixedValueFvPatchField<Type>::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<Type>::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<Type>::codedFixedValueFvPatchField
|
||||
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
redirectType_(ptf.redirectType_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
{}
|
||||
|
||||
@ -215,10 +215,15 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
||||
fixedValueFvPatchField<Type>(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<Type>::codedFixedValueFvPatchField
|
||||
fixedValueFvPatchField<Type>(ptf),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
redirectType_(ptf.redirectType_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
{}
|
||||
|
||||
@ -246,7 +251,7 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
||||
fixedValueFvPatchField<Type>(ptf, iF),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
redirectType_(ptf.redirectType_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
{}
|
||||
|
||||
@ -263,7 +268,7 @@ Foam::codedFixedValueFvPatchField<Type>::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<const Field<Type>&>(*this).writeEntry("value", os);
|
||||
IStringStream is(os.str());
|
||||
@ -292,7 +297,7 @@ void Foam::codedFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
}
|
||||
|
||||
// Make sure library containing user-defined fvPatchField is up-to-date
|
||||
updateLibrary(redirectType_);
|
||||
updateLibrary(name_);
|
||||
|
||||
const fvPatchField<Type>& fvp = redirectPatchField();
|
||||
|
||||
@ -312,7 +317,7 @@ void Foam::codedFixedValueFvPatchField<Type>::evaluate
|
||||
)
|
||||
{
|
||||
// Make sure library containing user-defined fvPatchField is up-to-date
|
||||
updateLibrary(redirectType_);
|
||||
updateLibrary(name_);
|
||||
|
||||
const fvPatchField<Type>& fvp = redirectPatchField();
|
||||
|
||||
@ -326,7 +331,7 @@ template<class Type>
|
||||
void Foam::codedFixedValueFvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
fixedValueFvPatchField<Type>::write(os);
|
||||
os.writeKeyword("redirectType") << redirectType_
|
||||
os.writeKeyword("name") << name_
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
if (dict_.found("codeInclude"))
|
||||
|
||||
@ -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<fvPatchField<Type>> redirectPatchFieldPtr_;
|
||||
|
||||
|
||||
@ -106,8 +106,8 @@ void Foam::codedMixedFvPatchField<Type>::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<Type>::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<Type>::codedMixedFvPatchField
|
||||
mixedFvPatchField<Type>(ptf, p, iF, mapper),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
redirectType_(ptf.redirectType_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
{}
|
||||
|
||||
@ -215,10 +215,15 @@ Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
||||
mixedFvPatchField<Type>(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<Type>::codedMixedFvPatchField
|
||||
mixedFvPatchField<Type>(ptf),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
redirectType_(ptf.redirectType_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
{}
|
||||
|
||||
@ -246,7 +251,7 @@ Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
||||
mixedFvPatchField<Type>(ptf, iF),
|
||||
codedBase(),
|
||||
dict_(ptf.dict_),
|
||||
redirectType_(ptf.redirectType_),
|
||||
name_(ptf.name_),
|
||||
redirectPatchFieldPtr_()
|
||||
{}
|
||||
|
||||
@ -271,7 +276,7 @@ Foam::codedMixedFvPatchField<Type>::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<Type>::updateCoeffs()
|
||||
}
|
||||
|
||||
// Make sure library containing user-defined fvPatchField is up-to-date
|
||||
updateLibrary(redirectType_);
|
||||
updateLibrary(name_);
|
||||
|
||||
const mixedFvPatchField<Type>& fvp = redirectPatchField();
|
||||
|
||||
@ -321,7 +326,7 @@ void Foam::codedMixedFvPatchField<Type>::evaluate
|
||||
)
|
||||
{
|
||||
// Make sure library containing user-defined fvPatchField is up-to-date
|
||||
updateLibrary(redirectType_);
|
||||
updateLibrary(name_);
|
||||
|
||||
const mixedFvPatchField<Type>& fvp = redirectPatchField();
|
||||
|
||||
@ -338,7 +343,7 @@ template<class Type>
|
||||
void Foam::codedMixedFvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
mixedFvPatchField<Type>::write(os);
|
||||
os.writeKeyword("redirectType") << redirectType_
|
||||
os.writeKeyword("name") << name_
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
if (dict_.found("codeInclude"))
|
||||
|
||||
@ -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<mixedFvPatchField<Type>> 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
|
||||
(
|
||||
|
||||
@ -41,7 +41,7 @@ void Foam::fv::CodedSource<Type>::prepare
|
||||
word sourceType(pTraits<Type>::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<Type>::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<Type>::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<Type>::correct
|
||||
<< ">::correct for source " << name_ << endl;
|
||||
}
|
||||
|
||||
updateLibrary(redirectType_);
|
||||
updateLibrary(name_);
|
||||
redirectFvOption().correct(field);
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ void Foam::fv::CodedSource<Type>::addSup
|
||||
<< ">::addSup for source " << name_ << endl;
|
||||
}
|
||||
|
||||
updateLibrary(redirectType_);
|
||||
updateLibrary(name_);
|
||||
redirectFvOption().addSup(eqn, fieldi);
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ void Foam::fv::CodedSource<Type>::addSup
|
||||
<< ">::addSup for source " << name_ << endl;
|
||||
}
|
||||
|
||||
updateLibrary(redirectType_);
|
||||
updateLibrary(name_);
|
||||
redirectFvOption().addSup(rho, eqn, fieldi);
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ void Foam::fv::CodedSource<Type>::constrain
|
||||
<< ">::constrain for source " << name_ << endl;
|
||||
}
|
||||
|
||||
updateLibrary(redirectType_);
|
||||
updateLibrary(name_);
|
||||
redirectFvOption().constrain(eqn, fieldi);
|
||||
}
|
||||
|
||||
|
||||
@ -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_;
|
||||
|
||||
@ -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<Type>::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
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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_;
|
||||
|
||||
@ -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<volVectorField>("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");
|
||||
|
||||
@ -57,7 +57,7 @@ functions
|
||||
{
|
||||
type coded;
|
||||
libs ("libutilityFunctionObjects.so");
|
||||
redirectType setDeltaT;
|
||||
name setDeltaT;
|
||||
|
||||
code
|
||||
#{
|
||||
|
||||
@ -26,7 +26,7 @@ boundaryField
|
||||
inlet
|
||||
{
|
||||
type codedFixedValue;
|
||||
redirectType swirl;
|
||||
name swirl;
|
||||
|
||||
code
|
||||
#{
|
||||
|
||||
@ -56,7 +56,7 @@ totalMass
|
||||
{
|
||||
type coded;
|
||||
libs ("libutilityFunctionObjects.so");
|
||||
redirectType error;
|
||||
name error;
|
||||
|
||||
code
|
||||
#{
|
||||
|
||||
Reference in New Issue
Block a user