diff --git a/README.org b/README.org index b6b3bfb9d0..2265e40f64 100644 --- a/README.org +++ b/README.org @@ -2,7 +2,7 @@ # #+TITLE: OpenFOAM README for version dev #+AUTHOR: The OpenFOAM Foundation -#+DATE: 14th December 2014 +#+DATE: 16th December 2014 #+LINK: http://www.openfoam.org #+OPTIONS: author:nil ^:{} # Copyright (c) 2014 OpenFOAM Foundation. diff --git a/applications/test/nullObject/Make/files b/applications/test/nullObject/Make/files new file mode 100644 index 0000000000..596014a446 --- /dev/null +++ b/applications/test/nullObject/Make/files @@ -0,0 +1,3 @@ +Test-nullObject.C + +EXE = $(FOAM_USER_APPBIN)/nullObject diff --git a/applications/test/nullObject/Make/options b/applications/test/nullObject/Make/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/test/nullObject/Test-nullObject.C b/applications/test/nullObject/Test-nullObject.C new file mode 100644 index 0000000000..9b43405f45 --- /dev/null +++ b/applications/test/nullObject/Test-nullObject.C @@ -0,0 +1,70 @@ +#include "nullObject.H" +#include "IOstreams.H" + +using namespace Foam; + +class SimpleClass +{ + +public: + + //- Null constructor + SimpleClass() + {} +}; + + +int main() +{ + // Test pointer and reference to a class + + SimpleClass* ptrToClass = new SimpleClass; + SimpleClass& refToClass(*ptrToClass); + + if (notNull(ptrToClass)) + { + Info<< "Pass: ptrToClass is not null" << endl; + } + else + { + Info<< "FAIL: refToClass is null" << endl; + } + + if (notNull(refToClass)) + { + Info<< "Pass: refToClass is not null" << endl; + } + else + { + Info<< "FAIL: refToClass is null" << endl; + } + + + // Test pointer and reference to the nullObject + + const SimpleClass* ptrToNull(NullObjectPtr()); + const SimpleClass& refToNull(*ptrToNull); + + if (isNull(ptrToNull)) + { + Info<< "Pass: ptrToNull is null" << endl; + } + else + { + Info<< "FAIL: ptrToNull is not null" << endl; + } + + if (isNull(refToNull)) + { + Info<< "Pass: refToNull is null" << endl; + } + else + { + Info<< "FAIL: refToNull is not null" << endl; + } + + // Clean-up + delete ptrToClass; + + return 0; +} diff --git a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C index e5c928e298..df51f0b8de 100644 --- a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C +++ b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -360,7 +360,6 @@ void calcFeaturePoints(const pointField& points, const edgeList& edges) const labelListList& pointEdges = eMesh.pointEdges(); - // Get total number of feature points label nFeaturePoints = 0; forAll(pointEdges, pI) @@ -390,19 +389,6 @@ void calcFeaturePoints(const pointField& points, const edgeList& edges) nFeatPts++; } } - - - - label concaveStart = 0; - label mixedStart = 0; - label nonFeatureStart = nFeaturePoints; - - - labelListList featurePointNormals(nFeaturePoints); - labelListList featurePointEdges(nFeaturePoints); - labelList regionEdges; - - } diff --git a/etc/config/settings.csh b/etc/config/settings.csh index 910e03597b..26be1f389e 100644 --- a/etc/config/settings.csh +++ b/etc/config/settings.csh @@ -235,7 +235,7 @@ case ThirdParty: # using clang - not gcc setenv WM_CC 'clang' setenv WM_CXX 'clang++' - set clang_version=llvm-3.4.2 + set clang_version=llvm-3.5.0 breaksw default: echo diff --git a/etc/config/settings.sh b/etc/config/settings.sh index ec3486485b..92d7a72a43 100644 --- a/etc/config/settings.sh +++ b/etc/config/settings.sh @@ -256,7 +256,7 @@ OpenFOAM | ThirdParty) # using clang - not gcc export WM_CC='clang' export WM_CXX='clang++' - clang_version=llvm-3.4.2 + clang_version=llvm-3.5.0 ;; *) echo 1>&2 diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index d611ff0e53..7f3f5f82c6 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -104,7 +104,6 @@ $(ranges)/labelRange/labelRanges.C $(ranges)/scalarRange/scalarRange.C $(ranges)/scalarRange/scalarRanges.C - containers/HashTables/HashTable/HashTableCore.C containers/HashTables/StaticHashTable/StaticHashTableCore.C containers/Lists/SortableList/ParSortableListName.C diff --git a/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H b/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H index f133ed0ee5..346aba37c8 100644 --- a/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H +++ b/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,7 +79,7 @@ template inline const Foam::CompactListList& Foam::CompactListList::null() { - return *reinterpret_cast< CompactListList* >(0); + return NullObjectRef >(); } diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H index 653831938d..6a014d660a 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,7 +107,7 @@ Foam::FixedList::clone() const template inline const Foam::FixedList& Foam::FixedList::null() { - return *reinterpret_cast< FixedList* >(0); + return NullObjectRef >(); } diff --git a/src/OpenFOAM/containers/Lists/List/ListI.H b/src/OpenFOAM/containers/Lists/List/ListI.H index 26c65bd38c..1220116913 100644 --- a/src/OpenFOAM/containers/Lists/List/ListI.H +++ b/src/OpenFOAM/containers/Lists/List/ListI.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,7 +42,7 @@ inline Foam::autoPtr > Foam::List::clone() const template inline const Foam::List& Foam::List::null() { - return *reinterpret_cast< List* >(0); + return NullObjectRef >(); } diff --git a/src/OpenFOAM/containers/Lists/SubList/SubListI.H b/src/OpenFOAM/containers/Lists/SubList/SubListI.H index 36fc5a4af2..98a4191865 100644 --- a/src/OpenFOAM/containers/Lists/SubList/SubListI.H +++ b/src/OpenFOAM/containers/Lists/SubList/SubListI.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -74,7 +74,7 @@ inline Foam::SubList::SubList template inline const Foam::SubList& Foam::SubList::null() { - return *reinterpret_cast< SubList* >(0); + return NullObjectRef >(); } diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H index f61d6df749..0fe01c9015 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.H +++ b/src/OpenFOAM/containers/Lists/UList/UList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,6 +45,7 @@ SourceFiles #include "bool.H" #include "label.H" #include "uLabel.H" +#include "nullObject.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/containers/Lists/UList/UListI.H b/src/OpenFOAM/containers/Lists/UList/UListI.H index 3994b3deec..815c9aafcd 100644 --- a/src/OpenFOAM/containers/Lists/UList/UListI.H +++ b/src/OpenFOAM/containers/Lists/UList/UListI.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,7 +50,7 @@ inline Foam::UList::UList(T* __restrict__ v, label size) template inline const Foam::UList& Foam::UList::null() { - return *reinterpret_cast< UList* >(0); + return NullObjectRef >(); } diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C index b5b555485f..4123c643ad 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -204,7 +204,7 @@ const Type& Foam::objectRegistry::lookupObject(const word& name) const << abort(FatalError); } - return *reinterpret_cast< const Type* >(0); + return NullObjectRef(); } diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H index 05a8a31173..f2aa000604 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,57 +23,52 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -inline const DimensionedField& -DimensionedField::null() +inline const Foam::DimensionedField& +Foam::DimensionedField::null() { - return *reinterpret_cast< DimensionedField* >(0); + return NullObjectRef >(); } template inline const typename GeoMesh::Mesh& -DimensionedField::mesh() const +Foam::DimensionedField::mesh() const { return mesh_; } template -inline const dimensionSet& DimensionedField::dimensions() const +inline const Foam::dimensionSet& +Foam::DimensionedField::dimensions() const { return dimensions_; } template -inline dimensionSet& DimensionedField::dimensions() +inline Foam::dimensionSet& +Foam::DimensionedField::dimensions() { return dimensions_; } template -inline const Field& DimensionedField::field() const +inline const Foam::Field& +Foam::DimensionedField::field() const { return *this; } template -inline Field& DimensionedField::field() +inline Foam::Field& +Foam::DimensionedField::field() { return *this; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/SubDimensionedFieldI.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/SubDimensionedFieldI.H index 7cfdc972d9..ecddcc04ba 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/SubDimensionedFieldI.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/SubDimensionedFieldI.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,15 +23,10 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -inline SubDimensionedField::SubDimensionedField +inline Foam::SubDimensionedField::SubDimensionedField ( const SubField& slist ) @@ -40,7 +35,7 @@ inline SubDimensionedField::SubDimensionedField {} template -inline SubDimensionedField::SubDimensionedField +inline Foam::SubDimensionedField::SubDimensionedField ( const UList& list, const label subSize @@ -51,7 +46,7 @@ inline SubDimensionedField::SubDimensionedField template -inline SubDimensionedField::SubDimensionedField +inline Foam::SubDimensionedField::SubDimensionedField ( const UList& list, const label subSize, @@ -63,7 +58,7 @@ inline SubDimensionedField::SubDimensionedField template -inline SubDimensionedField::SubDimensionedField +inline Foam::SubDimensionedField::SubDimensionedField ( const SubDimensionedField& sfield ) @@ -75,18 +70,21 @@ inline SubDimensionedField::SubDimensionedField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// Return a null Field template -inline const SubDimensionedField& -SubDimensionedField::null() +inline const Foam::SubDimensionedField& +Foam::SubDimensionedField::null() { - return *reinterpret_cast< SubDimensionedField* >(0); + return NullObjectRef >(); } template -inline tmp::cmptType> > -SubDimensionedField::component +inline +Foam::tmp +< + Foam::Field::cmptType> +> +Foam::SubDimensionedField::component ( const direction d ) const @@ -99,8 +97,8 @@ SubDimensionedField::component template -inline tmp > -SubDimensionedField::T() const +inline Foam::tmp > +Foam::SubDimensionedField::T() const { return ( @@ -112,7 +110,7 @@ SubDimensionedField::T() const // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template -inline void SubDimensionedField::operator= +inline void Foam::SubDimensionedField::operator= ( const SubDimensionedField& rhs ) @@ -122,17 +120,12 @@ inline void SubDimensionedField::operator= } -// Allow cast to a const DimensionedField& template -inline SubDimensionedField::operator -const DimensionedField&() const +inline Foam::SubDimensionedField::operator +const Foam::DimensionedField&() const { return *(reinterpret_cast*>(this)); } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index 118de048b3..7cca8f9942 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -458,7 +458,7 @@ void Foam::Field::map if ( mapper.direct() - && &mapper.directAddressing() + && notNull(mapper.directAddressing()) && mapper.directAddressing().size() ) { @@ -493,7 +493,7 @@ void Foam::Field::autoMap ( ( mapper.direct() - && &mapper.directAddressing() + && notNull(mapper.directAddressing()) && mapper.directAddressing().size() ) || (!mapper.direct() && mapper.addressing().size()) diff --git a/src/OpenFOAM/fields/Fields/Field/Field.H b/src/OpenFOAM/fields/Fields/Field/Field.H index dd3dbabeae..5d8903ea63 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.H +++ b/src/OpenFOAM/fields/Fields/Field/Field.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -100,7 +100,7 @@ public: //- Return a null field inline static const Field& null() { - return *reinterpret_cast< Field* >(0); + return NullObjectRef >(); } diff --git a/src/OpenFOAM/fields/Fields/Field/SubFieldI.H b/src/OpenFOAM/fields/Fields/Field/SubFieldI.H index d6c28d0702..d2d5aabe9c 100644 --- a/src/OpenFOAM/fields/Fields/Field/SubFieldI.H +++ b/src/OpenFOAM/fields/Fields/Field/SubFieldI.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -84,7 +84,7 @@ inline Foam::SubField::SubField template inline const Foam::SubField& Foam::SubField::null() { - return *reinterpret_cast< SubField* >(0); + return NullObjectRef >(); } diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldI.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldI.H index 49fd3c85c8..35885d523f 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldI.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldI.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,7 +29,7 @@ template class PatchField, class GeoMesh> inline const Foam::GeometricField& Foam::GeometricField::null() { - return *reinterpret_cast< GeometricField* >(0); + return NullObjectRef >(); } diff --git a/src/OpenFOAM/global/clock/clock.C b/src/OpenFOAM/global/clock/clock.C index e96ce881d7..baf6268467 100644 --- a/src/OpenFOAM/global/clock/clock.C +++ b/src/OpenFOAM/global/clock/clock.C @@ -29,8 +29,6 @@ License #include #include -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // const char *Foam::clock::monthNames[] = @@ -136,6 +134,4 @@ time_t Foam::clock::clockTimeIncrement() const } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/OpenFOAM/global/global.Cver b/src/OpenFOAM/global/global.Cver index ea711ef82a..a868495556 100644 --- a/src/OpenFOAM/global/global.Cver +++ b/src/OpenFOAM/global/global.Cver @@ -42,6 +42,11 @@ const char* const Foam::FOAMbuild = "BUILD_STRING"; #include "new.C" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Create the nullObject singleton + +#include "nullObject.C" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Global IO streams diff --git a/src/OpenFOAM/matrices/Matrix/MatrixI.H b/src/OpenFOAM/matrices/Matrix/MatrixI.H index a3604b276b..5b99b0d094 100644 --- a/src/OpenFOAM/matrices/Matrix/MatrixI.H +++ b/src/OpenFOAM/matrices/Matrix/MatrixI.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,7 +47,7 @@ clone() const template inline const Foam::Matrix& Foam::Matrix::null() { - return *reinterpret_cast< Matrix* >(0); + return NullObjectRef >(); } diff --git a/src/OpenFOAM/memory/Xfer/XferI.H b/src/OpenFOAM/memory/Xfer/XferI.H index 3cb5077265..d1127393df 100644 --- a/src/OpenFOAM/memory/Xfer/XferI.H +++ b/src/OpenFOAM/memory/Xfer/XferI.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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,12 +23,14 @@ License \*---------------------------------------------------------------------------*/ +#include "nullObject.H" + // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // template inline const Foam::Xfer& Foam::Xfer::null() { - return *reinterpret_cast< Xfer* >(0); + return NullObjectRef >(); } diff --git a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeIO.C b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeIO.C index 27332911fe..eeb054549c 100644 --- a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeIO.C +++ b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeIO.C @@ -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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -128,7 +128,7 @@ Ostream& operator<<(Ostream& os, const InfoProxy& ip) { const cellShape& cs = ip.t_; - if (!(&cs.model())) + if (isNull(cs.model())) { os << " cellShape has no model!\n"; } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index 945e727b76..981dc086a3 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -678,23 +678,23 @@ void Foam::polyMesh::resetPrimitives // Take over new primitive data. // Optimized to avoid overwriting data at all - if (&points) + if (notNull(points)) { points_.transfer(points()); bounds_ = boundBox(points_, validBoundary); } - if (&faces) + if (notNull(faces)) { faces_.transfer(faces()); } - if (&owner) + if (notNull(owner)) { owner_.transfer(owner()); } - if (&neighbour) + if (notNull(neighbour)) { neighbour_.transfer(neighbour()); } diff --git a/src/OpenFOAM/primitives/nullObject/nullObject.C b/src/OpenFOAM/primitives/nullObject/nullObject.C new file mode 100644 index 0000000000..cfcbfdf189 --- /dev/null +++ b/src/OpenFOAM/primitives/nullObject/nullObject.C @@ -0,0 +1,34 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "nullObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +const Foam::NullObject Foam::NullObject::nullObject; +const Foam::NullObject* Foam::nullObjectPtr = &Foam::NullObject::nullObject; + + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/nullObject/nullObject.H b/src/OpenFOAM/primitives/nullObject/nullObject.H new file mode 100644 index 0000000000..d324a92500 --- /dev/null +++ b/src/OpenFOAM/primitives/nullObject/nullObject.H @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::nullObject + +Description + Singleton null-object class and instance + +SourceFiles + nullObjectI.H + nullObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef nullObject_H +#define nullObject_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class nullObject Declaration +\*---------------------------------------------------------------------------*/ + +class NullObject +{ + //- Private constructor + NullObject() + {} + + //- Prevent copy-construction + NullObject(const NullObject&); + + //- Prevent assignment + NullObject& operator=(const NullObject&); + +public: + + //- The unique null object + static const NullObject nullObject; +}; + + +//- Pointer to the unique nullObject +extern const NullObject* nullObjectPtr; + + +//- Return reference to the nullObject of type T +template +inline const T& NullObjectRef(); + +//- Return pointer to the nullObject of type T +template +inline const T* NullObjectPtr(); + + +//- Return true if t is a reference to the nullObject of type T +template +inline bool isNull(const T& t); + +//- Return true if t is not a reference to the nullObject of type T +template +inline bool notNull(const T& t); + + +//- Return true if t is a pointer to the nullObject of type T +template +inline bool isNull(const T* t); + +//- Return true if t is not a pointer to the nullObject of type T +template +inline bool notNull(const T* t); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "nullObjectI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/nullObject/nullObjectI.H b/src/OpenFOAM/primitives/nullObject/nullObjectI.H new file mode 100644 index 0000000000..4f8fbc1f73 --- /dev/null +++ b/src/OpenFOAM/primitives/nullObject/nullObjectI.H @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +template +inline const T& Foam::NullObjectRef() +{ + return *reinterpret_cast(nullObjectPtr); +} + +template +inline const T* Foam::NullObjectPtr() +{ + return reinterpret_cast(nullObjectPtr); +} + + +template +inline bool Foam::isNull(const T& t) +{ + return &t == NullObjectPtr(); +} + +template +inline bool Foam::notNull(const T& t) +{ + return &t != NullObjectPtr(); +} + + +template +inline bool Foam::isNull(const T* t) +{ + return t == NullObjectPtr(); +} + +template +inline bool Foam::notNull(const T* t) +{ + return t != NullObjectPtr(); +} + + +// ************************************************************************* // diff --git a/src/conversion/ensight/part/ensightPartCells.C b/src/conversion/ensight/part/ensightPartCells.C index 031aeeda3e..786b91a927 100644 --- a/src/conversion/ensight/part/ensightPartCells.C +++ b/src/conversion/ensight/part/ensightPartCells.C @@ -67,7 +67,7 @@ void Foam::ensightPartCells::classify size_ = mesh.nCells(); bool limited = false; - if (&idList) + if (notNull(idList)) { limited = true; size_ = idList.size(); diff --git a/src/conversion/ensight/part/ensightPartIO.C b/src/conversion/ensight/part/ensightPartIO.C index 7fe2e6ea23..6d827d7ed1 100644 --- a/src/conversion/ensight/part/ensightPartIO.C +++ b/src/conversion/ensight/part/ensightPartIO.C @@ -59,7 +59,7 @@ void Foam::ensightPart::writeFieldList const labelUList& idList ) const { - if (&idList) + if (notNull(idList)) { forAll(idList, i) { diff --git a/src/edgeMesh/edgeMesh.C b/src/edgeMesh/edgeMesh.C index 7e2a397297..0e8cb2acad 100644 --- a/src/edgeMesh/edgeMesh.C +++ b/src/edgeMesh/edgeMesh.C @@ -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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -182,12 +182,12 @@ void Foam::edgeMesh::reset { // Take over new primitive data. // Optimized to avoid overwriting data at all - if (&pointLst) + if (notNull(pointLst)) { points_.transfer(pointLst()); } - if (&edgeLst) + if (notNull(edgeLst)) { edges_.transfer(edgeLst()); diff --git a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C index 486087e86a..49bfa59614 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C @@ -56,7 +56,7 @@ Foam::directionMixedFvPatchField::directionMixedFvPatchField refGrad_(ptf.refGrad_, mapper), valueFraction_(ptf.valueFraction_, mapper) { - if (&iF && mapper.hasUnmapped()) + if (notNull(iF) && mapper.hasUnmapped()) { WarningIn ( diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C index 18af2c4db3..33974a547d 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C @@ -57,7 +57,7 @@ fixedGradientFvPatchField::fixedGradientFvPatchField fvPatchField(ptf, p, iF, mapper), gradient_(ptf.gradient_, mapper) { - if (&iF && mapper.hasUnmapped()) + if (notNull(iF) && mapper.hasUnmapped()) { WarningIn ( diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C index 526fc41672..951cdda5ad 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C @@ -66,7 +66,7 @@ fixedValueFvPatchField::fixedValueFvPatchField : fvPatchField(ptf, p, iF, mapper) { - if (&iF && mapper.hasUnmapped()) + if (notNull(iF) && mapper.hasUnmapped()) { WarningIn ( diff --git a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C index eba0a0a851..68c82a4939 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C @@ -60,7 +60,7 @@ mixedFvPatchField::mixedFvPatchField refGrad_(ptf.refGrad_, mapper), valueFraction_(ptf.valueFraction_, mapper) { - if (&iF && mapper.hasUnmapped()) + if (notNull(iF) && mapper.hasUnmapped()) { WarningIn ( diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C index dc939b1f3a..0a5a4b4809 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C @@ -60,7 +60,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField gradient().map(ptf.gradient(), mapper); // Evaluate the value field from the gradient if the internal field is valid - if (&iF && iF.size()) + if (notNull(iF) && iF.size()) { scalarField::operator= ( diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C index 7b5f58a2d0..3c4da515c4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,7 +65,7 @@ Foam::uniformInletOutletFvPatchField::uniformInletOutletFvPatchField this->valueFraction() = 0.0; // Map value (unmapped get refValue) - if (&iF && iF.size()) + if (notNull(iF) && iF.size()) { fvPatchField::operator=(this->refValue()); } diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index 23d3ef9c2b..21aad2c1ce 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -98,7 +98,7 @@ Foam::fvPatchField::fvPatchField patchType_(ptf.patchType_) { // For unmapped faces set to internal field value (zero-gradient) - if (&iF && iF.size()) + if (notNull(iF) && iF.size()) { fvPatchField::operator=(this->patchInternalField()); } @@ -250,7 +250,7 @@ void Foam::fvPatchField::autoMap if ( mapper.direct() - && &mapper.directAddressing() + && notNull(mapper.directAddressing()) && mapper.directAddressing().size() ) { diff --git a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C index a21e24e607..ff36b3e866 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C @@ -98,7 +98,7 @@ const Foam::tensorField& Foam::EulerCoordinateRotation::Tr() const ( "const tensorField& EulerCoordinateRotation::Tr() const" ); - return *reinterpret_cast(0); + return NullObjectRef(); } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C index a8ba465191..2515ebadae 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C @@ -99,7 +99,7 @@ const Foam::tensorField& Foam::STARCDCoordinateRotation::Tr() const ( "const tensorField& STARCDCoordinateRotatio::Tr() const" ); - return *reinterpret_cast(0); + return NullObjectRef(); } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C index f5d0fa0d73..c7a59d35ca 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C @@ -172,7 +172,7 @@ const Foam::tensorField& Foam::axesRotation::Tr() const ( "const Foam::tensorField& axesRotation::Tr() const" ); - return *reinterpret_cast(0); + return NullObjectRef(); } diff --git a/src/regionModels/thermalBaffleModels/noThermo/noThermo.C b/src/regionModels/thermalBaffleModels/noThermo/noThermo.C index e5205db4a6..d603203fbf 100644 --- a/src/regionModels/thermalBaffleModels/noThermo/noThermo.C +++ b/src/regionModels/thermalBaffleModels/noThermo/noThermo.C @@ -151,7 +151,7 @@ const solidThermo& noThermo::thermo() const FatalErrorIn("const volScalarField& noThermo::T() const") << "T field not available for " << type() << abort(FatalError); - return *reinterpret_cast(NULL); + return NullObjectRef(); } diff --git a/src/sampling/cuttingPlane/cuttingPlane.C b/src/sampling/cuttingPlane/cuttingPlane.C index 87f004a034..f1d3b5c5ee 100644 --- a/src/sampling/cuttingPlane/cuttingPlane.C +++ b/src/sampling/cuttingPlane/cuttingPlane.C @@ -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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,7 +30,7 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -// set values for what is close to zero and what is considered to +// Set values for what is close to zero and what is considered to // be positive (and not just rounding noise) //! \cond localScope const Foam::scalar zeroish = Foam::SMALL; @@ -39,7 +39,6 @@ const Foam::scalar positive = Foam::SMALL * 1E3; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// Find cut cells void Foam::cuttingPlane::calcCutCells ( const primitiveMesh& mesh, @@ -51,7 +50,7 @@ void Foam::cuttingPlane::calcCutCells const edgeList& edges = mesh.edges(); label listSize = cellEdges.size(); - if (&cellIdLabels) + if (notNull(cellIdLabels)) { listSize = cellIdLabels.size(); } @@ -64,7 +63,8 @@ void Foam::cuttingPlane::calcCutCells for (label listI = 0; listI < listSize; ++listI) { label cellI = listI; - if (&cellIdLabels) + + if (notNull(cellIdLabels)) { cellI = cellIdLabels[listI]; } @@ -100,9 +100,6 @@ void Foam::cuttingPlane::calcCutCells } -// Determine for each edge the intersection point. Calculates -// - cutPoints_ : coordinates of all intersection points -// - edgePoint : per edge -1 or the index into cutPoints void Foam::cuttingPlane::intersectEdges ( const primitiveMesh& mesh, @@ -160,8 +157,6 @@ void Foam::cuttingPlane::intersectEdges } -// Coming from startEdgeI cross the edge to the other face -// across to the next cut edge. bool Foam::cuttingPlane::walkCell ( const primitiveMesh& mesh, @@ -253,7 +248,6 @@ bool Foam::cuttingPlane::walkCell } -// For every cut cell determine a walk through all? its cuts. void Foam::cuttingPlane::walkCellCuts ( const primitiveMesh& mesh, @@ -367,7 +361,6 @@ Foam::cuttingPlane::cuttingPlane // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// recut mesh with existing planeDesc void Foam::cuttingPlane::reCut ( const primitiveMesh& mesh, @@ -393,14 +386,13 @@ void Foam::cuttingPlane::reCut } -// remap action on triangulation void Foam::cuttingPlane::remapFaces ( const labelUList& faceMap ) { // recalculate the cells cut - if (&faceMap && faceMap.size()) + if (notNull(faceMap) && faceMap.size()) { MeshStorage::remapFaces(faceMap); @@ -413,6 +405,7 @@ void Foam::cuttingPlane::remapFaces } } + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // void Foam::cuttingPlane::operator=(const cuttingPlane& rhs) diff --git a/src/sampling/sampledSurface/sampledPatch/sampledPatch.C b/src/sampling/sampledSurface/sampledPatch/sampledPatch.C index b100f7ed74..d07a6391f1 100644 --- a/src/sampling/sampledSurface/sampledPatch/sampledPatch.C +++ b/src/sampling/sampledSurface/sampledPatch/sampledPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -203,7 +203,7 @@ bool Foam::sampledPatch::update() void Foam::sampledPatch::remapFaces(const labelUList& faceMap) { // recalculate the cells cut - if (&faceMap && faceMap.size()) + if (notNull(faceMap) && faceMap.size()) { MeshStorage::remapFaces(faceMap); patchFaceLabels_ = labelList diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.C b/src/surfMesh/MeshedSurface/MeshedSurface.C index 43719de2fb..0fec3ea958 100644 --- a/src/surfMesh/MeshedSurface/MeshedSurface.C +++ b/src/surfMesh/MeshedSurface/MeshedSurface.C @@ -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-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -433,7 +433,7 @@ void Foam::MeshedSurface::remapFaces ) { // recalculate the zone start/size - if (&faceMap && faceMap.size()) + if (notNull(faceMap) && faceMap.size()) { surfZoneList& zones = storedZones(); @@ -526,17 +526,17 @@ void Foam::MeshedSurface::reset // Take over new primitive data. // Optimized to avoid overwriting data at all - if (&pointLst) + if (notNull(pointLst)) { storedPoints().transfer(pointLst()); } - if (&faceLst) + if (notNull(faceLst)) { storedFaces().transfer(faceLst()); } - if (&zoneLst) + if (notNull(zoneLst)) { storedZones().transfer(zoneLst()); } @@ -555,17 +555,17 @@ void Foam::MeshedSurface::reset // Take over new primitive data. // Optimized to avoid overwriting data at all - if (&pointLst) + if (notNull(pointLst)) { storedPoints().transfer(pointLst()); } - if (&faceLst) + if (notNull(faceLst)) { storedFaces().transfer(faceLst()); } - if (&zoneLst) + if (notNull(zoneLst)) { storedZones().transfer(zoneLst()); } @@ -860,7 +860,7 @@ Foam::label Foam::MeshedSurface::triangulate // nothing to do if (nTri <= faceLst.size()) { - if (&faceMapOut) + if (notNull(faceMapOut)) { faceMapOut.clear(); } @@ -871,7 +871,7 @@ Foam::label Foam::MeshedSurface::triangulate List