Resolve issues relating to compilation with clang-3.5.0

This commit is contained in:
Henry
2014-12-15 22:38:10 +00:00
parent 41368addc9
commit f4596ad247
52 changed files with 413 additions and 160 deletions

View File

@ -2,7 +2,7 @@
# #
#+TITLE: OpenFOAM README for version dev #+TITLE: OpenFOAM README for version dev
#+AUTHOR: The OpenFOAM Foundation #+AUTHOR: The OpenFOAM Foundation
#+DATE: 14th December 2014 #+DATE: 16th December 2014
#+LINK: http://www.openfoam.org #+LINK: http://www.openfoam.org
#+OPTIONS: author:nil ^:{} #+OPTIONS: author:nil ^:{}
# Copyright (c) 2014 OpenFOAM Foundation. # Copyright (c) 2014 OpenFOAM Foundation.

View File

@ -0,0 +1,3 @@
Test-nullObject.C
EXE = $(FOAM_USER_APPBIN)/nullObject

View File

@ -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<SimpleClass>());
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;
}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -360,7 +360,6 @@ void calcFeaturePoints(const pointField& points, const edgeList& edges)
const labelListList& pointEdges = eMesh.pointEdges(); const labelListList& pointEdges = eMesh.pointEdges();
// Get total number of feature points // Get total number of feature points
label nFeaturePoints = 0; label nFeaturePoints = 0;
forAll(pointEdges, pI) forAll(pointEdges, pI)
@ -390,19 +389,6 @@ void calcFeaturePoints(const pointField& points, const edgeList& edges)
nFeatPts++; nFeatPts++;
} }
} }
label concaveStart = 0;
label mixedStart = 0;
label nonFeatureStart = nFeaturePoints;
labelListList featurePointNormals(nFeaturePoints);
labelListList featurePointEdges(nFeaturePoints);
labelList regionEdges;
} }

View File

@ -235,7 +235,7 @@ case ThirdParty:
# using clang - not gcc # using clang - not gcc
setenv WM_CC 'clang' setenv WM_CC 'clang'
setenv WM_CXX 'clang++' setenv WM_CXX 'clang++'
set clang_version=llvm-3.4.2 set clang_version=llvm-3.5.0
breaksw breaksw
default: default:
echo echo

View File

@ -256,7 +256,7 @@ OpenFOAM | ThirdParty)
# using clang - not gcc # using clang - not gcc
export WM_CC='clang' export WM_CC='clang'
export WM_CXX='clang++' export WM_CXX='clang++'
clang_version=llvm-3.4.2 clang_version=llvm-3.5.0
;; ;;
*) *)
echo 1>&2 echo 1>&2

View File

@ -104,7 +104,6 @@ $(ranges)/labelRange/labelRanges.C
$(ranges)/scalarRange/scalarRange.C $(ranges)/scalarRange/scalarRange.C
$(ranges)/scalarRange/scalarRanges.C $(ranges)/scalarRange/scalarRanges.C
containers/HashTables/HashTable/HashTableCore.C containers/HashTables/HashTable/HashTableCore.C
containers/HashTables/StaticHashTable/StaticHashTableCore.C containers/HashTables/StaticHashTable/StaticHashTableCore.C
containers/Lists/SortableList/ParSortableListName.C containers/Lists/SortableList/ParSortableListName.C

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -79,7 +79,7 @@ template<class T, class Container>
inline const Foam::CompactListList<T, Container>& inline const Foam::CompactListList<T, Container>&
Foam::CompactListList<T, Container>::null() Foam::CompactListList<T, Container>::null()
{ {
return *reinterpret_cast< CompactListList<T, Container>* >(0); return NullObjectRef<CompactListList<T, Container> >();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -107,7 +107,7 @@ Foam::FixedList<T, Size>::clone() const
template<class T, unsigned Size> template<class T, unsigned Size>
inline const Foam::FixedList<T, Size>& Foam::FixedList<T, Size>::null() inline const Foam::FixedList<T, Size>& Foam::FixedList<T, Size>::null()
{ {
return *reinterpret_cast< FixedList<T, Size>* >(0); return NullObjectRef<FixedList<T, Size> >();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,7 +42,7 @@ inline Foam::autoPtr<Foam::List<T> > Foam::List<T>::clone() const
template<class T> template<class T>
inline const Foam::List<T>& Foam::List<T>::null() inline const Foam::List<T>& Foam::List<T>::null()
{ {
return *reinterpret_cast< List<T>* >(0); return NullObjectRef<List<T> >();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -74,7 +74,7 @@ inline Foam::SubList<T>::SubList
template<class T> template<class T>
inline const Foam::SubList<T>& Foam::SubList<T>::null() inline const Foam::SubList<T>& Foam::SubList<T>::null()
{ {
return *reinterpret_cast< SubList<T>* >(0); return NullObjectRef<SubList<T> >();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -45,6 +45,7 @@ SourceFiles
#include "bool.H" #include "bool.H"
#include "label.H" #include "label.H"
#include "uLabel.H" #include "uLabel.H"
#include "nullObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -50,7 +50,7 @@ inline Foam::UList<T>::UList(T* __restrict__ v, label size)
template<class T> template<class T>
inline const Foam::UList<T>& Foam::UList<T>::null() inline const Foam::UList<T>& Foam::UList<T>::null()
{ {
return *reinterpret_cast< UList<T>* >(0); return NullObjectRef<UList<T> >();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -204,7 +204,7 @@ const Type& Foam::objectRegistry::lookupObject(const word& name) const
<< abort(FatalError); << abort(FatalError);
} }
return *reinterpret_cast< const Type* >(0); return NullObjectRef<Type>();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,57 +23,52 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline const DimensionedField<Type, GeoMesh>& inline const Foam::DimensionedField<Type, GeoMesh>&
DimensionedField<Type, GeoMesh>::null() Foam::DimensionedField<Type, GeoMesh>::null()
{ {
return *reinterpret_cast< DimensionedField<Type, GeoMesh>* >(0); return NullObjectRef<DimensionedField<Type, GeoMesh> >();
} }
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline const typename GeoMesh::Mesh& inline const typename GeoMesh::Mesh&
DimensionedField<Type, GeoMesh>::mesh() const Foam::DimensionedField<Type, GeoMesh>::mesh() const
{ {
return mesh_; return mesh_;
} }
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline const dimensionSet& DimensionedField<Type, GeoMesh>::dimensions() const inline const Foam::dimensionSet&
Foam::DimensionedField<Type, GeoMesh>::dimensions() const
{ {
return dimensions_; return dimensions_;
} }
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline dimensionSet& DimensionedField<Type, GeoMesh>::dimensions() inline Foam::dimensionSet&
Foam::DimensionedField<Type, GeoMesh>::dimensions()
{ {
return dimensions_; return dimensions_;
} }
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline const Field<Type>& DimensionedField<Type, GeoMesh>::field() const inline const Foam::Field<Type>&
Foam::DimensionedField<Type, GeoMesh>::field() const
{ {
return *this; return *this;
} }
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline Field<Type>& DimensionedField<Type, GeoMesh>::field() inline Foam::Field<Type>&
Foam::DimensionedField<Type, GeoMesh>::field()
{ {
return *this; return *this;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,15 +23,10 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField inline Foam::SubDimensionedField<Type, GeoMesh>::SubDimensionedField
( (
const SubField<Type>& slist const SubField<Type>& slist
) )
@ -40,7 +35,7 @@ inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
{} {}
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField inline Foam::SubDimensionedField<Type, GeoMesh>::SubDimensionedField
( (
const UList<Type>& list, const UList<Type>& list,
const label subSize const label subSize
@ -51,7 +46,7 @@ inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField inline Foam::SubDimensionedField<Type, GeoMesh>::SubDimensionedField
( (
const UList<Type>& list, const UList<Type>& list,
const label subSize, const label subSize,
@ -63,7 +58,7 @@ inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField inline Foam::SubDimensionedField<Type, GeoMesh>::SubDimensionedField
( (
const SubDimensionedField<Type, GeoMesh>& sfield const SubDimensionedField<Type, GeoMesh>& sfield
) )
@ -75,18 +70,21 @@ inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Return a null Field
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline const SubDimensionedField<Type, GeoMesh>& inline const Foam::SubDimensionedField<Type, GeoMesh>&
SubDimensionedField<Type, GeoMesh>::null() Foam::SubDimensionedField<Type, GeoMesh>::null()
{ {
return *reinterpret_cast< SubDimensionedField<Type, GeoMesh>* >(0); return NullObjectRef<SubDimensionedField<Type, GeoMesh> >();
} }
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline tmp<Field<typename SubDimensionedField<Type, GeoMesh>::cmptType> > inline
SubDimensionedField<Type, GeoMesh>::component Foam::tmp
<
Foam::Field<typename Foam::SubDimensionedField<Type, GeoMesh>::cmptType>
>
Foam::SubDimensionedField<Type, GeoMesh>::component
( (
const direction d const direction d
) const ) const
@ -99,8 +97,8 @@ SubDimensionedField<Type, GeoMesh>::component
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline tmp<DimensionedField<Type, GeoMesh> > inline Foam::tmp<Foam::DimensionedField<Type, GeoMesh> >
SubDimensionedField<Type, GeoMesh>::T() const Foam::SubDimensionedField<Type, GeoMesh>::T() const
{ {
return return
( (
@ -112,7 +110,7 @@ SubDimensionedField<Type, GeoMesh>::T() const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline void SubDimensionedField<Type, GeoMesh>::operator= inline void Foam::SubDimensionedField<Type, GeoMesh>::operator=
( (
const SubDimensionedField<Type, GeoMesh>& rhs const SubDimensionedField<Type, GeoMesh>& rhs
) )
@ -122,17 +120,12 @@ inline void SubDimensionedField<Type, GeoMesh>::operator=
} }
// Allow cast to a const DimensionedField<Type, GeoMesh>&
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline SubDimensionedField<Type, GeoMesh>::operator inline Foam::SubDimensionedField<Type, GeoMesh>::operator
const DimensionedField<Type, GeoMesh>&() const const Foam::DimensionedField<Type, GeoMesh>&() const
{ {
return *(reinterpret_cast<const DimensionedField<Type, GeoMesh>*>(this)); return *(reinterpret_cast<const DimensionedField<Type, GeoMesh>*>(this));
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -458,7 +458,7 @@ void Foam::Field<Type>::map
if if
( (
mapper.direct() mapper.direct()
&& &mapper.directAddressing() && notNull(mapper.directAddressing())
&& mapper.directAddressing().size() && mapper.directAddressing().size()
) )
{ {
@ -493,7 +493,7 @@ void Foam::Field<Type>::autoMap
( (
( (
mapper.direct() mapper.direct()
&& &mapper.directAddressing() && notNull(mapper.directAddressing())
&& mapper.directAddressing().size() && mapper.directAddressing().size()
) )
|| (!mapper.direct() && mapper.addressing().size()) || (!mapper.direct() && mapper.addressing().size())

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -100,7 +100,7 @@ public:
//- Return a null field //- Return a null field
inline static const Field<Type>& null() inline static const Field<Type>& null()
{ {
return *reinterpret_cast< Field<Type>* >(0); return NullObjectRef<Field<Type> >();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -84,7 +84,7 @@ inline Foam::SubField<Type>::SubField
template<class Type> template<class Type>
inline const Foam::SubField<Type>& Foam::SubField<Type>::null() inline const Foam::SubField<Type>& Foam::SubField<Type>::null()
{ {
return *reinterpret_cast< SubField<Type>* >(0); return NullObjectRef<SubField<Type> >();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,7 +29,7 @@ template<class Type, template<class> class PatchField, class GeoMesh>
inline const Foam::GeometricField<Type, PatchField, GeoMesh>& inline const Foam::GeometricField<Type, PatchField, GeoMesh>&
Foam::GeometricField<Type, PatchField, GeoMesh>::null() Foam::GeometricField<Type, PatchField, GeoMesh>::null()
{ {
return *reinterpret_cast< GeometricField<Type, PatchField, GeoMesh>* >(0); return NullObjectRef<GeometricField<Type, PatchField, GeoMesh> >();
} }

View File

@ -29,8 +29,6 @@ License
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const char *Foam::clock::monthNames[] = const char *Foam::clock::monthNames[] =
@ -136,6 +134,4 @@ time_t Foam::clock::clockTimeIncrement() const
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* // // ************************************************************************* //

View File

@ -42,6 +42,11 @@ const char* const Foam::FOAMbuild = "BUILD_STRING";
#include "new.C" #include "new.C"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Create the nullObject singleton
#include "nullObject.C"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Global IO streams // Global IO streams

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -47,7 +47,7 @@ clone() const
template<class Form, class Type> template<class Form, class Type>
inline const Foam::Matrix<Form, Type>& Foam::Matrix<Form, Type>::null() inline const Foam::Matrix<Form, Type>& Foam::Matrix<Form, Type>::null()
{ {
return *reinterpret_cast< Matrix<Form, Type>* >(0); return NullObjectRef<Matrix<Form, Type> >();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,12 +23,14 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "nullObject.H"
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
template<class T> template<class T>
inline const Foam::Xfer<T>& Foam::Xfer<T>::null() inline const Foam::Xfer<T>& Foam::Xfer<T>::null()
{ {
return *reinterpret_cast< Xfer<T>* >(0); return NullObjectRef<Xfer<T> >();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -128,7 +128,7 @@ Ostream& operator<<(Ostream& os, const InfoProxy<cellShape>& ip)
{ {
const cellShape& cs = ip.t_; const cellShape& cs = ip.t_;
if (!(&cs.model())) if (isNull(cs.model()))
{ {
os << " cellShape has no model!\n"; os << " cellShape has no model!\n";
} }

View File

@ -678,23 +678,23 @@ void Foam::polyMesh::resetPrimitives
// Take over new primitive data. // Take over new primitive data.
// Optimized to avoid overwriting data at all // Optimized to avoid overwriting data at all
if (&points) if (notNull(points))
{ {
points_.transfer(points()); points_.transfer(points());
bounds_ = boundBox(points_, validBoundary); bounds_ = boundBox(points_, validBoundary);
} }
if (&faces) if (notNull(faces))
{ {
faces_.transfer(faces()); faces_.transfer(faces());
} }
if (&owner) if (notNull(owner))
{ {
owner_.transfer(owner()); owner_.transfer(owner());
} }
if (&neighbour) if (notNull(neighbour))
{ {
neighbour_.transfer(neighbour()); neighbour_.transfer(neighbour());
} }

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "nullObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::NullObject Foam::NullObject::nullObject;
const Foam::NullObject* Foam::nullObjectPtr = &Foam::NullObject::nullObject;
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
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 <class T>
inline const T& NullObjectRef();
//- Return pointer to the nullObject of type T
template <class T>
inline const T* NullObjectPtr();
//- Return true if t is a reference to the nullObject of type T
template <class T>
inline bool isNull(const T& t);
//- Return true if t is not a reference to the nullObject of type T
template <class T>
inline bool notNull(const T& t);
//- Return true if t is a pointer to the nullObject of type T
template <class T>
inline bool isNull(const T* t);
//- Return true if t is not a pointer to the nullObject of type T
template <class T>
inline bool notNull(const T* t);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "nullObjectI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
template <class T>
inline const T& Foam::NullObjectRef()
{
return *reinterpret_cast<const T*>(nullObjectPtr);
}
template <class T>
inline const T* Foam::NullObjectPtr()
{
return reinterpret_cast<const T*>(nullObjectPtr);
}
template <class T>
inline bool Foam::isNull(const T& t)
{
return &t == NullObjectPtr<T>();
}
template <class T>
inline bool Foam::notNull(const T& t)
{
return &t != NullObjectPtr<T>();
}
template <class T>
inline bool Foam::isNull(const T* t)
{
return t == NullObjectPtr<T>();
}
template <class T>
inline bool Foam::notNull(const T* t)
{
return t != NullObjectPtr<T>();
}
// ************************************************************************* //

View File

@ -67,7 +67,7 @@ void Foam::ensightPartCells::classify
size_ = mesh.nCells(); size_ = mesh.nCells();
bool limited = false; bool limited = false;
if (&idList) if (notNull(idList))
{ {
limited = true; limited = true;
size_ = idList.size(); size_ = idList.size();

View File

@ -59,7 +59,7 @@ void Foam::ensightPart::writeFieldList
const labelUList& idList const labelUList& idList
) const ) const
{ {
if (&idList) if (notNull(idList))
{ {
forAll(idList, i) forAll(idList, i)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -182,12 +182,12 @@ void Foam::edgeMesh::reset
{ {
// Take over new primitive data. // Take over new primitive data.
// Optimized to avoid overwriting data at all // Optimized to avoid overwriting data at all
if (&pointLst) if (notNull(pointLst))
{ {
points_.transfer(pointLst()); points_.transfer(pointLst());
} }
if (&edgeLst) if (notNull(edgeLst))
{ {
edges_.transfer(edgeLst()); edges_.transfer(edgeLst());

View File

@ -56,7 +56,7 @@ Foam::directionMixedFvPatchField<Type>::directionMixedFvPatchField
refGrad_(ptf.refGrad_, mapper), refGrad_(ptf.refGrad_, mapper),
valueFraction_(ptf.valueFraction_, mapper) valueFraction_(ptf.valueFraction_, mapper)
{ {
if (&iF && mapper.hasUnmapped()) if (notNull(iF) && mapper.hasUnmapped())
{ {
WarningIn WarningIn
( (

View File

@ -57,7 +57,7 @@ fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
fvPatchField<Type>(ptf, p, iF, mapper), fvPatchField<Type>(ptf, p, iF, mapper),
gradient_(ptf.gradient_, mapper) gradient_(ptf.gradient_, mapper)
{ {
if (&iF && mapper.hasUnmapped()) if (notNull(iF) && mapper.hasUnmapped())
{ {
WarningIn WarningIn
( (

View File

@ -66,7 +66,7 @@ fixedValueFvPatchField<Type>::fixedValueFvPatchField
: :
fvPatchField<Type>(ptf, p, iF, mapper) fvPatchField<Type>(ptf, p, iF, mapper)
{ {
if (&iF && mapper.hasUnmapped()) if (notNull(iF) && mapper.hasUnmapped())
{ {
WarningIn WarningIn
( (

View File

@ -60,7 +60,7 @@ mixedFvPatchField<Type>::mixedFvPatchField
refGrad_(ptf.refGrad_, mapper), refGrad_(ptf.refGrad_, mapper),
valueFraction_(ptf.valueFraction_, mapper) valueFraction_(ptf.valueFraction_, mapper)
{ {
if (&iF && mapper.hasUnmapped()) if (notNull(iF) && mapper.hasUnmapped())
{ {
WarningIn WarningIn
( (

View File

@ -60,7 +60,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
gradient().map(ptf.gradient(), mapper); gradient().map(ptf.gradient(), mapper);
// Evaluate the value field from the gradient if the internal field is valid // Evaluate the value field from the gradient if the internal field is valid
if (&iF && iF.size()) if (notNull(iF) && iF.size())
{ {
scalarField::operator= scalarField::operator=
( (

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -65,7 +65,7 @@ Foam::uniformInletOutletFvPatchField<Type>::uniformInletOutletFvPatchField
this->valueFraction() = 0.0; this->valueFraction() = 0.0;
// Map value (unmapped get refValue) // Map value (unmapped get refValue)
if (&iF && iF.size()) if (notNull(iF) && iF.size())
{ {
fvPatchField<Type>::operator=(this->refValue()); fvPatchField<Type>::operator=(this->refValue());
} }

View File

@ -98,7 +98,7 @@ Foam::fvPatchField<Type>::fvPatchField
patchType_(ptf.patchType_) patchType_(ptf.patchType_)
{ {
// For unmapped faces set to internal field value (zero-gradient) // For unmapped faces set to internal field value (zero-gradient)
if (&iF && iF.size()) if (notNull(iF) && iF.size())
{ {
fvPatchField<Type>::operator=(this->patchInternalField()); fvPatchField<Type>::operator=(this->patchInternalField());
} }
@ -250,7 +250,7 @@ void Foam::fvPatchField<Type>::autoMap
if if
( (
mapper.direct() mapper.direct()
&& &mapper.directAddressing() && notNull(mapper.directAddressing())
&& mapper.directAddressing().size() && mapper.directAddressing().size()
) )
{ {

View File

@ -98,7 +98,7 @@ const Foam::tensorField& Foam::EulerCoordinateRotation::Tr() const
( (
"const tensorField& EulerCoordinateRotation::Tr() const" "const tensorField& EulerCoordinateRotation::Tr() const"
); );
return *reinterpret_cast<const tensorField*>(0); return NullObjectRef<tensorField>();
} }

View File

@ -99,7 +99,7 @@ const Foam::tensorField& Foam::STARCDCoordinateRotation::Tr() const
( (
"const tensorField& STARCDCoordinateRotatio::Tr() const" "const tensorField& STARCDCoordinateRotatio::Tr() const"
); );
return *reinterpret_cast<const tensorField*>(0); return NullObjectRef<tensorField>();
} }

View File

@ -172,7 +172,7 @@ const Foam::tensorField& Foam::axesRotation::Tr() const
( (
"const Foam::tensorField& axesRotation::Tr() const" "const Foam::tensorField& axesRotation::Tr() const"
); );
return *reinterpret_cast<const tensorField*>(0); return NullObjectRef<tensorField>();
} }

View File

@ -151,7 +151,7 @@ const solidThermo& noThermo::thermo() const
FatalErrorIn("const volScalarField& noThermo::T() const") FatalErrorIn("const volScalarField& noThermo::T() const")
<< "T field not available for " << type() << "T field not available for " << type()
<< abort(FatalError); << abort(FatalError);
return *reinterpret_cast<const solidThermo*>(NULL); return NullObjectRef<solidThermo>();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,7 +30,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * 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) // be positive (and not just rounding noise)
//! \cond localScope //! \cond localScope
const Foam::scalar zeroish = Foam::SMALL; const Foam::scalar zeroish = Foam::SMALL;
@ -39,7 +39,6 @@ const Foam::scalar positive = Foam::SMALL * 1E3;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Find cut cells
void Foam::cuttingPlane::calcCutCells void Foam::cuttingPlane::calcCutCells
( (
const primitiveMesh& mesh, const primitiveMesh& mesh,
@ -51,7 +50,7 @@ void Foam::cuttingPlane::calcCutCells
const edgeList& edges = mesh.edges(); const edgeList& edges = mesh.edges();
label listSize = cellEdges.size(); label listSize = cellEdges.size();
if (&cellIdLabels) if (notNull(cellIdLabels))
{ {
listSize = cellIdLabels.size(); listSize = cellIdLabels.size();
} }
@ -64,7 +63,8 @@ void Foam::cuttingPlane::calcCutCells
for (label listI = 0; listI < listSize; ++listI) for (label listI = 0; listI < listSize; ++listI)
{ {
label cellI = listI; label cellI = listI;
if (&cellIdLabels)
if (notNull(cellIdLabels))
{ {
cellI = cellIdLabels[listI]; 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 void Foam::cuttingPlane::intersectEdges
( (
const primitiveMesh& mesh, 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 bool Foam::cuttingPlane::walkCell
( (
const primitiveMesh& mesh, 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 void Foam::cuttingPlane::walkCellCuts
( (
const primitiveMesh& mesh, const primitiveMesh& mesh,
@ -367,7 +361,6 @@ Foam::cuttingPlane::cuttingPlane
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// recut mesh with existing planeDesc
void Foam::cuttingPlane::reCut void Foam::cuttingPlane::reCut
( (
const primitiveMesh& mesh, const primitiveMesh& mesh,
@ -393,14 +386,13 @@ void Foam::cuttingPlane::reCut
} }
// remap action on triangulation
void Foam::cuttingPlane::remapFaces void Foam::cuttingPlane::remapFaces
( (
const labelUList& faceMap const labelUList& faceMap
) )
{ {
// recalculate the cells cut // recalculate the cells cut
if (&faceMap && faceMap.size()) if (notNull(faceMap) && faceMap.size())
{ {
MeshStorage::remapFaces(faceMap); MeshStorage::remapFaces(faceMap);
@ -413,6 +405,7 @@ void Foam::cuttingPlane::remapFaces
} }
} }
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::cuttingPlane::operator=(const cuttingPlane& rhs) void Foam::cuttingPlane::operator=(const cuttingPlane& rhs)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -203,7 +203,7 @@ bool Foam::sampledPatch::update()
void Foam::sampledPatch::remapFaces(const labelUList& faceMap) void Foam::sampledPatch::remapFaces(const labelUList& faceMap)
{ {
// recalculate the cells cut // recalculate the cells cut
if (&faceMap && faceMap.size()) if (notNull(faceMap) && faceMap.size())
{ {
MeshStorage::remapFaces(faceMap); MeshStorage::remapFaces(faceMap);
patchFaceLabels_ = labelList patchFaceLabels_ = labelList

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -433,7 +433,7 @@ void Foam::MeshedSurface<Face>::remapFaces
) )
{ {
// recalculate the zone start/size // recalculate the zone start/size
if (&faceMap && faceMap.size()) if (notNull(faceMap) && faceMap.size())
{ {
surfZoneList& zones = storedZones(); surfZoneList& zones = storedZones();
@ -526,17 +526,17 @@ void Foam::MeshedSurface<Face>::reset
// Take over new primitive data. // Take over new primitive data.
// Optimized to avoid overwriting data at all // Optimized to avoid overwriting data at all
if (&pointLst) if (notNull(pointLst))
{ {
storedPoints().transfer(pointLst()); storedPoints().transfer(pointLst());
} }
if (&faceLst) if (notNull(faceLst))
{ {
storedFaces().transfer(faceLst()); storedFaces().transfer(faceLst());
} }
if (&zoneLst) if (notNull(zoneLst))
{ {
storedZones().transfer(zoneLst()); storedZones().transfer(zoneLst());
} }
@ -555,17 +555,17 @@ void Foam::MeshedSurface<Face>::reset
// Take over new primitive data. // Take over new primitive data.
// Optimized to avoid overwriting data at all // Optimized to avoid overwriting data at all
if (&pointLst) if (notNull(pointLst))
{ {
storedPoints().transfer(pointLst()); storedPoints().transfer(pointLst());
} }
if (&faceLst) if (notNull(faceLst))
{ {
storedFaces().transfer(faceLst()); storedFaces().transfer(faceLst());
} }
if (&zoneLst) if (notNull(zoneLst))
{ {
storedZones().transfer(zoneLst()); storedZones().transfer(zoneLst());
} }
@ -860,7 +860,7 @@ Foam::label Foam::MeshedSurface<Face>::triangulate
// nothing to do // nothing to do
if (nTri <= faceLst.size()) if (nTri <= faceLst.size())
{ {
if (&faceMapOut) if (notNull(faceMapOut))
{ {
faceMapOut.clear(); faceMapOut.clear();
} }
@ -871,7 +871,7 @@ Foam::label Foam::MeshedSurface<Face>::triangulate
List<label> faceMap; List<label> faceMap;
// reuse storage from optional faceMap // reuse storage from optional faceMap
if (&faceMapOut) if (notNull(faceMapOut))
{ {
faceMap.transfer(faceMapOut); faceMap.transfer(faceMapOut);
} }
@ -928,7 +928,7 @@ Foam::label Foam::MeshedSurface<Face>::triangulate
remapFaces(faceMap); remapFaces(faceMap);
// optionally return the faceMap // optionally return the faceMap
if (&faceMapOut) if (notNull(faceMapOut))
{ {
faceMapOut.transfer(faceMap); faceMapOut.transfer(faceMap);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -469,7 +469,7 @@ inline label MeshedSurface<triFace>::triangulate()
template<> template<>
inline label MeshedSurface<triFace>::triangulate(List<label>& faceMap) inline label MeshedSurface<triFace>::triangulate(List<label>& faceMap)
{ {
if (&faceMap) if (notNull(faceMap))
{ {
faceMap.clear(); faceMap.clear();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -88,12 +88,12 @@ void Foam::MeshedSurfaceIOAllocator::resetFaces
const Xfer<surfZoneList>& zones const Xfer<surfZoneList>& zones
) )
{ {
if (&faces) if (notNull(faces))
{ {
faces_.transfer(faces()); faces_.transfer(faces());
} }
if (&zones) if (notNull(zones))
{ {
zones_.transfer(zones()); zones_.transfer(zones());
} }
@ -109,7 +109,7 @@ void Foam::MeshedSurfaceIOAllocator::reset
{ {
// Take over new primitive data. // Take over new primitive data.
// Optimized to avoid overwriting data at all // Optimized to avoid overwriting data at all
if (&points) if (notNull(points))
{ {
points_.transfer(points()); points_.transfer(points());
} }
@ -127,7 +127,7 @@ void Foam::MeshedSurfaceIOAllocator::reset
{ {
// Take over new primitive data. // Take over new primitive data.
// Optimized to avoid overwriting data at all // Optimized to avoid overwriting data at all
if (&points) if (notNull(points))
{ {
points_.transfer(points()); points_.transfer(points());
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -401,7 +401,7 @@ void Foam::UnsortedMeshedSurface<Face>::remapFaces
) )
{ {
// re-assign the zone Ids // re-assign the zone Ids
if (&faceMap && faceMap.size()) if (notNull(faceMap) && faceMap.size())
{ {
if (zoneToc_.empty()) if (zoneToc_.empty())
{ {
@ -612,7 +612,7 @@ void Foam::UnsortedMeshedSurface<Face>::reset
Xfer<surfZoneList>() Xfer<surfZoneList>()
); );
if (&zoneIds) if (notNull(zoneIds))
{ {
zoneIds_.transfer(zoneIds()); zoneIds_.transfer(zoneIds());
} }
@ -634,7 +634,7 @@ void Foam::UnsortedMeshedSurface<Face>::reset
Xfer<surfZoneList>() Xfer<surfZoneList>()
); );
if (&zoneIds) if (notNull(zoneIds))
{ {
zoneIds_.transfer(zoneIds()); zoneIds_.transfer(zoneIds());
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -209,7 +209,7 @@ Foam::surfMesh::surfMesh
} }
// We can also send Xfer<..>::null just to initialize without allocating // We can also send Xfer<..>::null just to initialize without allocating
if (&surf) if (notNull(surf))
{ {
transfer(surf()); transfer(surf());
} }

View File

@ -503,7 +503,7 @@ const Foam::speciesTable& Foam::Reaction<ReactionThermo>::gasSpecies() const
"const speciesTable& gasSpecies() const" "const speciesTable& gasSpecies() const"
" for this reaction" " for this reaction"
); );
return *reinterpret_cast<speciesTable*>(0); return NullObjectRef<speciesTable>();
} }
@ -516,7 +516,7 @@ Foam::Reaction<ReactionThermo>::glhs() const
"inline const List<typename Reaction<ReactionThermo>::specieCoeffs>&" "inline const List<typename Reaction<ReactionThermo>::specieCoeffs>&"
"Reaction<ReactionThermo>::glhs()" "Reaction<ReactionThermo>::glhs()"
); );
return *reinterpret_cast<List<specieCoeffs>*>(0); return NullObjectRef<List<specieCoeffs> >();
} }
@ -529,7 +529,8 @@ Foam::Reaction<ReactionThermo>::grhs() const
"inline const List<typename Reaction<ReactionThermo>::specieCoeffs>&" "inline const List<typename Reaction<ReactionThermo>::specieCoeffs>&"
"Reaction<ReactionThermo>::grhs()" "Reaction<ReactionThermo>::grhs()"
); );
return *reinterpret_cast<List<specieCoeffs>*>(0); return NullObjectRef<List<specieCoeffs> >();
} }
// ************************************************************************* // // ************************************************************************* //