Commit 5653e2b1 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Compatibility updates for finiteArea

parent b886000e
......@@ -199,7 +199,7 @@ public:
);
//- Construct by mapping from the given tmp field. Supplied uniform
// value for unmapped items
//- value for unmapped items
Field
(
const tmp<Field<Type>>& tmapF,
......@@ -209,7 +209,7 @@ public:
);
//- Construct by mapping from the given tmp field. Supplied values
// for unmapped items
//- for unmapped items
Field
(
const tmp<Field<Type>>& tmapF,
......@@ -233,6 +233,12 @@ public:
//- Clone
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
// freestore without setting patchField values
template<class Type2>
......
......@@ -40,7 +40,8 @@ Foam::faPatchField<Type>::faPatchField
Field<Type>(p.size()),
patch_(p),
internalField_(iF),
updated_(false)
updated_(false),
patchType_(word::null)
{}
......@@ -55,7 +56,8 @@ Foam::faPatchField<Type>::faPatchField
Field<Type>(f),
patch_(p),
internalField_(iF),
updated_(false)
updated_(false),
patchType_(word::null)
{}
......@@ -71,7 +73,8 @@ Foam::faPatchField<Type>::faPatchField
Field<Type>(ptf, mapper),
patch_(p),
internalField_(iF),
updated_(false)
updated_(false),
patchType_(word::null)
{}
......@@ -86,7 +89,8 @@ Foam::faPatchField<Type>::faPatchField
Field<Type>(p.size()),
patch_(p),
internalField_(iF),
updated_(false)
updated_(false),
patchType_(dict.lookupOrDefault<word>("patchType", word::null))
{
if (dict.found("value"))
{
......@@ -111,7 +115,8 @@ Foam::faPatchField<Type>::faPatchField
Field<Type>(ptf),
patch_(ptf.patch_),
internalField_(ptf.internalField_),
updated_(false)
updated_(false),
patchType_(ptf.patchType_)
{}
......@@ -125,7 +130,8 @@ Foam::faPatchField<Type>::faPatchField
Field<Type>(ptf),
patch_(ptf.patch_),
internalField_(iF),
updated_(false)
updated_(false),
patchType_(ptf.patchType_)
{}
......@@ -200,6 +206,11 @@ template<class Type>
void Foam::faPatchField<Type>::write(Ostream& os) const
{
os.writeEntry("type", type());
if (patchType_.size())
{
os.writeEntry("patchType", patchType_);
}
}
......
......@@ -94,6 +94,11 @@ class faPatchField
// the construction of the matrix
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:
......@@ -217,7 +222,18 @@ public:
// (does not set the patch field values)
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 DimensionedField<Type, areaMesh>&
);
......@@ -280,6 +296,18 @@ public:
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
static const word& calculatedType();
......
......@@ -31,6 +31,7 @@ template<class Type>
Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New
(
const word& patchFieldType,
const word& actualPatchType,
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF
)
......@@ -52,17 +53,47 @@ Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New
auto patchTypeCstrIter = patchConstructorTablePtr_->cfind(p.type());
if (patchTypeCstrIter.found())
if
(
actualPatchType == word::null
|| actualPatchType != p.type()
)
{
return patchTypeCstrIter()(p, iF);
if (patchTypeCstrIter.found())
{
return patchTypeCstrIter()(p, iF);
}
else
{
return cstrIter()(p, iF);
}
}
else
{
return cstrIter()(p, iF);
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);
}
template<class Type>
Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New
(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment