STYLE: noexcept for nullObject functions

STYLE: use nullObject for return values of NotImplemented

STYLE: shallowCopy(nullptr) shortcut
This commit is contained in:
Mark Olesen
2024-01-25 10:02:52 +01:00
parent 0bf39691ff
commit 182afc27ba
54 changed files with 170 additions and 224 deletions

View File

@ -135,14 +135,14 @@ public:
virtual volScalarField& he()
{
NotImplemented;
return thermo1_->he();
return const_cast<volScalarField&>(volScalarField::null());
}
//- Enthalpy/Internal energy [J/kg]
virtual const volScalarField& he() const
{
NotImplemented;
return thermo1_->he();
return volScalarField::null();
}
//- Enthalpy/Internal energy
@ -213,7 +213,7 @@ public:
) const
{
NotImplemented;
return tmp<scalarField>::New(p);
return nullptr;
}
//- Heat capacity at constant volume [J/kg/K]
@ -236,7 +236,7 @@ public:
) const
{
NotImplemented;
return tmp<scalarField>::New(p);
return nullptr;
}
//- Gamma = Cp/Cv []

View File

@ -243,14 +243,14 @@ public:
virtual volScalarField& he()
{
NotImplemented;
return phases_[0].thermo().he();
return const_cast<volScalarField&>(volScalarField::null());
}
//- Enthalpy/Internal energy [J/kg]
virtual const volScalarField& he() const
{
NotImplemented;
return phases_[0].thermo().he();
return volScalarField::null();
}
//- Enthalpy/Internal energy
@ -327,7 +327,7 @@ public:
) const
{
NotImplemented;
return tmp<scalarField>::New(p);
return nullptr;
}
//- Heat capacity at constant volume [J/kg/K]
@ -350,7 +350,7 @@ public:
) const
{
NotImplemented;
return tmp<scalarField>::New(p);
return nullptr;
}
//- Gamma = Cp/Cv []

View File

