diff --git a/applications/solvers/modules/multiphaseEuler/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C b/applications/solvers/modules/multiphaseEuler/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C index 57b52139db..34e376e64e 100644 --- a/applications/solvers/modules/multiphaseEuler/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C +++ b/applications/solvers/modules/multiphaseEuler/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -934,7 +934,8 @@ Foam::BlendedInterfacialModel::evaluate PtrList fSD(nPhases); calculateBlendingCoeffs ( - interface_.fluid().phases().template convert(), + interface_.fluid().phases() + .PtrList::convert(), fG, f1D2, f2D1, fS, fGD, f1D2D, f2D1D, fSD, subtract @@ -1038,7 +1039,8 @@ Foam::BlendedInterfacialModel::evaluate PtrList fSD(nPhases); calculateBlendingCoeffs ( - interface_.fluid().phases().template convert(), + interface_.fluid().phases() + .PtrList::convert(), fG, f1D2, f2D1, fS, fGD, f1D2D, f2D1D, fSD, subtract diff --git a/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.C b/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.C index d9621d48a3..243f9a2a0f 100644 --- a/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.C +++ b/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "PtrListDictionary.H" +#include "UPtrListDictionary.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -123,4 +124,24 @@ inline Foam::autoPtr Foam::PtrListDictionary::set } +template +template +Foam::UPtrListDictionary Foam::PtrListDictionary::convert() +{ + UPtrListDictionary result(this->size()); + + forAll(*this, i) + { + result.set + ( + i, + this->operator()(i)->keyword(), + dynamic_cast(this->operator()(i)) + ); + } + + return result; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.H b/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.H index 755c36112c..47cb3caf99 100644 --- a/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.H +++ b/src/OpenFOAM/containers/Dictionaries/PtrListDictionary/PtrListDictionary.H @@ -98,6 +98,13 @@ public: autoPtr set(const label, const word& key, tmp&); + // Conversion + + //- Convert to list of different pointer type + template + UPtrListDictionary convert(); + + // Member Operators using PtrList::operator[];