COMP: tag lookupObjectPtr and lookupObjectRefPtr as deprecated

- were deprecated via comments (2018-10).
  Now mark with compilation warning
This commit is contained in:
Mark Olesen
2020-05-01 16:42:55 +02:00
parent 0c163e40e5
commit 0680416b59
9 changed files with 28 additions and 25 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -60,7 +60,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward Declarations
class objectRegistry; class objectRegistry;
namespace functionObjects namespace functionObjects
@ -206,6 +206,7 @@ public:
//- Deprecated(2018-10) //- Deprecated(2018-10)
// \deprecated(2018-10) - use findObject() method // \deprecated(2018-10) - use findObject() method
template<class ObjectType> template<class ObjectType>
FOAM_DEPRECATED_FOR(2018-10, "findObject / cfindObject() methods")
const ObjectType* lookupObjectPtr(const word& fieldName) const const ObjectType* lookupObjectPtr(const word& fieldName) const
{ {
return this->cfindObject<ObjectType>(fieldName); return this->cfindObject<ObjectType>(fieldName);
@ -214,6 +215,7 @@ public:
//- Deprecated(2018-10) //- Deprecated(2018-10)
// \deprecated(2018-10) - use getObjectPtr() method // \deprecated(2018-10) - use getObjectPtr() method
template<class ObjectType> template<class ObjectType>
FOAM_DEPRECATED_FOR(2018-10, "getObjectPtr() method")
ObjectType* lookupObjectRefPtr(const word& fieldName) const ObjectType* lookupObjectRefPtr(const word& fieldName) const
{ {
return this->getObjectPtr<ObjectType>(fieldName); return this->getObjectPtr<ObjectType>(fieldName);

View File

@ -537,6 +537,7 @@ public:
//- Deprecated(2018-10) find object //- Deprecated(2018-10) find object
// \deprecated(2018-10) - use findObject() method // \deprecated(2018-10) - use findObject() method
template<class Type> template<class Type>
FOAM_DEPRECATED_FOR(2018-10, "findObject / cfindObject() methods")
const Type* lookupObjectPtr const Type* lookupObjectPtr
( (
const word& name, const word& name,
@ -549,6 +550,7 @@ public:
//- Deprecated(2018-10) get object pointer, ignoring constness //- Deprecated(2018-10) get object pointer, ignoring constness
// \deprecated(2018-10) - use getObjectPtr() method // \deprecated(2018-10) - use getObjectPtr() method
template<class Type> template<class Type>
FOAM_DEPRECATED_FOR(2018-10, "getObjectPtr() method")
Type* lookupObjectRefPtr Type* lookupObjectRefPtr
( (
const word& name, const word& name,

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -172,7 +172,7 @@ bool Foam::functionObjects::columnAverage::write()
{ {
const word resultName("columnAverage(" + fieldName + ")"); const word resultName("columnAverage(" + fieldName + ")");
const regIOobject* obj = const regIOobject* obj =
obr_.lookupObjectPtr<regIOobject>(averageName(fieldName)); obr_.cfindObject<regIOobject>(averageName(fieldName));
if (obj) if (obj)
{ {

View File

@ -94,7 +94,7 @@ class columnAverage
: :
public fvMeshFunctionObject public fvMeshFunctionObject
{ {
// Private data // Private Data
//- Patches on which to collapse the fields //- Patches on which to collapse the fields
labelHashSet patchSet_; labelHashSet patchSet_;
@ -145,7 +145,7 @@ public:
// Member Functions // Member Functions
//- Read the settings //- Read the settings
virtual bool read(const dictionary&); virtual bool read(const dictionary& dict);
//- Execute, currently does nothing //- Execute, currently does nothing
virtual bool execute(); virtual bool execute();

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -39,7 +39,7 @@ bool Foam::functionObjects::columnAverage::columnAverageField
{ {
typedef GeometricField<Type, fvPatchField, volMesh> fieldType; typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fieldType* fldPtr = lookupObjectPtr<fieldType>(fieldName); const fieldType* fldPtr = cfindObject<fieldType>(fieldName);
if (fldPtr) if (fldPtr)
{ {
@ -47,9 +47,11 @@ bool Foam::functionObjects::columnAverage::columnAverageField
const word resultName(averageName(fieldName)); const word resultName(averageName(fieldName));
if (!obr_.foundObject<fieldType>(resultName)) fieldType* resPtr = obr_.getObjectPtr<fieldType>(resultName);
if (!resPtr)
{ {
fieldType* ptr = new fieldType resPtr = new fieldType
( (
IOobject IOobject
( (
@ -61,10 +63,9 @@ bool Foam::functionObjects::columnAverage::columnAverageField
), ),
fld fld
); );
obr_.objectRegistry::store(ptr); obr_.objectRegistry::store(resPtr);
} }
fieldType& res = *resPtr;
fieldType& res = obr_.lookupObjectRef<fieldType>(resultName);
const meshStructure& ms = meshAddressing(fld.mesh()); const meshStructure& ms = meshAddressing(fld.mesh());
if (globalFaces_().empty()) if (globalFaces_().empty())

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -101,7 +101,7 @@ bool Foam::functionObjects::continuityError::execute()
bool Foam::functionObjects::continuityError::write() bool Foam::functionObjects::continuityError::write()
{ {
const auto phiPtr = mesh_.lookupObjectPtr<surfaceScalarField>(phiName_); const auto* phiPtr = mesh_.cfindObject<surfaceScalarField>(phiName_);
if (!phiPtr) if (!phiPtr)
{ {

View File

@ -149,14 +149,12 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::devReff() const
return -nu*dev(twoSymm(fvc::grad(U))); return -nu*dev(twoSymm(fvc::grad(U)));
} }
else
{
FatalErrorInFunction
<< "No valid model for viscous stress calculation"
<< exit(FatalError);
return volSymmTensorField::null(); FatalErrorInFunction
} << "No valid model for viscous stress calculation"
<< exit(FatalError);
return nullptr;
} }

View File

@ -263,7 +263,7 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::calcPressure
if (mode_ & ISENTROPIC) if (mode_ & ISENTROPIC)
{ {
const basicThermo* thermoPtr = const basicThermo* thermoPtr =
p.mesh().lookupObjectPtr<basicThermo>(basicThermo::dictName); p.mesh().cfindObject<basicThermo>(basicThermo::dictName);
if (!thermoPtr) if (!thermoPtr)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -174,7 +174,7 @@ bool Foam::functionObjects::writeDictionary::write()
forAll(dictNames_, dicti) forAll(dictNames_, dicti)
{ {
const IOdictionary* dictptr = const IOdictionary* dictptr =
obr_.lookupObjectPtr<IOdictionary>(dictNames_[dicti]); obr_.cfindObject<IOdictionary>(dictNames_[dicti]);
if (dictptr) if (dictptr)
{ {