@ -86,14 +86,14 @@ public:
virtual volScalarField& he()
{
NotImplemented;
return p();
return const_cast<volScalarField&>(volScalarField::null());
}
//- Return access to the internal energy field [J/Kg]
virtual const volScalarField& he() const
{
NotImplemented;
return p();
return volScalarField::null();
}
//- Enthalpy/Internal energy
@ -182,7 +182,7 @@ public:
) const
{
NotImplemented;
return tmp<scalarField>::New(p);
return nullptr;
}
//- Return Cv of the mixture
@ -205,7 +205,7 @@ public:
) const
{
NotImplemented;
return tmp<scalarField>::New(p);
return nullptr;
}
//- Gamma = Cp/Cv []

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,7 +48,7 @@ class SimpleClass
public:
//- Default construct
SimpleClass() {}
SimpleClass() = default;
};
@ -73,9 +73,8 @@ void printInfo(const UList<T>& list)
int main()
{
// Test pointer and reference to a class
SimpleClass* ptrToClass = new SimpleClass;
SimpleClass& refToClass(*ptrToClass);
auto ptrToClass = autoPtr<SimpleClass>::New();
auto& refToClass = ptrToClass.ref();
std::cout
<< "nullObject addr=" << name(&(nullObjectPtr)) << nl
@ -89,13 +88,13 @@ int main()
<< " pointer:" << name(nullObjectPtr->pointer()) << nl
<< " value:" << nullObjectPtr->value() << nl << nl;
if (notNull(ptrToClass))
if (notNull(ptrToClass.get()))
{
Info<< "Pass: ptrToClass is not null" << nl;
}
else
{
Info<< "FAIL: refToClass is null" << nl;
Info<< "FAIL: ptrToClass is null" << nl;
}
if (notNull(refToClass))
@ -110,8 +109,8 @@ int main()
// Test pointer and reference to the nullObject
const SimpleClass* ptrToNull(NullObjectPtr<SimpleClass>());
const SimpleClass& refToNull(*ptrToNull);
const SimpleClass* ptrToNull = NullObjectPtr<SimpleClass>();
const SimpleClass& refToNull = (*ptrToNull);
if (isNull(ptrToNull))
{
@ -131,9 +130,6 @@ int main()
Info<< "FAIL: refToNull is not null" << nl;
}
// Clean-up
delete ptrToClass;
// Test List casting
{
@ -152,7 +148,7 @@ int main()
// Looks pretty ugly though!
NullObject::nullObject = "hello world";
NullObject::nullObject = labelList({1, 2, 3});
NullObject::nullObject = Foam::identity(5);
Info<< nl;

View File

@ -120,8 +120,11 @@ public:
// Static Member Functions
//- Return a null bitSet reference
inline static const bitSet& null();
//- Return a null bitSet (reference to a nullObject).
static const bitSet& null() noexcept
{
return NullObjectRef<bitSet>();
}
//- Declare type-name (with debug switch)

View File

@ -405,12 +405,6 @@ inline Foam::label Foam::bitSet::find_next(label pos) const
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::bitSet& Foam::bitSet::null()
{
return NullObjectRef<bitSet>();
}
inline bool Foam::bitSet::all() const
{
if (empty()) return true; // SIC. boost convention

View File

@ -138,8 +138,11 @@ public:
// Static Member Functions
//- Return a CompactListList reference to a nullObject
inline static const CompactListList<T>& null();
//- Return a null CompactListList (reference to a nullObject).
static const CompactListList<T>& null() noexcept
{
return NullObjectRef<CompactListList<T>>();
}
//- Construct by packing together the list of lists
template<class SubListType = List<T>>

View File

@ -29,15 +29,6 @@ License
#include "ListOps.H"
#include "SubList.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
template<class T>
inline const Foam::CompactListList<T>& Foam::CompactListList<T>::null()
{
return NullObjectRef<CompactListList<T>>();
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class T>

View File

@ -46,9 +46,10 @@ SourceFiles
#include "zero.H"
#include "contiguous.H"
#include "stdFoam.H"
#include "autoPtr.H"
#include "nullObject.H"
#include "Hash.H"
#include "ListPolicy.H"
#include "autoPtr.H"
// <algorithm> already included by stdFoam.H
#include <iterator>
@ -139,8 +140,12 @@ public:
// Static Functions
//- Return a null FixedList
inline static const FixedList<T, N>& null();
//- Return a null FixedList (reference to a nullObject).
//- Read/write access is questionable
static const FixedList<T, N>& null() noexcept
{
return NullObjectRef<FixedList<T, N>>();
}
// Constructors

View File

@ -28,15 +28,6 @@ License
#include "UList.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
template<class T, unsigned N>
inline const Foam::FixedList<T, N>& Foam::FixedList<T, N>::null()
{
return NullObjectRef<FixedList<T, N>>();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class T, unsigned N>

View File

@ -129,8 +129,12 @@ public:
// Static Member Functions
//- Return a null List
inline static const List<T>& null();
//- Return a null List (reference to a nullObject).
//- Behaves like an empty List.
static const List<T>& null() noexcept
{
return NullObjectRef<List<T>>();
}
// Constructors

View File

@ -133,13 +133,6 @@ inline Foam::autoPtr<Foam::List<T>> Foam::List<T>::clone() const
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T>
inline const Foam::List<T>& Foam::List<T>::null()
{
return NullObjectRef<List<T>>();
}
template<class T>
inline void Foam::List<T>::clear()
{

View File

@ -73,8 +73,12 @@ public:
// Static Functions
//- Return a null SubList
inline static const SubList<T>& null();
//- Return a null SubList (reference to a nullObject).
//- Behaves like an empty SubList.
static const SubList<T>& null() noexcept
{
return NullObjectRef<SubList<T>>();
}
// Generated Methods

View File

@ -28,15 +28,6 @@ License
#include "FixedList.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
template<class T>
inline const Foam::SubList<T>& Foam::SubList<T>::null()
{
return NullObjectRef<SubList<T>>();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class T>
@ -124,7 +115,7 @@ inline Foam::SubList<T>::SubList
template<class T>
inline Foam::UList<T>& Foam::SubList<T>::reset(std::nullptr_t) noexcept
{
UList<T>::shallowCopy(nullptr, 0);
UList<T>::shallowCopy(nullptr);
return *this;
}

View File

@ -183,8 +183,12 @@ public:
// Static Functions
//- Return a UList reference to a nullObject
inline static const UList<T>& null();
//- Return a null UList (reference to a nullObject).
//- Behaves like an empty UList.
static const UList<T>& null() noexcept
{
return NullObjectRef<UList<T>>();
}
// Public Classes
@ -367,6 +371,9 @@ public:
//- Copy the pointer and size
inline void shallowCopy(T* __restrict__ ptr, const label len) noexcept;
//- Copy nullptr and zero size
inline void shallowCopy(std::nullptr_t) noexcept;
//- Copy the pointer and size held by the given UList
inline void shallowCopy(const UList<T>& list) noexcept;

View File

@ -93,13 +93,6 @@ inline void Foam::UList<T>::fill_uniform(const Foam::zero)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T>
inline const Foam::UList<T>& Foam::UList<T>::null()
{
return NullObjectRef<UList<T>>();
}
template<class T>
inline Foam::label Foam::UList<T>::fcIndex(const label i) const noexcept
{
@ -330,6 +323,14 @@ inline void Foam::UList<T>::shallowCopy
}
template<class T>
inline void Foam::UList<T>::shallowCopy(std::nullptr_t) noexcept
{
size_ = 0;
v_ = nullptr;
}
template<class T>
inline void Foam::UList<T>::shallowCopy(const UList<T>& list) noexcept
{

View File

@ -116,7 +116,7 @@ Foam::labelListList Foam::invertOneToMany
const labelUList& map
)
{
labelList sizes(len, Zero);
labelList sizes(len, Foam::zero{});
for (const label newIdx : map)
{

View File

@ -707,7 +707,7 @@ void Foam::invertManyToMany
)
{
// The output list sizes
labelList sizes(len, Zero);
labelList sizes(len, Foam::zero{});
for (const InputIntListType& sublist : input)
{

View File

@ -115,7 +115,7 @@ Type Foam::Function1Types::Function1Expression<Type>::integrate
) const
{
NotImplemented;
return Zero;
return Type();
}

View File

@ -137,8 +137,11 @@ public:
// Static Member Functions
//- Return a NullObjectRef DimensionedField
inline static const DimensionedField<Type, GeoMesh>& null();
//- Return a null DimensionedField (reference to a nullObject).
static const DimensionedField<Type, GeoMesh>& null() noexcept
{
return NullObjectRef<DimensionedField<Type, GeoMesh>>();
}
// Constructors

View File

@ -28,14 +28,6 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type, class GeoMesh>
inline const Foam::DimensionedField<Type, GeoMesh>&
Foam::DimensionedField<Type, GeoMesh>::null()
{
return NullObjectRef<DimensionedField<Type, GeoMesh>>();
}
template<class Type, class GeoMesh>
inline const typename GeoMesh::Mesh&
Foam::DimensionedField<Type, GeoMesh>::mesh() const noexcept

View File

@ -85,7 +85,7 @@ public:
~SlicedDimensionedField()
{
// Set internalField to nullptr to avoid deletion of underlying field
UList<Type>::shallowCopy(UList<Type>());
UList<Type>::shallowCopy(nullptr);
}
};

View File

@ -97,8 +97,8 @@ public:
// Static Member Functions
//- Return a null field
inline static const DynamicField<T, SizeMin>& null()
//- Return a null DynamicField (reference to a nullObject).
static const DynamicField<T, SizeMin>& null() noexcept
{
return NullObjectRef<DynamicField<T, SizeMin>>();
}

View File

@ -122,8 +122,12 @@ public:
// Static Member Functions
//- Return nullObject reference Field
inline static const Field<Type>& null();
//- Return a null Field (reference to a nullObject).
//- Behaves like an empty Field.
static const Field<Type>& null() noexcept
{
return NullObjectRef<Field<Type>>();
}
// Constructors

View File

@ -25,15 +25,6 @@ License
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
template<class Type>
inline const Foam::Field<Type>& Foam::Field<Type>::null()
{
return NullObjectRef<Field<Type>>();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>

View File

@ -69,8 +69,12 @@ public:
// Static Member Functions
//- Return nullObject reference SubField
inline static const SubField<Type>& null();
//- Return a null SubField (reference to a nullObject).
//- Behaves like an empty SubField.
static const SubField<Type>& null() noexcept
{
return NullObjectRef<SubField<Type>>();
}
// Constructors

View File

@ -26,15 +26,6 @@ License
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
template<class Type>
inline const Foam::SubField<Type>& Foam::SubField<Type>::null()
{
return NullObjectRef<SubField<Type>>();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>

View File

@ -154,8 +154,11 @@ public:
// Static Member Functions
//- Return a null geometric field
inline static const GeometricField<Type, PatchField, GeoMesh>& null();
//- Return a null GeometricField (reference to a nullObject).
static const GeometricField<Type, PatchField, GeoMesh>& null() noexcept
{
return NullObjectRef<GeometricField<Type, PatchField, GeoMesh>>();
}
// Constructors

View File

@ -28,14 +28,6 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type, template<class> class PatchField, class GeoMesh>
inline const Foam::GeometricField<Type, PatchField, GeoMesh>&
Foam::GeometricField<Type, PatchField, GeoMesh>::null()
{
return NullObjectRef<GeometricField<Type, PatchField, GeoMesh>>();
}
template<class Type, template<class> class PatchField, class GeoMesh>
inline const typename
Foam::GeometricField<Type, PatchField, GeoMesh>::Internal&

View File

@ -368,7 +368,7 @@ Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
~SlicedGeometricField()
{
// Set internalField to nullptr to avoid deletion of underlying field
UList<Type>::shallowCopy(UList<Type>());
UList<Type>::shallowCopy(nullptr);
}

View File

@ -114,8 +114,12 @@ public:
// Static Member Functions
//- Return a null Matrix
inline static const Matrix<Form, Type>& null();
//- Return a null Matrix (reference to a nullObject).
//- Behaves like a empty Matrix.
static const Matrix<Form, Type>& null() noexcept
{
return NullObjectRef<Matrix<Form, Type>>();
}
// Iterators

View File

@ -85,13 +85,6 @@ Foam::Matrix<Form, Type>::clone() const
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Form, class Type>
inline const Foam::Matrix<Form, Type>& Foam::Matrix<Form, Type>::null()
{
return NullObjectRef<Matrix<Form, Type>>();
}
template<class Form, class Type>
inline Foam::label Foam::Matrix<Form, Type>::size() const
{

View File

@ -102,7 +102,7 @@ public:
) const
{
NotImplemented;
return autoPtr<GAMGInterfaceField>(nullptr);
return nullptr;
}

View File

@ -42,8 +42,7 @@ namespace Foam
const Foam::objectRegistry& Foam::lduMesh::thisDb() const
{
NotImplemented;
const objectRegistry* orPtr_ = nullptr;
return *orPtr_;
return NullObjectRef<objectRegistry>();
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014 OpenFOAM Foundation
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -158,7 +158,7 @@ extern const NullObject* nullObjectPtr;
// IOstream Operators
//- Read from Istream consumes no content
//- Read from Istream consumes no content, does not change NullObject
inline Istream& operator>>(Istream& is, const NullObject&) noexcept
{
return is;
@ -173,31 +173,48 @@ inline Ostream& operator<<(Ostream& os, const NullObject&) noexcept
// Global Functions
//- Pointer (of type T) to the nullObject
//- Const pointer (of type T) to the nullObject
template<class T>
inline const T* NullObjectPtr()
inline const T* NullObjectPtr() noexcept
{
return reinterpret_cast<const T*>(nullObjectPtr);
}
//- Reference (of type T) to the nullObject
//- Non-const pointer (of type T) to the nullObject.
//- Only use when nothing will be written into it!
template<class T>
inline const T& NullObjectRef()
inline T* NullObjectPtr_constCast() noexcept
{
return reinterpret_cast<T*>(const_cast<NullObject*>(nullObjectPtr));
}
//- Const reference (of type T) to the nullObject
template<class T>
inline const T& NullObjectRef() noexcept
{
return *reinterpret_cast<const T*>(nullObjectPtr);
}
//- Non-const reference (of type T) to the nullObject
//- Only use when nothing will be written into it!
template<class T>
inline T& NullObjectRef_constCast() noexcept
{
return *reinterpret_cast<T*>(const_cast<NullObject*>(nullObjectPtr));
}
//- True if ptr is a pointer (of type T) to the nullObject
template<class T>
inline bool isNull(const T* ptr)
inline bool isNull(const T* ptr) noexcept
{
return ptr == NullObjectPtr<T>();
}
//- True if obj is a reference (of type T) to the nullObject
template<class T>
inline bool isNull(const T& obj)
inline bool isNull(const T& obj) noexcept
{
return &obj == NullObjectPtr<T>();
}
@ -205,14 +222,14 @@ inline bool isNull(const T& obj)
//- True if ptr is not a pointer (of type T) to the nullObject
template<class T>
inline bool notNull(const T* ptr)
inline bool notNull(const T* ptr) noexcept
{
return ptr != NullObjectPtr<T>();
}
//- True if obj is not a reference (of type T) to the nullObject
template<class T>
inline bool notNull(const T& obj)
inline bool notNull(const T& obj) noexcept
{
return &obj != NullObjectPtr<T>();
}

View File

@ -86,8 +86,12 @@ public:
// Static Data / Methods
//- Return a null wordRes - a reference to the NullObject
inline static const wordRes& null();
//- Return a null wordRes (reference to a nullObject).
//- Behaves like a empty wordRes.
static const wordRes& null() noexcept
{
return NullObjectRef<wordRes>();
}
//- Return a wordRes with duplicate entries filtered out.
// No distinction made between literals and regular expressions.

View File

@ -27,12 +27,6 @@ License
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
inline const Foam::wordRes& Foam::wordRes::null()
{
return NullObjectRef<wordRes>();
}
inline Foam::label Foam::wordRes::first_match
(
const UList<wordRe>& selectors,

View File

@ -92,7 +92,7 @@ public:
// Static Functions
//- Return a null ensightFile
static const ensightFile& null()
static const ensightFile& null() noexcept
{
return NullObjectRef<ensightFile>();
}

View File

@ -72,7 +72,7 @@ public:
// Static Functions
//- Return a null ensightGeoFile
static const ensightGeoFile& null()
static const ensightGeoFile& null() noexcept
{
return NullObjectRef<ensightGeoFile>();
}

View File

@ -127,7 +127,7 @@ template<class Type>
Foam::slicedFaPatchField<Type>::~slicedFaPatchField()
{
// Set to nullptr to avoid deletion of underlying field
UList<Type>::shallowCopy(UList<Type>());
UList<Type>::shallowCopy(nullptr);
}

View File

@ -127,7 +127,7 @@ template<class Type>
Foam::slicedFaePatchField<Type>::~slicedFaePatchField()
{
// Set to nullptr to avoid deletion of underlying field
UList<Type>::shallowCopy(UList<Type>());
UList<Type>::shallowCopy(nullptr);
}

View File

@ -127,7 +127,7 @@ template<class Type>
Foam::slicedFvPatchField<Type>::~slicedFvPatchField()
{
// Set to nullptr to avoid deletion of underlying field
UList<Type>::shallowCopy(UList<Type>());
UList<Type>::shallowCopy(nullptr);
}

View File

@ -127,7 +127,7 @@ template<class Type>
Foam::slicedFvsPatchField<Type>::~slicedFvsPatchField()
{
// Set to nullptr to avoid deletion of underlying field
UList<Type>::shallowCopy(UList<Type>());
UList<Type>::shallowCopy(nullptr);
}

View File

@ -96,11 +96,7 @@ tmp<GeometricField<Type, fvPatchField, volMesh>> ddtScheme<Type>::fvcDdt
)
{
NotImplemented;
return tmp<GeometricField<Type, fvPatchField, volMesh>>
(
GeometricField<Type, fvPatchField, volMesh>::null()
);
return nullptr;
}
@ -113,13 +109,7 @@ tmp<fvMatrix<Type>> ddtScheme<Type>::fvmDdt
)
{
NotImplemented;
return tmp<fvMatrix<Type>>::New
(
vf,
alpha.dimensions()*rho.dimensions()
*vf.dimensions()*dimVol/dimTime
);
return nullptr;
}
@ -130,15 +120,10 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> ddtScheme<Type>::fvcDdt
)
{
NotImplemented;
return tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
(
GeometricField<Type, fvsPatchField, surfaceMesh>::null()
);
return nullptr;
}
template<class Type>
tmp<surfaceScalarField> ddtScheme<Type>::fvcDdtPhiCoeff
(

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2023 OpenCFD Ltd.
Copyright (C) 2016-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -894,13 +894,13 @@ void Foam::fvMatrix<Type>::transferFvMatrixCoeffs()
template<class Type>
Foam::lduPrimitiveMeshAssembly* Foam::fvMatrix<Type>::lduMeshPtr()
{
const lduPrimitiveMeshAssembly* lduAssemMeshPtr =
psi_.mesh().thisDb().objectRegistry::template findObject
return
(
psi_.mesh().thisDb().objectRegistry::template getObjectPtr
<
lduPrimitiveMeshAssembly
> (lduAssemblyName_);
return const_cast<lduPrimitiveMeshAssembly*>(lduAssemMeshPtr);
> (lduAssemblyName_)
);
}

View File

@ -106,12 +106,6 @@ bool Foam::PDRblock::checkMonotonic
}
const Foam::PDRblock& Foam::PDRblock::null()
{
return NullObjectRef<PDRblock>();
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::PDRblock::addDefaultPatches()

View File

@ -429,8 +429,11 @@ public:
// Static Member Functions
//- Return a PDRblock reference to a nullObject
static const PDRblock& null();
//- Return a null PDRblock (reference to a nullObject).
static const PDRblock& null() noexcept
{
return NullObjectRef<PDRblock>();
}
// Constructors

View File

@ -144,7 +144,7 @@ tmp<fvPatchScalarField>
boundaryAdjointContribution::turbulentDiffusivity() const
{
NotImplemented;
return tmp<fvPatchScalarField>(nullptr);
return nullptr;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -133,7 +133,7 @@ public:
) const
{
NotImplemented;
return autoPtr<GAMGInterfaceField>(nullptr);
return nullptr;
}

View File

@ -105,7 +105,7 @@ public:
) const
{
NotImplemented;
return autoPtr<GAMGInterfaceField>(nullptr);
return nullptr;
}

View File

@ -367,7 +367,7 @@ public:
) const
{
NotImplemented;
return tmp<scalarField>::New(p);
return nullptr;
}
//- Return Cv of the mixture

View File

@ -88,7 +88,7 @@ Foam::PurePhaseModel<BasePhaseModel>::Y(const word& name) const
<< "Cannot get a species fraction by name from a pure phase"
<< exit(FatalError);
return NullObjectRef<volScalarField>();
return volScalarField::null();
}

View File

@ -59,7 +59,7 @@ const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::basicSolidChemistryModel::RR(const label i) const
{
NotImplemented;
return (volScalarField::Internal::null());
return volScalarField::Internal::null();
}
@ -67,13 +67,10 @@ Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::basicSolidChemistryModel::RR(const label i)
{
NotImplemented;
return dynamic_cast<volScalarField::Internal&>
(
return
const_cast<volScalarField::Internal&>
(
volScalarField::Internal::null()
)
);
}
@ -86,14 +83,7 @@ Foam::basicSolidChemistryModel::calculateRR
) const
{
NotImplemented;
return dynamic_cast<tmp<volScalarField::Internal>&>
(
const_cast<volScalarField::Internal&>
(
volScalarField::Internal::null()
)
);
return nullptr;
}

View File

@ -441,7 +441,7 @@ const Foam::List<typename Foam::Reaction<ReactionThermo>::specieCoeffs>&
Foam::Reaction<ReactionThermo>::glhs() const
{
NotImplemented;
return NullObjectRef<List<specieCoeffs>>();
return List<specieCoeffs>::null();
}
@ -450,7 +450,7 @@ const Foam::List<typename Foam::Reaction<ReactionThermo>::specieCoeffs>&
Foam::Reaction<ReactionThermo>::grhs() const
{
NotImplemented;
return NullObjectRef<List<specieCoeffs>>();
return List<specieCoeffs>::null();
}