ENH: Compatibility updates for finiteArea

This commit is contained in:
Andrew Heather
2019-05-15 08:35:07 +01:00
parent b886000eb3
commit 5653e2b174
4 changed files with 88 additions and 12 deletions

View File

@ -199,7 +199,7 @@ public:
); );
//- Construct by mapping from the given tmp field. Supplied uniform //- Construct by mapping from the given tmp field. Supplied uniform
// value for unmapped items //- value for unmapped items
Field Field
( (
const tmp<Field<Type>>& tmapF, const tmp<Field<Type>>& tmapF,
@ -209,7 +209,7 @@ public:
); );
//- Construct by mapping from the given tmp field. Supplied values //- Construct by mapping from the given tmp field. Supplied values
// for unmapped items //- for unmapped items
Field Field
( (
const tmp<Field<Type>>& tmapF, const tmp<Field<Type>>& tmapF,
@ -233,6 +233,12 @@ public:
//- Clone //- Clone
inline tmp<Field<Type>> clone() const; inline tmp<Field<Type>> clone() const;
//- Return a pointer to a new Field created on freestore
static autoPtr<Field<Type>> New(Istream& is)
{
return autoPtr<Field<Type>>(new Field<Type>(is));
}
//- Return a pointer to a new calculatedFvPatchFieldField created on //- Return a pointer to a new calculatedFvPatchFieldField created on
// freestore without setting patchField values // freestore without setting patchField values
template<class Type2> template<class Type2>

View File

@ -40,7 +40,8 @@ Foam::faPatchField<Type>::faPatchField
Field<Type>(p.size()), Field<Type>(p.size()),
patch_(p), patch_(p),
internalField_(iF), internalField_(iF),
updated_(false) updated_(false),
patchType_(word::null)
{} {}
@ -55,7 +56,8 @@ Foam::faPatchField<Type>::faPatchField
Field<Type>(f), Field<Type>(f),
patch_(p), patch_(p),
internalField_(iF), internalField_(iF),
updated_(false) updated_(false),
patchType_(word::null)
{} {}
@ -71,7 +73,8 @@ Foam::faPatchField<Type>::faPatchField
Field<Type>(ptf, mapper), Field<Type>(ptf, mapper),
patch_(p), patch_(p),
internalField_(iF), internalField_(iF),
updated_(false) updated_(false),
patchType_(word::null)
{} {}
@ -86,7 +89,8 @@ Foam::faPatchField<Type>::faPatchField
Field<Type>(p.size()), Field<Type>(p.size()),
patch_(p), patch_(p),
internalField_(iF), internalField_(iF),
updated_(false) updated_(false),
patchType_(dict.lookupOrDefault<word>("patchType", word::null))
{ {
if (dict.found("value")) if (dict.found("value"))
{ {
@ -111,7 +115,8 @@ Foam::faPatchField<Type>::faPatchField
Field<Type>(ptf), Field<Type>(ptf),
patch_(ptf.patch_), patch_(ptf.patch_),
internalField_(ptf.internalField_), internalField_(ptf.internalField_),
updated_(false) updated_(false),
patchType_(ptf.patchType_)
{} {}
@ -125,7 +130,8 @@ Foam::faPatchField<Type>::faPatchField
Field<Type>(ptf), Field<Type>(ptf),
patch_(ptf.patch_), patch_(ptf.patch_),
internalField_(iF), internalField_(iF),
updated_(false) updated_(false),
patchType_(ptf.patchType_)
{} {}
@ -200,6 +206,11 @@ template<class Type>
void Foam::faPatchField<Type>::write(Ostream& os) const void Foam::faPatchField<Type>::write(Ostream& os) const
{ {
os.writeEntry("type", type()); os.writeEntry("type", type());
if (patchType_.size())
{
os.writeEntry("patchType", patchType_);
}
} }

View File

@ -94,6 +94,11 @@ class faPatchField
// the construction of the matrix // the construction of the matrix
bool updated_; bool updated_;
//- Optional patch type, used to allow specified boundary conditions
// to be applied to constraint patches by providing the constraint
// patch type as 'patchType'
word patchType_;
public: public:
@ -217,7 +222,18 @@ public:
// (does not set the patch field values) // (does not set the patch field values)
static tmp<faPatchField<Type>> New static tmp<faPatchField<Type>> New
( (
const word&, const word& patchFieldType,
const word& actualPatchType,
const faPatch&,
const DimensionedField<Type, areaMesh>&
);
//- Return a pointer to a new patchField created on freestore given
// patch and internal field
// (does not set the patch field values)
static tmp<faPatchField<Type>> New
(
const word& patchFieldType,
const faPatch&, const faPatch&,
const DimensionedField<Type, areaMesh>& const DimensionedField<Type, areaMesh>&
); );
@ -280,6 +296,18 @@ public:
return internalField_; return internalField_;
} }
//- Optional patch type
const word& patchType() const
{
return patchType_;
}
//- Optional patch type
word& patchType()
{
return patchType_;
}
//- Return the type of the calculated for of faPatchField //- Return the type of the calculated for of faPatchField
static const word& calculatedType(); static const word& calculatedType();

View File

@ -31,6 +31,7 @@ template<class Type>
Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New
( (
const word& patchFieldType, const word& patchFieldType,
const word& actualPatchType,
const faPatch& p, const faPatch& p,
const DimensionedField<Type, areaMesh>& iF const DimensionedField<Type, areaMesh>& iF
) )
@ -52,6 +53,12 @@ Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New
auto patchTypeCstrIter = patchConstructorTablePtr_->cfind(p.type()); auto patchTypeCstrIter = patchConstructorTablePtr_->cfind(p.type());
if
(
actualPatchType == word::null
|| actualPatchType != p.type()
)
{
if (patchTypeCstrIter.found()) if (patchTypeCstrIter.found())
{ {
return patchTypeCstrIter()(p, iF); return patchTypeCstrIter()(p, iF);
@ -60,6 +67,30 @@ Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New
{ {
return cstrIter()(p, iF); return cstrIter()(p, iF);
} }
}
else
{
tmp<faPatchField<Type>> tfap = cstrIter()(p, iF);
// Check if constraint type override and store patchType if so
if (patchTypeCstrIter.found())
{
tfap.ref().patchType() = actualPatchType;
}
return tfap;
}
}
template<class Type>
Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New
(
const word& patchFieldType,
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF
)
{
return New(patchFieldType, word::null, p, iF);
} }