diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOps.C b/src/OpenFOAM/containers/Lists/ListOps/ListOps.C index 47fc409a2a..96b1b30182 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOps.C +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOps.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,12 @@ License #include "ListOps.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +const Foam::labelList Foam::emptyLabelList = Foam::labelList(0); + + // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // Foam::labelList Foam::invert diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H index 98cb8cf89e..ce16f5431a 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,6 +43,16 @@ SourceFiles namespace Foam { +extern const labelList emptyLabelList; + +//- Return reference to zero-sized list. Compare to List::null() which returns +// null pointer cast as list reference. +template +static const List& emptyList() +{ + return *reinterpret_cast* >(&emptyLabelList); +} + //- Renumber the values (not the indices) of a list. // Negative ListType elements are left as is. template diff --git a/src/meshTools/indexedOctree/indexedOctree.C b/src/meshTools/indexedOctree/indexedOctree.C index c251ccfc44..2f1e13648b 100644 --- a/src/meshTools/indexedOctree/indexedOctree.C +++ b/src/meshTools/indexedOctree/indexedOctree.C @@ -2497,7 +2497,7 @@ Foam::labelBits Foam::indexedOctree::findNode template -Foam::label Foam::indexedOctree::find(const point& sample) const +Foam::label Foam::indexedOctree::findInside(const point& sample) const { labelBits index = findNode(0, sample); @@ -2526,7 +2526,7 @@ Foam::label Foam::indexedOctree::find(const point& sample) const template -Foam::labelList Foam::indexedOctree::findIndices +const Foam::labelList& Foam::indexedOctree::findIndices ( const point& sample ) const @@ -2544,7 +2544,7 @@ Foam::labelList Foam::indexedOctree::findIndices } else { - return labelList(0); + return emptyList