From a18d10c0aa8c610d63ea9bd300639694346c84ed Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Thu, 3 Jan 2019 17:01:32 +0100 Subject: [PATCH] BUGFIX: new inletOutlet breaks with postfixedSubRegistry --- .../derived/inletOutlet/inletOutletFvPatchField.C | 4 +++- .../surfaceInterpolation/schemes/harmonic/magLongDelta.C | 2 +- src/foam/db/objectRegistry/objectRegistry.C | 6 ++++++ src/foam/db/objectRegistry/objectRegistry.H | 3 +++ src/foam/db/postfixedSubRegistry/postfixedSubRegistry.C | 8 ++++++++ src/foam/db/postfixedSubRegistry/postfixedSubRegistry.H | 3 +++ 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C index 9f0d8bbbb..c112a8102 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C @@ -129,7 +129,9 @@ void inletOutletFvPatchField::updateCoeffs() return; } - if (!this->db().objectRegistry::found(phiName_)) + // HR 2.1.19: Allow calls of virtual function in derived object registry + // eg. postFixedSubRegistry + if (!this->db().found(phiName_)) { // Flux not available, do not update InfoIn diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/harmonic/magLongDelta.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/harmonic/magLongDelta.C index e1d1bf807..6535a0458 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/harmonic/magLongDelta.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/harmonic/magLongDelta.C @@ -70,7 +70,7 @@ void Foam::magLongDelta::makeMagLongDistance() const << abort(FatalError); } -// if (debug) + if (debug) { InfoIn("magLongDelta::makeMagLongDistance()") << "Constructing magnitude of long cell distance" diff --git a/src/foam/db/objectRegistry/objectRegistry.C b/src/foam/db/objectRegistry/objectRegistry.C index b2660554d..50e17daff 100644 --- a/src/foam/db/objectRegistry/objectRegistry.C +++ b/src/foam/db/objectRegistry/objectRegistry.C @@ -212,6 +212,12 @@ const Foam::objectRegistry& Foam::objectRegistry::subRegistry } +bool Foam::objectRegistry::found(const word& name) const +{ + return HashTable::found(name); +} + + Foam::label Foam::objectRegistry::getEvent() const { label curEvent = event_++; diff --git a/src/foam/db/objectRegistry/objectRegistry.H b/src/foam/db/objectRegistry/objectRegistry.H index f52925753..ad86ce5b1 100644 --- a/src/foam/db/objectRegistry/objectRegistry.H +++ b/src/foam/db/objectRegistry/objectRegistry.H @@ -187,6 +187,9 @@ public: template HashTable lookupClass(const bool strict = false); + //- Is the object with name found? + virtual bool found(const word& name) const; + //- Is the named Type found? template bool foundObject(const word& name) const; diff --git a/src/foam/db/postfixedSubRegistry/postfixedSubRegistry.C b/src/foam/db/postfixedSubRegistry/postfixedSubRegistry.C index c8d8f4468..4661db9b4 100644 --- a/src/foam/db/postfixedSubRegistry/postfixedSubRegistry.C +++ b/src/foam/db/postfixedSubRegistry/postfixedSubRegistry.C @@ -140,4 +140,12 @@ bool Foam::postfixedSubRegistry::checkOut(regIOobject& io) const } +bool Foam::postfixedSubRegistry::found(const word& objName) const +{ + word demangledName = objName; + demangledName = demangledName(objName.size() - name().size()); + return HashTable::found(demangledName); +} + + // ************************************************************************* // diff --git a/src/foam/db/postfixedSubRegistry/postfixedSubRegistry.H b/src/foam/db/postfixedSubRegistry/postfixedSubRegistry.H index ee5e48f84..6016b9f1d 100644 --- a/src/foam/db/postfixedSubRegistry/postfixedSubRegistry.H +++ b/src/foam/db/postfixedSubRegistry/postfixedSubRegistry.H @@ -88,6 +88,9 @@ public: //- Return mangled fileName virtual fileName mangleFileName (const fileName&) const; + //- Is the object with name found? + virtual bool found(const word& name) const; + // Edit //- Add an regIOobject to registry