From b365dab5745c41e01bb9791f5ccef7d7c93635a3 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Fri, 1 Jun 2018 17:29:59 +0100 Subject: [PATCH] Added readPatchType function to capture the patch type for patch fields which circumvent base class dictionary constructor --- .../inletOutlet/inletOutletFvPatchField.C | 31 ++++++++++--------- .../fvPatchFields/fvPatchField/fvPatchField.C | 7 +++++ .../fvPatchFields/fvPatchField/fvPatchField.H | 22 ++++++++----- 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C index 650c0b878..e19df714e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C @@ -49,20 +49,6 @@ inletOutletFvPatchField::inletOutletFvPatchField } -template -inletOutletFvPatchField::inletOutletFvPatchField -( - const inletOutletFvPatchField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - mixedFvPatchField(ptf, p, iF, mapper), - phiName_(ptf.phiName_) -{} - - template inletOutletFvPatchField::inletOutletFvPatchField ( @@ -74,6 +60,9 @@ inletOutletFvPatchField::inletOutletFvPatchField mixedFvPatchField(p, iF), phiName_(dict.lookupOrDefault("phi", "phi")) { + // Read patch type + this->readPatchType(dict); + this->refValue() = Field("inletValue", dict, p.size()); if (dict.found("value")) @@ -93,6 +82,20 @@ inletOutletFvPatchField::inletOutletFvPatchField } +template +inletOutletFvPatchField::inletOutletFvPatchField +( + const inletOutletFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + mixedFvPatchField(ptf, p, iF, mapper), + phiName_(ptf.phiName_) +{} + + template inletOutletFvPatchField::inletOutletFvPatchField ( diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index c0c9394ef..3f035653f 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -154,6 +154,13 @@ Foam::fvPatchField::fvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +void Foam::fvPatchField::readPatchType(const dictionary& dict) +{ + patchType_ = dict.lookupOrDefault("patchType", word::null); +} + + template const Foam::objectRegistry& Foam::fvPatchField::db() const { diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index 0d53d2146..362423c14 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -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() - {} + //- Destructor + virtual ~fvPatchField() + {} // Member functions @@ -614,9 +622,7 @@ public: // Ostream operator -#ifndef SWIG friend Ostream& operator<< (Ostream&, const fvPatchField&); -#endif };