diff --git a/src/OpenFOAM/memory/autoPtr/autoPtr.H b/src/OpenFOAM/memory/autoPtr/autoPtr.H index 7732ecc1cf..0d5944128e 100644 --- a/src/OpenFOAM/memory/autoPtr/autoPtr.H +++ b/src/OpenFOAM/memory/autoPtr/autoPtr.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -67,6 +67,10 @@ public: // setting the arguments pointer to NULL inline autoPtr(const autoPtr&); + //- Construct either by transfering pointer or cloning. Should + // only be called with type that supports cloning. + inline autoPtr(const autoPtr&, const bool reUse); + //- Destructor, delete object if pointer is not NULL inline ~autoPtr(); diff --git a/src/OpenFOAM/memory/autoPtr/autoPtrI.H b/src/OpenFOAM/memory/autoPtr/autoPtrI.H index df7ea51d1a..55e032fcd4 100644 --- a/src/OpenFOAM/memory/autoPtr/autoPtrI.H +++ b/src/OpenFOAM/memory/autoPtr/autoPtrI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "error.H" +#include // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -43,6 +44,21 @@ inline Foam::autoPtr::autoPtr(const autoPtr& ap) } +template +inline Foam::autoPtr::autoPtr(const autoPtr& ap, const bool reUse) +{ + if (reUse) + { + ptr_ = ap.ptr_; + ap.ptr_ = 0; + } + else + { + ptr_ = ap().clone().ptr(); + } +} + + template inline Foam::autoPtr::~autoPtr() { @@ -81,7 +97,8 @@ inline void Foam::autoPtr::set(T* p) if (ptr_) { FatalErrorIn("void Foam::autoPtr::set(T*)") - << "object already allocated" + << "object of type " << typeid(T).name() + << " already allocated" << abort(FatalError); } @@ -116,7 +133,8 @@ inline T& Foam::autoPtr::operator()() if (!ptr_) { FatalErrorIn("T& Foam::autoPtr::operator()()") - << "object is not allocated" + << "object of type " << typeid(T).name() + << " is not allocated" << abort(FatalError); } @@ -130,7 +148,8 @@ inline const T& Foam::autoPtr::operator()() const if (!ptr_) { FatalErrorIn("const T& Foam::autoPtr::operator()() const") - << "object is not allocated" + << "object of type " << typeid(T).name() + << " is not allocated" << abort(FatalError); } @@ -151,7 +170,8 @@ inline T* Foam::autoPtr::operator->() if (!ptr_) { FatalErrorIn("Foam::autoPtr::operator->()") - << "object is not allocated" + << "object of type " << typeid(T).name() + << " is not allocated" << abort(FatalError); } diff --git a/src/OpenFOAM/memory/tmp/tmpI.H b/src/OpenFOAM/memory/tmp/tmpI.H index c3a51f3564..ad34bb4b17 100644 --- a/src/OpenFOAM/memory/tmp/tmpI.H +++ b/src/OpenFOAM/memory/tmp/tmpI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "error.H" +#include // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -62,6 +63,7 @@ inline Foam::tmp::tmp(const tmp& t) { FatalErrorIn("Foam::tmp::tmp(const tmp&)") << "attempted copy of a deallocated temporary" + << " of type " << typeid(T).name() << abort(FatalError); } } @@ -93,6 +95,7 @@ inline Foam::tmp::tmp(const tmp& t, bool allowTransfer) ( "Foam::tmp::tmp(const tmp&, bool allowTransfer)" ) << "attempted copy of a deallocated temporary" + << " of type " << typeid(T).name() << abort(FatalError); } } @@ -149,7 +152,7 @@ inline T* Foam::tmp::ptr() const if (!ptr_) { FatalErrorIn("Foam::tmp::ptr() const") - << "temporary deallocated" + << "temporary of type " << typeid(T).name() << " deallocated" << abort(FatalError); } @@ -188,7 +191,7 @@ inline T& Foam::tmp::operator()() if (!ptr_) { FatalErrorIn("T& Foam::tmp::operator()()") - << "temporary deallocated" + << "temporary of type " << typeid(T).name() << " deallocated" << abort(FatalError); } @@ -217,7 +220,7 @@ inline const T& Foam::tmp::operator()() const if (!ptr_) { FatalErrorIn("const T& Foam::tmp::operator()() const") - << "temporary deallocated" + << "temporary of type " << typeid(T).name() << " deallocated" << abort(FatalError); } @@ -245,7 +248,7 @@ inline T* Foam::tmp::operator->() if (!ptr_) { FatalErrorIn("Foam::tmp::operator->()") - << "temporary deallocated" + << "temporary of type " << typeid(T).name() << " deallocated" << abort(FatalError); } @@ -294,6 +297,7 @@ inline void Foam::tmp::operator=(const tmp& t) { FatalErrorIn("Foam::tmp::operator=(const tmp&)") << "attempted copy of a deallocated temporary" + << " of type " << typeid(T).name() << abort(FatalError); } } @@ -301,6 +305,7 @@ inline void Foam::tmp::operator=(const tmp& t) { FatalErrorIn("Foam::tmp::operator=(const tmp&)") << "attempted to assign to a const reference to constant object" + << " of type " << typeid(T).name() << abort(FatalError); } } diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H index 659a315f49..0905176adf 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,7 @@ License #include "thermoSingleLayer.H" #include "heatTransferModel.H" +#include "filmRadiationModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //