mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +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
|
scalarCodedSourceCoeffs
|
||||||
{
|
{
|
||||||
fieldNames (h);
|
fieldNames (h);
|
||||||
redirectType sourceTime;
|
name sourceTime;
|
||||||
|
|
||||||
codeInclude
|
codeInclude
|
||||||
#{
|
#{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -280,7 +280,7 @@ void Foam::codedBase::createLibrary
|
|||||||
|
|
||||||
void Foam::codedBase::updateLibrary
|
void Foam::codedBase::updateLibrary
|
||||||
(
|
(
|
||||||
const word& redirectType
|
const word& name
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const dictionary& dict = this->codeDict();
|
const dictionary& dict = this->codeDict();
|
||||||
@ -293,12 +293,12 @@ void Foam::codedBase::updateLibrary
|
|||||||
|
|
||||||
dynamicCodeContext context(dict);
|
dynamicCodeContext context(dict);
|
||||||
|
|
||||||
// codeName: redirectType + _<sha1>
|
// codeName: name + _<sha1>
|
||||||
// codeDir : redirectType
|
// codeDir : name
|
||||||
dynamicCode dynCode
|
dynamicCode dynCode
|
||||||
(
|
(
|
||||||
redirectType + context.sha1().str(true),
|
name + context.sha1().str(true),
|
||||||
redirectType
|
name
|
||||||
);
|
);
|
||||||
const fileName libPath = dynCode.libPath();
|
const fileName libPath = dynCode.libPath();
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -94,7 +94,7 @@ protected:
|
|||||||
//- Update library as required
|
//- Update library as required
|
||||||
void updateLibrary
|
void updateLibrary
|
||||||
(
|
(
|
||||||
const word& redirectType
|
const word& name
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Get the loaded dynamic libraries
|
//- Get the loaded dynamic libraries
|
||||||
|
|||||||
@ -107,8 +107,8 @@ void Foam::codedFixedValuePointPatchField<Type>::prepare
|
|||||||
const dynamicCodeContext& context
|
const dynamicCodeContext& context
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// take no chances - typeName must be identical to redirectType_
|
// take no chances - typeName must be identical to name_
|
||||||
dynCode.setFilterVariable("typeName", redirectType_);
|
dynCode.setFilterVariable("typeName", name_);
|
||||||
|
|
||||||
// set TemplateType and FieldType filter variables
|
// set TemplateType and FieldType filter variables
|
||||||
// (for pointPatchField)
|
// (for pointPatchField)
|
||||||
@ -123,7 +123,7 @@ void Foam::codedFixedValuePointPatchField<Type>::prepare
|
|||||||
|
|
||||||
// debugging: make BC verbose
|
// debugging: make BC verbose
|
||||||
// dynCode.setFilterVariable("verbose", "true");
|
// dynCode.setFilterVariable("verbose", "true");
|
||||||
// Info<<"compile " << redirectType_ << " sha1: "
|
// Info<<"compile " << name_ << " sha1: "
|
||||||
// << context.sha1() << endl;
|
// << context.sha1() << endl;
|
||||||
|
|
||||||
// define Make/options
|
// define Make/options
|
||||||
@ -149,7 +149,7 @@ const
|
|||||||
(
|
(
|
||||||
dict_.found("code")
|
dict_.found("code")
|
||||||
? dict_
|
? dict_
|
||||||
: this->dict().subDict(redirectType_)
|
: this->dict().subDict(name_)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
|||||||
fixedValuePointPatchField<Type>(ptf, p, iF, mapper),
|
fixedValuePointPatchField<Type>(ptf, p, iF, mapper),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(ptf.dict_),
|
dict_(ptf.dict_),
|
||||||
redirectType_(ptf.redirectType_),
|
name_(ptf.name_),
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -217,10 +217,15 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
|||||||
fixedValuePointPatchField<Type>(p, iF, dict, valueRequired),
|
fixedValuePointPatchField<Type>(p, iF, dict, valueRequired),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(dict),
|
dict_(dict),
|
||||||
redirectType_(dict.lookup("redirectType")),
|
name_
|
||||||
|
(
|
||||||
|
dict.found("redirectType")
|
||||||
|
? dict.lookup("redirectType")
|
||||||
|
: dict.lookup("name")
|
||||||
|
),
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{
|
{
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -233,7 +238,7 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
|||||||
fixedValuePointPatchField<Type>(ptf),
|
fixedValuePointPatchField<Type>(ptf),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(ptf.dict_),
|
dict_(ptf.dict_),
|
||||||
redirectType_(ptf.redirectType_),
|
name_(ptf.name_),
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -248,7 +253,7 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
|||||||
fixedValuePointPatchField<Type>(ptf, iF),
|
fixedValuePointPatchField<Type>(ptf, iF),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(ptf.dict_),
|
dict_(ptf.dict_),
|
||||||
redirectType_(ptf.redirectType_),
|
name_(ptf.name_),
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -265,7 +270,7 @@ Foam::codedFixedValuePointPatchField<Type>::redirectPatchField() const
|
|||||||
// Make sure to construct the patchfield with up-to-date value
|
// Make sure to construct the patchfield with up-to-date value
|
||||||
|
|
||||||
OStringStream os;
|
OStringStream os;
|
||||||
os.writeKeyword("type") << redirectType_ << token::END_STATEMENT
|
os.writeKeyword("type") << name_ << token::END_STATEMENT
|
||||||
<< nl;
|
<< nl;
|
||||||
static_cast<const Field<Type>&>(*this).writeEntry("value", os);
|
static_cast<const Field<Type>&>(*this).writeEntry("value", os);
|
||||||
IStringStream is(os.str());
|
IStringStream is(os.str());
|
||||||
@ -294,7 +299,7 @@ void Foam::codedFixedValuePointPatchField<Type>::updateCoeffs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure library containing user-defined pointPatchField is up-to-date
|
// Make sure library containing user-defined pointPatchField is up-to-date
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
|
|
||||||
const pointPatchField<Type>& fvp = redirectPatchField();
|
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
|
// Make sure library containing user-defined pointPatchField is up-to-date
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
|
|
||||||
const pointPatchField<Type>& fvp = redirectPatchField();
|
const pointPatchField<Type>& fvp = redirectPatchField();
|
||||||
|
|
||||||
@ -328,7 +333,7 @@ template<class Type>
|
|||||||
void Foam::codedFixedValuePointPatchField<Type>::write(Ostream& os) const
|
void Foam::codedFixedValuePointPatchField<Type>::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
fixedValuePointPatchField<Type>::write(os);
|
fixedValuePointPatchField<Type>::write(os);
|
||||||
os.writeKeyword("redirectType") << redirectType_
|
os.writeKeyword("name") << name_
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
|
|
||||||
if (dict_.found("codeInclude"))
|
if (dict_.found("codeInclude"))
|
||||||
|
|||||||
@ -34,7 +34,7 @@ Description
|
|||||||
{
|
{
|
||||||
type codedFixedValue;
|
type codedFixedValue;
|
||||||
value uniform 0;
|
value uniform 0;
|
||||||
redirectType rampedFixedValue; // name of generated bc
|
name rampedFixedValue; // name of generated bc
|
||||||
|
|
||||||
code
|
code
|
||||||
#{
|
#{
|
||||||
@ -110,7 +110,7 @@ class codedFixedValuePointPatchField
|
|||||||
//- Dictionary contents for the boundary condition
|
//- Dictionary contents for the boundary condition
|
||||||
mutable dictionary dict_;
|
mutable dictionary dict_;
|
||||||
|
|
||||||
const word redirectType_;
|
const word name_;
|
||||||
|
|
||||||
mutable autoPtr<pointPatchField<Type>> redirectPatchFieldPtr_;
|
mutable autoPtr<pointPatchField<Type>> redirectPatchFieldPtr_;
|
||||||
|
|
||||||
|
|||||||
@ -106,8 +106,8 @@ void Foam::codedFixedValueFvPatchField<Type>::prepare
|
|||||||
const dynamicCodeContext& context
|
const dynamicCodeContext& context
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// take no chances - typeName must be identical to redirectType_
|
// take no chances - typeName must be identical to name_
|
||||||
dynCode.setFilterVariable("typeName", redirectType_);
|
dynCode.setFilterVariable("typeName", name_);
|
||||||
|
|
||||||
// set TemplateType and FieldType filter variables
|
// set TemplateType and FieldType filter variables
|
||||||
// (for fvPatchField)
|
// (for fvPatchField)
|
||||||
@ -122,7 +122,7 @@ void Foam::codedFixedValueFvPatchField<Type>::prepare
|
|||||||
|
|
||||||
// debugging: make BC verbose
|
// debugging: make BC verbose
|
||||||
// dynCode.setFilterVariable("verbose", "true");
|
// dynCode.setFilterVariable("verbose", "true");
|
||||||
// Info<<"compile " << redirectType_ << " sha1: "
|
// Info<<"compile " << name_ << " sha1: "
|
||||||
// << context.sha1() << endl;
|
// << context.sha1() << endl;
|
||||||
|
|
||||||
// define Make/options
|
// define Make/options
|
||||||
@ -148,7 +148,7 @@ const
|
|||||||
(
|
(
|
||||||
dict_.found("code")
|
dict_.found("code")
|
||||||
? dict_
|
? dict_
|
||||||
: this->dict().subDict(redirectType_)
|
: this->dict().subDict(name_)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
|||||||
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
|
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(ptf.dict_),
|
dict_(ptf.dict_),
|
||||||
redirectType_(ptf.redirectType_),
|
name_(ptf.name_),
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -215,10 +215,15 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
|||||||
fixedValueFvPatchField<Type>(p, iF, dict),
|
fixedValueFvPatchField<Type>(p, iF, dict),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(dict),
|
dict_(dict),
|
||||||
redirectType_(dict.lookup("redirectType")),
|
name_
|
||||||
|
(
|
||||||
|
dict.found("redirectType")
|
||||||
|
? dict.lookup("redirectType")
|
||||||
|
: dict.lookup("name")
|
||||||
|
),
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{
|
{
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -231,7 +236,7 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
|||||||
fixedValueFvPatchField<Type>(ptf),
|
fixedValueFvPatchField<Type>(ptf),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(ptf.dict_),
|
dict_(ptf.dict_),
|
||||||
redirectType_(ptf.redirectType_),
|
name_(ptf.name_),
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -246,7 +251,7 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
|||||||
fixedValueFvPatchField<Type>(ptf, iF),
|
fixedValueFvPatchField<Type>(ptf, iF),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(ptf.dict_),
|
dict_(ptf.dict_),
|
||||||
redirectType_(ptf.redirectType_),
|
name_(ptf.name_),
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -263,7 +268,7 @@ Foam::codedFixedValueFvPatchField<Type>::redirectPatchField() const
|
|||||||
// Make sure to construct the patchfield with up-to-date value
|
// Make sure to construct the patchfield with up-to-date value
|
||||||
|
|
||||||
OStringStream os;
|
OStringStream os;
|
||||||
os.writeKeyword("type") << redirectType_ << token::END_STATEMENT
|
os.writeKeyword("type") << name_ << token::END_STATEMENT
|
||||||
<< nl;
|
<< nl;
|
||||||
static_cast<const Field<Type>&>(*this).writeEntry("value", os);
|
static_cast<const Field<Type>&>(*this).writeEntry("value", os);
|
||||||
IStringStream is(os.str());
|
IStringStream is(os.str());
|
||||||
@ -292,7 +297,7 @@ void Foam::codedFixedValueFvPatchField<Type>::updateCoeffs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure library containing user-defined fvPatchField is up-to-date
|
// Make sure library containing user-defined fvPatchField is up-to-date
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
|
|
||||||
const fvPatchField<Type>& fvp = redirectPatchField();
|
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
|
// Make sure library containing user-defined fvPatchField is up-to-date
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
|
|
||||||
const fvPatchField<Type>& fvp = redirectPatchField();
|
const fvPatchField<Type>& fvp = redirectPatchField();
|
||||||
|
|
||||||
@ -326,7 +331,7 @@ template<class Type>
|
|||||||
void Foam::codedFixedValueFvPatchField<Type>::write(Ostream& os) const
|
void Foam::codedFixedValueFvPatchField<Type>::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
fixedValueFvPatchField<Type>::write(os);
|
fixedValueFvPatchField<Type>::write(os);
|
||||||
os.writeKeyword("redirectType") << redirectType_
|
os.writeKeyword("name") << name_
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
|
|
||||||
if (dict_.found("codeInclude"))
|
if (dict_.found("codeInclude"))
|
||||||
|
|||||||
@ -39,7 +39,7 @@ Description
|
|||||||
{
|
{
|
||||||
type codedFixedValue;
|
type codedFixedValue;
|
||||||
value uniform 0;
|
value uniform 0;
|
||||||
redirectType rampedFixedValue; // name of generated BC
|
name rampedFixedValue; // name of generated BC
|
||||||
|
|
||||||
code
|
code
|
||||||
#{
|
#{
|
||||||
@ -112,7 +112,7 @@ class codedFixedValueFvPatchField
|
|||||||
//- Dictionary contents for the boundary condition
|
//- Dictionary contents for the boundary condition
|
||||||
const dictionary dict_;
|
const dictionary dict_;
|
||||||
|
|
||||||
const word redirectType_;
|
const word name_;
|
||||||
|
|
||||||
mutable autoPtr<fvPatchField<Type>> redirectPatchFieldPtr_;
|
mutable autoPtr<fvPatchField<Type>> redirectPatchFieldPtr_;
|
||||||
|
|
||||||
|
|||||||
@ -106,8 +106,8 @@ void Foam::codedMixedFvPatchField<Type>::prepare
|
|||||||
const dynamicCodeContext& context
|
const dynamicCodeContext& context
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// take no chances - typeName must be identical to redirectType_
|
// take no chances - typeName must be identical to name_
|
||||||
dynCode.setFilterVariable("typeName", redirectType_);
|
dynCode.setFilterVariable("typeName", name_);
|
||||||
|
|
||||||
// set TemplateType and FieldType filter variables
|
// set TemplateType and FieldType filter variables
|
||||||
// (for fvPatchField)
|
// (for fvPatchField)
|
||||||
@ -122,7 +122,7 @@ void Foam::codedMixedFvPatchField<Type>::prepare
|
|||||||
|
|
||||||
// debugging: make BC verbose
|
// debugging: make BC verbose
|
||||||
// dynCode.setFilterVariable("verbose", "true");
|
// dynCode.setFilterVariable("verbose", "true");
|
||||||
// Info<<"compile " << redirectType_ << " sha1: "
|
// Info<<"compile " << name_ << " sha1: "
|
||||||
// << context.sha1() << endl;
|
// << context.sha1() << endl;
|
||||||
|
|
||||||
// define Make/options
|
// define Make/options
|
||||||
@ -148,7 +148,7 @@ const
|
|||||||
(
|
(
|
||||||
dict_.found("code")
|
dict_.found("code")
|
||||||
? dict_
|
? dict_
|
||||||
: this->dict().subDict(redirectType_)
|
: this->dict().subDict(name_)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
|||||||
mixedFvPatchField<Type>(ptf, p, iF, mapper),
|
mixedFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(ptf.dict_),
|
dict_(ptf.dict_),
|
||||||
redirectType_(ptf.redirectType_),
|
name_(ptf.name_),
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -215,10 +215,15 @@ Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
|||||||
mixedFvPatchField<Type>(p, iF, dict),
|
mixedFvPatchField<Type>(p, iF, dict),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(dict),
|
dict_(dict),
|
||||||
redirectType_(dict.lookup("redirectType")),
|
name_
|
||||||
|
(
|
||||||
|
dict.found("redirectType")
|
||||||
|
? dict.lookup("redirectType")
|
||||||
|
: dict.lookup("name")
|
||||||
|
),
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{
|
{
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -231,7 +236,7 @@ Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
|||||||
mixedFvPatchField<Type>(ptf),
|
mixedFvPatchField<Type>(ptf),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(ptf.dict_),
|
dict_(ptf.dict_),
|
||||||
redirectType_(ptf.redirectType_),
|
name_(ptf.name_),
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -246,7 +251,7 @@ Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
|||||||
mixedFvPatchField<Type>(ptf, iF),
|
mixedFvPatchField<Type>(ptf, iF),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(ptf.dict_),
|
dict_(ptf.dict_),
|
||||||
redirectType_(ptf.redirectType_),
|
name_(ptf.name_),
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -271,7 +276,7 @@ Foam::codedMixedFvPatchField<Type>::redirectPatchField() const
|
|||||||
|
|
||||||
// Override the type to enforce the fvPatchField::New constructor
|
// Override the type to enforce the fvPatchField::New constructor
|
||||||
// to choose our type
|
// to choose our type
|
||||||
dict.set("type", redirectType_);
|
dict.set("type", name_);
|
||||||
|
|
||||||
redirectPatchFieldPtr_.set
|
redirectPatchFieldPtr_.set
|
||||||
(
|
(
|
||||||
@ -299,7 +304,7 @@ void Foam::codedMixedFvPatchField<Type>::updateCoeffs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure library containing user-defined fvPatchField is up-to-date
|
// Make sure library containing user-defined fvPatchField is up-to-date
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
|
|
||||||
const mixedFvPatchField<Type>& fvp = redirectPatchField();
|
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
|
// Make sure library containing user-defined fvPatchField is up-to-date
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
|
|
||||||
const mixedFvPatchField<Type>& fvp = redirectPatchField();
|
const mixedFvPatchField<Type>& fvp = redirectPatchField();
|
||||||
|
|
||||||
@ -338,7 +343,7 @@ template<class Type>
|
|||||||
void Foam::codedMixedFvPatchField<Type>::write(Ostream& os) const
|
void Foam::codedMixedFvPatchField<Type>::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
mixedFvPatchField<Type>::write(os);
|
mixedFvPatchField<Type>::write(os);
|
||||||
os.writeKeyword("redirectType") << redirectType_
|
os.writeKeyword("name") << name_
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
|
|
||||||
if (dict_.found("codeInclude"))
|
if (dict_.found("codeInclude"))
|
||||||
|
|||||||
@ -43,7 +43,7 @@ Description
|
|||||||
refGradient uniform (0 0 0);
|
refGradient uniform (0 0 0);
|
||||||
valueFraction uniform 1;
|
valueFraction uniform 1;
|
||||||
|
|
||||||
redirectType rampedMixed; // name of generated BC
|
name rampedMixed; // name of generated BC
|
||||||
|
|
||||||
code
|
code
|
||||||
#{
|
#{
|
||||||
@ -122,7 +122,7 @@ class codedMixedFvPatchField
|
|||||||
//- Dictionary contents for the boundary condition
|
//- Dictionary contents for the boundary condition
|
||||||
mutable dictionary dict_;
|
mutable dictionary dict_;
|
||||||
|
|
||||||
const word redirectType_;
|
const word name_;
|
||||||
|
|
||||||
mutable autoPtr<mixedFvPatchField<Type>> redirectPatchFieldPtr_;
|
mutable autoPtr<mixedFvPatchField<Type>> redirectPatchFieldPtr_;
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ public:
|
|||||||
virtual void updateCoeffs();
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
//- Evaluate the patch field
|
//- 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.
|
// to false.
|
||||||
virtual void evaluate
|
virtual void evaluate
|
||||||
(
|
(
|
||||||
|
|||||||
@ -41,7 +41,7 @@ void Foam::fv::CodedSource<Type>::prepare
|
|||||||
word sourceType(pTraits<Type>::typeName);
|
word sourceType(pTraits<Type>::typeName);
|
||||||
|
|
||||||
// Set additional rewrite rules
|
// Set additional rewrite rules
|
||||||
dynCode.setFilterVariable("typeName", redirectType_);
|
dynCode.setFilterVariable("typeName", name_);
|
||||||
dynCode.setFilterVariable("TemplateType", sourceType);
|
dynCode.setFilterVariable("TemplateType", sourceType);
|
||||||
dynCode.setFilterVariable("SourceType", sourceType + "Source");
|
dynCode.setFilterVariable("SourceType", sourceType + "Source");
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ void Foam::fv::CodedSource<Type>::prepare
|
|||||||
|
|
||||||
// debugging: make BC verbose
|
// debugging: make BC verbose
|
||||||
// dynCode.setFilterVariable("verbose", "true");
|
// dynCode.setFilterVariable("verbose", "true");
|
||||||
// Info<<"compile " << redirectType_ << " sha1: "
|
// Info<<"compile " << name_ << " sha1: "
|
||||||
// << context.sha1() << endl;
|
// << context.sha1() << endl;
|
||||||
|
|
||||||
// define Make/options
|
// define Make/options
|
||||||
@ -132,11 +132,11 @@ Foam::fv::option& Foam::fv::CodedSource<Type>::redirectFvOption() const
|
|||||||
if (!redirectFvOptionPtr_.valid())
|
if (!redirectFvOptionPtr_.valid())
|
||||||
{
|
{
|
||||||
dictionary constructDict(dict_);
|
dictionary constructDict(dict_);
|
||||||
constructDict.set("type", redirectType_);
|
constructDict.set("type", name_);
|
||||||
|
|
||||||
redirectFvOptionPtr_ = option::New
|
redirectFvOptionPtr_ = option::New
|
||||||
(
|
(
|
||||||
redirectType_,
|
name_,
|
||||||
constructDict,
|
constructDict,
|
||||||
mesh_
|
mesh_
|
||||||
);
|
);
|
||||||
@ -157,7 +157,7 @@ void Foam::fv::CodedSource<Type>::correct
|
|||||||
<< ">::correct for source " << name_ << endl;
|
<< ">::correct for source " << name_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
redirectFvOption().correct(field);
|
redirectFvOption().correct(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ void Foam::fv::CodedSource<Type>::addSup
|
|||||||
<< ">::addSup for source " << name_ << endl;
|
<< ">::addSup for source " << name_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
redirectFvOption().addSup(eqn, fieldi);
|
redirectFvOption().addSup(eqn, fieldi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ void Foam::fv::CodedSource<Type>::addSup
|
|||||||
<< ">::addSup for source " << name_ << endl;
|
<< ">::addSup for source " << name_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
redirectFvOption().addSup(rho, eqn, fieldi);
|
redirectFvOption().addSup(rho, eqn, fieldi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ void Foam::fv::CodedSource<Type>::constrain
|
|||||||
<< ">::constrain for source " << name_ << endl;
|
<< ">::constrain for source " << name_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
redirectFvOption().constrain(eqn, fieldi);
|
redirectFvOption().constrain(eqn, fieldi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,7 @@ Description
|
|||||||
selectionMode all;
|
selectionMode all;
|
||||||
|
|
||||||
fieldNames (h);
|
fieldNames (h);
|
||||||
redirectType sourceTime;
|
name sourceTime;
|
||||||
|
|
||||||
codeInclude
|
codeInclude
|
||||||
#{
|
#{
|
||||||
@ -141,7 +141,7 @@ protected:
|
|||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
word redirectType_;
|
word name_;
|
||||||
|
|
||||||
string codeCorrect_;
|
string codeCorrect_;
|
||||||
string codeAddSup_;
|
string codeAddSup_;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -35,7 +35,16 @@ bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
coeffs_.lookup("fieldNames") >> fieldNames_;
|
coeffs_.lookup("fieldNames") >> fieldNames_;
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
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
|
// Code snippets
|
||||||
{
|
{
|
||||||
|
|||||||
@ -56,7 +56,7 @@ void Foam::codedFunctionObject::prepare
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Set additional rewrite rules
|
// Set additional rewrite rules
|
||||||
dynCode.setFilterVariable("typeName", redirectType_);
|
dynCode.setFilterVariable("typeName", name_);
|
||||||
dynCode.setFilterVariable("codeData", codeData_);
|
dynCode.setFilterVariable("codeData", codeData_);
|
||||||
dynCode.setFilterVariable("codeRead", codeRead_);
|
dynCode.setFilterVariable("codeRead", codeRead_);
|
||||||
dynCode.setFilterVariable("codeExecute", codeExecute_);
|
dynCode.setFilterVariable("codeExecute", codeExecute_);
|
||||||
@ -71,7 +71,7 @@ void Foam::codedFunctionObject::prepare
|
|||||||
|
|
||||||
// Debugging: make BC verbose
|
// Debugging: make BC verbose
|
||||||
// dynCode.setFilterVariable("verbose", "true");
|
// dynCode.setFilterVariable("verbose", "true");
|
||||||
// Info<<"compile " << redirectType_ << " sha1: "
|
// Info<<"compile " << name_ << " sha1: "
|
||||||
// << context.sha1() << endl;
|
// << context.sha1() << endl;
|
||||||
|
|
||||||
// Define Make/options
|
// Define Make/options
|
||||||
@ -130,7 +130,7 @@ Foam::codedFunctionObject::codedFunctionObject
|
|||||||
{
|
{
|
||||||
read(dict_);
|
read(dict_);
|
||||||
|
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
redirectFunctionObject();
|
redirectFunctionObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,11 +148,11 @@ Foam::functionObject& Foam::codedFunctionObject::redirectFunctionObject() const
|
|||||||
if (!redirectFunctionObjectPtr_.valid())
|
if (!redirectFunctionObjectPtr_.valid())
|
||||||
{
|
{
|
||||||
dictionary constructDict(dict_);
|
dictionary constructDict(dict_);
|
||||||
constructDict.set("type", redirectType_);
|
constructDict.set("type", name_);
|
||||||
|
|
||||||
redirectFunctionObjectPtr_ = functionObject::New
|
redirectFunctionObjectPtr_ = functionObject::New
|
||||||
(
|
(
|
||||||
redirectType_,
|
name_,
|
||||||
time_,
|
time_,
|
||||||
constructDict
|
constructDict
|
||||||
);
|
);
|
||||||
@ -163,28 +163,36 @@ Foam::functionObject& Foam::codedFunctionObject::redirectFunctionObject() const
|
|||||||
|
|
||||||
bool Foam::codedFunctionObject::execute(const bool postProcess)
|
bool Foam::codedFunctionObject::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
return redirectFunctionObject().execute(postProcess);
|
return redirectFunctionObject().execute(postProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::codedFunctionObject::write(const bool postProcess)
|
bool Foam::codedFunctionObject::write(const bool postProcess)
|
||||||
{
|
{
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
return redirectFunctionObject().write(postProcess);
|
return redirectFunctionObject().write(postProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::codedFunctionObject::end()
|
bool Foam::codedFunctionObject::end()
|
||||||
{
|
{
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
return redirectFunctionObject().end();
|
return redirectFunctionObject().end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::codedFunctionObject::read(const dictionary& dict)
|
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
|
const entry* dataPtr = dict.lookupEntryPtr
|
||||||
(
|
(
|
||||||
@ -276,7 +284,7 @@ bool Foam::codedFunctionObject::read(const dictionary& dict)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLibrary(redirectType_);
|
updateLibrary(name_);
|
||||||
return redirectFunctionObject().read(dict);
|
return redirectFunctionObject().read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ Description
|
|||||||
|
|
||||||
type coded;
|
type coded;
|
||||||
// Name of on-the-fly generated functionObject
|
// Name of on-the-fly generated functionObject
|
||||||
redirectType writeMagU;
|
name writeMagU;
|
||||||
code
|
code
|
||||||
#{
|
#{
|
||||||
// Lookup U
|
// Lookup U
|
||||||
@ -102,7 +102,7 @@ protected:
|
|||||||
//- Input dictionary
|
//- Input dictionary
|
||||||
dictionary dict_;
|
dictionary dict_;
|
||||||
|
|
||||||
word redirectType_;
|
word name_;
|
||||||
|
|
||||||
string codeData_;
|
string codeData_;
|
||||||
string codeRead_;
|
string codeRead_;
|
||||||
|
|||||||
@ -47,7 +47,7 @@ runTimeModifiable true;
|
|||||||
|
|
||||||
functions
|
functions
|
||||||
{
|
{
|
||||||
difference
|
error
|
||||||
{
|
{
|
||||||
// Load the library containing the 'coded' functionObject
|
// Load the library containing the 'coded' functionObject
|
||||||
libs ("libutilityFunctionObjects.so");
|
libs ("libutilityFunctionObjects.so");
|
||||||
@ -55,7 +55,7 @@ functions
|
|||||||
type coded;
|
type coded;
|
||||||
|
|
||||||
// Name of on-the-fly generated functionObject
|
// Name of on-the-fly generated functionObject
|
||||||
redirectType error;
|
name error;
|
||||||
|
|
||||||
codeEnd
|
codeEnd
|
||||||
#{
|
#{
|
||||||
|
|||||||
@ -57,7 +57,7 @@ functions
|
|||||||
{
|
{
|
||||||
type coded;
|
type coded;
|
||||||
libs ("libutilityFunctionObjects.so");
|
libs ("libutilityFunctionObjects.so");
|
||||||
redirectType setDeltaT;
|
name setDeltaT;
|
||||||
|
|
||||||
code
|
code
|
||||||
#{
|
#{
|
||||||
|
|||||||
@ -26,7 +26,7 @@ boundaryField
|
|||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type codedFixedValue;
|
type codedFixedValue;
|
||||||
redirectType swirl;
|
name swirl;
|
||||||
|
|
||||||
code
|
code
|
||||||
#{
|
#{
|
||||||
|
|||||||
@ -56,7 +56,7 @@ totalMass
|
|||||||
{
|
{
|
||||||
type coded;
|
type coded;
|
||||||
libs ("libutilityFunctionObjects.so");
|
libs ("libutilityFunctionObjects.so");
|
||||||
redirectType error;
|
name error;
|
||||||
|
|
||||||
code
|
code
|
||||||
#{
|
#{
|
||||||
|
|||||||
Reference in New Issue
Block a user