From 8aa7b1353f38216022bccf032a9e3712b944e599 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 26 Jul 2018 16:55:49 +0100 Subject: [PATCH] ENH: refCast: give better error messages. Fixes #953. --- src/OpenFOAM/db/typeInfo/typeInfo.H | 42 +++++++++++++++++++ .../constraint/cyclic/cyclicPointPatchField.C | 2 +- .../processor/processorPointPatchField.C | 2 +- .../processorCyclicPointPatchField.C | 2 +- .../symmetryPlanePointPatchField.C | 2 +- .../basic/coupled/coupledFaPatchField.C | 2 +- .../constraint/cyclic/cyclicFaPatchField.C | 2 +- .../processor/processorFaPatchField.C | 2 +- .../constraint/cyclic/cyclicFaePatchField.C | 2 +- .../processor/processorFaePatchField.C | 2 +- .../basic/coupled/coupledFvPatchField.C | 2 +- .../constraint/cyclic/cyclicFvPatchField.C | 2 +- .../cyclicACMI/cyclicACMIFvPatchField.C | 2 +- .../cyclicAMI/cyclicAMIFvPatchField.C | 2 +- .../processor/processorFvPatchField.C | 2 +- .../processorCyclicFvPatchField.C | 2 +- .../symmetryPlane/symmetryPlaneFvPatchField.C | 2 +- .../activeBaffleVelocityFvPatchVectorField.C | 3 +- ...ureForceBaffleVelocityFvPatchVectorField.C | 3 +- ...mappedVelocityFluxFixedValueFvPatchField.C | 3 +- .../constraint/cyclic/cyclicFvsPatchField.C | 2 +- .../cyclicACMI/cyclicACMIFvsPatchField.C | 2 +- .../cyclicAMI/cyclicAMIFvsPatchField.C | 2 +- .../processor/processorFvsPatchField.C | 2 +- .../processorCyclicFvsPatchField.C | 2 +- .../cyclicACMIPointPatchField.C | 2 +- .../cyclicAMIPointPatchField.C | 2 +- .../energyRegionCoupledFvPatchScalarField.C | 2 +- .../thermalBaffleFvPatchScalarField.C | 2 +- 29 files changed, 73 insertions(+), 28 deletions(-) diff --git a/src/OpenFOAM/db/typeInfo/typeInfo.H b/src/OpenFOAM/db/typeInfo/typeInfo.H index c29d7713c9..f0b1af2965 100644 --- a/src/OpenFOAM/db/typeInfo/typeInfo.H +++ b/src/OpenFOAM/db/typeInfo/typeInfo.H @@ -100,6 +100,27 @@ inline To& dynamicCast(From& r) } +//- Reference type cast template function, +// wraps dynamic_cast to handle bad_cast exception and generate a FatalError. +template +inline To& dynamicCast(From& r, const dictionary& d) +{ + try + { + return dynamic_cast(r); + } + catch (std::bad_cast&) + { + FatalIOErrorInFunction(d) + << "Attempt to cast type " << typeid(r).name() + << " to type " << typeid(To).name() + << abort(FatalIOError); + + return dynamic_cast(r); + } +} + + //- Reference type cast template function. // As per dynamicCast, but handles type names via the virtual type() method. template @@ -121,6 +142,27 @@ inline To& refCast(From& r) } +//- Reference type cast template function. +// As per dynamicCast, but handles type names via the virtual type() method. +template +inline To& refCast(From& r, const dictionary& d) +{ + try + { + return dynamic_cast(r); + } + catch (std::bad_cast&) + { + FatalIOErrorInFunction(d) + << "Attempt to cast type " << r.type() + << " to type " << To::typeName + << abort(FatalIOError); + + return dynamic_cast(r); + } +} + + //- Check the typeid template inline bool isType(const Type& t) diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.C index 02e66ce22e..2ce727f3f5 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.C @@ -51,7 +51,7 @@ Foam::cyclicPointPatchField::cyclicPointPatchField ) : coupledPointPatchField(p, iF, dict), - cyclicPatch_(refCast(p)) + cyclicPatch_(refCast(p, dict)) { if (!isType(p)) { diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C index 011129adc8..1be4e558cc 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C @@ -49,7 +49,7 @@ Foam::processorPointPatchField::processorPointPatchField ) : coupledPointPatchField(p, iF, dict), - procPatch_(refCast(p)) + procPatch_(refCast(p, dict)) {} diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C index aac70da39f..01986e6af1 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C @@ -52,7 +52,7 @@ Foam::processorCyclicPointPatchField::processorCyclicPointPatchField ) : coupledPointPatchField(p, iF, dict), - procPatch_(refCast(p)), + procPatch_(refCast(p, dict)), receiveBuf_(0) {} diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/symmetryPlane/symmetryPlanePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/symmetryPlane/symmetryPlanePointPatchField.C index 9351dac4bd..ace223aaa6 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/symmetryPlane/symmetryPlanePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/symmetryPlane/symmetryPlanePointPatchField.C @@ -48,7 +48,7 @@ Foam::symmetryPlanePointPatchField::symmetryPlanePointPatchField ) : basicSymmetryPointPatchField(p, iF, dict), - symmetryPlanePatch_(refCast(p)) + symmetryPlanePatch_(refCast(p, dict)) { if (!isType(p)) { diff --git a/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchField.C b/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchField.C index 4ef17cc1c2..0fd8e445fc 100644 --- a/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchField.C @@ -76,7 +76,7 @@ Foam::coupledFaPatchField::coupledFaPatchField const dictionary& dict ) : - lduInterfaceField(refCast(p)), + lduInterfaceField(refCast(p, dict)), faPatchField(p, iF, dict) {} diff --git a/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.C b/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.C index f192714258..14fa7dcd3c 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.C @@ -75,7 +75,7 @@ Foam::cyclicFaPatchField::cyclicFaPatchField ) : coupledFaPatchField(p, iF, dict), - cyclicPatch_(refCast(p)) + cyclicPatch_(refCast(p, dict)) { if (!isA(p)) { diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C index b9bfdb2f1a..9db7f49ac5 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C @@ -92,7 +92,7 @@ Foam::processorFaPatchField::processorFaPatchField ) : coupledFaPatchField(p, iF, dict), - procPatch_(refCast(p)) + procPatch_(refCast(p, dict)) { if (!isType(p)) { diff --git a/src/finiteArea/fields/faePatchFields/constraint/cyclic/cyclicFaePatchField.C b/src/finiteArea/fields/faePatchFields/constraint/cyclic/cyclicFaePatchField.C index a7f112f2b2..0692c6a82d 100644 --- a/src/finiteArea/fields/faePatchFields/constraint/cyclic/cyclicFaePatchField.C +++ b/src/finiteArea/fields/faePatchFields/constraint/cyclic/cyclicFaePatchField.C @@ -74,7 +74,7 @@ Foam::cyclicFaePatchField::cyclicFaePatchField ) : coupledFaePatchField(p, iF, dict), - cyclicPatch_(refCast(p)) + cyclicPatch_(refCast(p, dict)) { if (!isType(p)) { diff --git a/src/finiteArea/fields/faePatchFields/constraint/processor/processorFaePatchField.C b/src/finiteArea/fields/faePatchFields/constraint/processor/processorFaePatchField.C index d2be94d30a..fe3c5d7edc 100644 --- a/src/finiteArea/fields/faePatchFields/constraint/processor/processorFaePatchField.C +++ b/src/finiteArea/fields/faePatchFields/constraint/processor/processorFaePatchField.C @@ -87,7 +87,7 @@ Foam::processorFaePatchField::processorFaePatchField ) : coupledFaePatchField(p, iF, dict), - procPatch_(refCast(p)) + procPatch_(refCast(p, dict)) { if (!isType(p)) { diff --git a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C index d53c250565..fb0454bdc2 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C @@ -75,7 +75,7 @@ Foam::coupledFvPatchField::coupledFvPatchField const bool valueRequired ) : - LduInterfaceField(refCast(p)), + LduInterfaceField(refCast(p, dict)), fvPatchField(p, iF, dict, valueRequired) {} diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C index 9a6dc99faa..718fc5ca40 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C @@ -49,7 +49,7 @@ Foam::cyclicFvPatchField::cyclicFvPatchField ) : coupledFvPatchField(p, iF, dict, false), - cyclicPatch_(refCast(p)) + cyclicPatch_(refCast(p, dict)) { if (!isA(p)) { diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C index 912c44173d..579faf41bf 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C @@ -51,7 +51,7 @@ Foam::cyclicACMIFvPatchField::cyclicACMIFvPatchField : cyclicACMILduInterfaceField(), coupledFvPatchField(p, iF, dict, dict.found("value")), - cyclicACMIPatch_(refCast(p)) + cyclicACMIPatch_(refCast(p, dict)) { if (!isA(p)) { diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C index 5bbce362be..2888814b16 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C @@ -48,7 +48,7 @@ Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField : cyclicAMILduInterfaceField(), coupledFvPatchField(p, iF, dict, dict.found("value")), - cyclicAMIPatch_(refCast(p)) + cyclicAMIPatch_(refCast(p, dict)) { if (!isA(p)) { diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C index 84405f3832..a9573c596f 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C @@ -76,7 +76,7 @@ Foam::processorFvPatchField::processorFvPatchField ) : coupledFvPatchField(p, iF, dict, dict.found("value")), - procPatch_(refCast(p)), + procPatch_(refCast(p, dict)), sendBuf_(0), receiveBuf_(0), outstandingSendRequest_(-1), diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C index 4cc2a4d53c..be958aaacf 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C @@ -51,7 +51,7 @@ Foam::processorCyclicFvPatchField::processorCyclicFvPatchField ) : processorFvPatchField(p, iF, dict), - procPatch_(refCast(p)) + procPatch_(refCast(p, dict)) { if (!isType(p)) { diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/symmetryPlane/symmetryPlaneFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/symmetryPlane/symmetryPlaneFvPatchField.C index 57d21f8f94..f8a8d0e71c 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/symmetryPlane/symmetryPlaneFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/symmetryPlane/symmetryPlaneFvPatchField.C @@ -73,7 +73,7 @@ Foam::symmetryPlaneFvPatchField::symmetryPlaneFvPatchField ) : basicSymmetryFvPatchField(p, iF, dict), - symmetryPlanePatch_(refCast(p)) + symmetryPlanePatch_(refCast(p, dict)) { if (!isType(p)) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C index 4761e61da7..7b5a591063 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C @@ -96,7 +96,8 @@ activeBaffleVelocityFvPatchVectorField ( refCast ( - p.boundaryMesh()[cyclicPatchLabel_] + p.boundaryMesh()[cyclicPatchLabel_], + dict ).neighbFvPatch().Sf() ), openFraction_(readScalar(dict.lookup("openFraction"))), diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C index a0f66f5739..575490bac4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C @@ -115,7 +115,8 @@ activePressureForceBaffleVelocityFvPatchVectorField initCyclicSf_ = p.boundaryMesh()[cyclicPatchLabel_].Sf(); nbrCyclicSf_ = refCast ( - p.boundaryMesh()[cyclicPatchLabel_] + p.boundaryMesh()[cyclicPatchLabel_], + dict ).neighbFvPatch().Sf(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C index e35b556c48..7c9154c0a0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C @@ -94,7 +94,8 @@ mappedVelocityFluxFixedValueFvPatchField const mappedPatchBase& mpp = refCast ( - this->patch().patch() + this->patch().patch(), + dict ); if (mpp.mode() == mappedPolyPatch::NEARESTCELL) { diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclic/cyclicFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclic/cyclicFvsPatchField.C index 15fe2d9df7..dab94137f1 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclic/cyclicFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclic/cyclicFvsPatchField.C @@ -48,7 +48,7 @@ Foam::cyclicFvsPatchField::cyclicFvsPatchField ) : coupledFvsPatchField(p, iF, dict), - cyclicPatch_(refCast(p)) + cyclicPatch_(refCast(p, dict)) { if (!isA(p)) { diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicACMI/cyclicACMIFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicACMI/cyclicACMIFvsPatchField.C index d230e64d5a..86cfbabbf1 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicACMI/cyclicACMIFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicACMI/cyclicACMIFvsPatchField.C @@ -72,7 +72,7 @@ Foam::cyclicACMIFvsPatchField::cyclicACMIFvsPatchField ) : coupledFvsPatchField(p, iF, dict), - cyclicACMIPatch_(refCast(p)) + cyclicACMIPatch_(refCast(p, dict)) { if (!isA(p)) { diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C index 4b92ffe893..1862467aac 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C @@ -72,7 +72,7 @@ Foam::cyclicAMIFvsPatchField::cyclicAMIFvsPatchField ) : coupledFvsPatchField(p, iF, dict), - cyclicAMIPatch_(refCast(p)) + cyclicAMIPatch_(refCast(p, dict)) { if (!isA(p)) { diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.C index a6fa161790..a9f6bd3ca0 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.C @@ -61,7 +61,7 @@ Foam::processorFvsPatchField::processorFvsPatchField ) : coupledFvsPatchField(p, iF, dict), - procPatch_(refCast(p)) + procPatch_(refCast(p, dict)) { if (!isType(p)) { diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.C index 0cfa469404..6f5d10d4ce 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.C @@ -61,7 +61,7 @@ Foam::processorCyclicFvsPatchField::processorCyclicFvsPatchField ) : coupledFvsPatchField(p, iF, dict), - procPatch_(refCast(p)) + procPatch_(refCast(p, dict)) { if (!isType(p)) { diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.C b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.C index cd4eae9048..434489fed1 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.C @@ -53,7 +53,7 @@ Foam::cyclicACMIPointPatchField::cyclicACMIPointPatchField ) : coupledPointPatchField(p, iF, dict), - cyclicACMIPatch_(refCast(p)), + cyclicACMIPatch_(refCast(p, dict)), ppiPtr_(nullptr), nbrPpiPtr_(nullptr) { diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C index 2d2d6c524d..64650ab876 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C @@ -53,7 +53,7 @@ Foam::cyclicAMIPointPatchField::cyclicAMIPointPatchField ) : coupledPointPatchField(p, iF, dict), - cyclicAMIPatch_(refCast(p)), + cyclicAMIPatch_(refCast(p, dict)), ppiPtr_(nullptr), nbrPpiPtr_(nullptr) { diff --git a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C index b372995659..53ba2236c5 100644 --- a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C +++ b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C @@ -236,7 +236,7 @@ energyRegionCoupledFvPatchScalarField ) : coupledFvPatchField(p, iF, dict), - regionCoupledPatch_(refCast(p)), + regionCoupledPatch_(refCast(p, dict)), method_(UNDEFINED), nbrThermoPtr_(nullptr), thermoPtr_(nullptr) diff --git a/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C index 9895f146bc..23620a8942 100644 --- a/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C +++ b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C @@ -180,7 +180,7 @@ void thermalBaffleFvPatchScalarField::createPatchMesh() } const mappedPatchBase& mpp = - refCast(patch().patch()); + refCast(patch().patch(), dict_); const word coupleGroup(mpp.coupleGroup());