Commit 0680416b authored by Mark Olesen's avatar Mark Olesen
Browse files

COMP: tag lookupObjectPtr and lookupObjectRefPtr as deprecated

- were deprecated via comments (2018-10).
  Now mark with compilation warning
parent 0c163e40
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -60,7 +60,7 @@ SourceFiles
namespace Foam
{
// Forward declarations
// Forward Declarations
class objectRegistry;
namespace functionObjects
......@@ -206,6 +206,7 @@ public:
//- Deprecated(2018-10)
// \deprecated(2018-10) - use findObject() method
template<class ObjectType>
FOAM_DEPRECATED_FOR(2018-10, "findObject / cfindObject() methods")
const ObjectType* lookupObjectPtr(const word& fieldName) const
{
return this->cfindObject<ObjectType>(fieldName);
......@@ -214,6 +215,7 @@ public:
//- Deprecated(2018-10)
// \deprecated(2018-10) - use getObjectPtr() method
template<class ObjectType>
FOAM_DEPRECATED_FOR(2018-10, "getObjectPtr() method")
ObjectType* lookupObjectRefPtr(const word& fieldName) const
{
return this->getObjectPtr<ObjectType>(fieldName);
......
......@@ -537,6 +537,7 @@ public:
//- Deprecated(2018-10) find object
// \deprecated(2018-10) - use findObject() method
template<class Type>
FOAM_DEPRECATED_FOR(2018-10, "findObject / cfindObject() methods")
const Type* lookupObjectPtr
(
const word& name,
......@@ -549,6 +550,7 @@ public:
//- Deprecated(2018-10) get object pointer, ignoring constness
// \deprecated(2018-10) - use getObjectPtr() method
template<class Type>
FOAM_DEPRECATED_FOR(2018-10, "getObjectPtr() method")
Type* lookupObjectRefPtr
(
const word& name,
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -172,7 +172,7 @@ bool Foam::functionObjects::columnAverage::write()
{
const word resultName("columnAverage(" + fieldName + ")");
const regIOobject* obj =
obr_.lookupObjectPtr<regIOobject>(averageName(fieldName));
obr_.cfindObject<regIOobject>(averageName(fieldName));
if (obj)
{
......
......@@ -94,7 +94,7 @@ class columnAverage
:
public fvMeshFunctionObject
{
// Private data
// Private Data
//- Patches on which to collapse the fields
labelHashSet patchSet_;
......@@ -145,7 +145,7 @@ public:
// Member Functions
//- Read the settings
virtual bool read(const dictionary&);
virtual bool read(const dictionary& dict);
//- Execute, currently does nothing
virtual bool execute();
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -39,7 +39,7 @@ bool Foam::functionObjects::columnAverage::columnAverageField
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fieldType* fldPtr = lookupObjectPtr<fieldType>(fieldName);
const fieldType* fldPtr = cfindObject<fieldType>(fieldName);
if (fldPtr)
{
......@@ -47,9 +47,11 @@ bool Foam::functionObjects::columnAverage::columnAverageField
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
(
......@@ -61,10 +63,9 @@ bool Foam::functionObjects::columnAverage::columnAverageField
),
fld
);
obr_.objectRegistry::store(ptr);
obr_.objectRegistry::store(resPtr);
}
fieldType& res = obr_.lookupObjectRef<fieldType>(resultName);
fieldType& res = *resPtr;
const meshStructure& ms = meshAddressing(fld.mesh());
if (globalFaces_().empty())
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -101,7 +101,7 @@ bool Foam::functionObjects::continuityError::execute()
bool Foam::functionObjects::continuityError::write()
{
const auto phiPtr = mesh_.lookupObjectPtr<surfaceScalarField>(phiName_);
const auto* phiPtr = mesh_.cfindObject<surfaceScalarField>(phiName_);
if (!phiPtr)
{
......
......@@ -149,14 +149,12 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::devReff() const
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;
}
......
......@@ -263,7 +263,7 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::calcPressure
if (mode_ & ISENTROPIC)
{
const basicThermo* thermoPtr =
p.mesh().lookupObjectPtr<basicThermo>(basicThermo::dictName);
p.mesh().cfindObject<basicThermo>(basicThermo::dictName);
if (!thermoPtr)
{
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -174,7 +174,7 @@ bool Foam::functionObjects::writeDictionary::write()
forAll(dictNames_, dicti)
{
const IOdictionary* dictptr =
obr_.lookupObjectPtr<IOdictionary>(dictNames_[dicti]);
obr_.cfindObject<IOdictionary>(dictNames_[dicti]);
if (dictptr)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment