Added readPatchType function to capture the patch type for patch fields which circumvent base class dictionary constructor

This commit is contained in:
Hrvoje Jasak 2018-06-01 17:29:59 +01:00
parent c7f24b57ed
commit b365dab574
3 changed files with 38 additions and 22 deletions

View file

@ -49,20 +49,6 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
}
template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField
(
const inletOutletFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchField<Type>(ptf, p, iF, mapper),
phiName_(ptf.phiName_)
{}
template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField
(
@ -74,6 +60,9 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
mixedFvPatchField<Type>(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{
// Read patch type
this->readPatchType(dict);
this->refValue() = Field<Type>("inletValue", dict, p.size());
if (dict.found("value"))
@ -93,6 +82,20 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
}
template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField
(
const inletOutletFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchField<Type>(ptf, p, iF, mapper),
phiName_(ptf.phiName_)
{}
template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField
(

View file

@ -154,6 +154,13 @@ Foam::fvPatchField<Type>::fvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::fvPatchField<Type>::readPatchType(const dictionary& dict)
{
patchType_ = dict.lookupOrDefault<word>("patchType", word::null);
}
template<class Type>
const Foam::objectRegistry& Foam::fvPatchField<Type>::db() const
{

View file

@ -107,6 +107,16 @@ class fvPatchField
word patchType_;
protected:
// Protected member functions
//- Read patch type
// Use for derived types which over-ride dictionary constructor
// in order to read the patch type
void readPatchType(const dictionary& dict);
public:
typedef fvPatch Patch;
@ -120,7 +130,6 @@ public:
// Declare run-time constructor selection tables
#ifndef SWIG
declareRunTimeSelectionTable
(
tmp,
@ -159,7 +168,7 @@ public:
),
(p, iF, dict)
);
#endif
// Constructors
@ -262,10 +271,9 @@ public:
);
// Destructor
virtual ~fvPatchField<Type>()
{}
//- Destructor
virtual ~fvPatchField<Type>()
{}
// Member functions
@ -614,9 +622,7 @@ public:
// Ostream operator
#ifndef SWIG
friend Ostream& operator<< <Type>(Ostream&, const fvPatchField<Type>&);
#endif
};