Commit c7bc9216 authored by mattijs's avatar mattijs
Browse files

ENH: indexedOctree : renamed find to findInside, changed findIndices to return reference.

parent 4e1e1c9c
......@@ -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
......
......@@ -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<class Type>
static const List<Type>& emptyList()
{
return *reinterpret_cast<const List<Type>* >(&emptyLabelList);
}
//- Renumber the values (not the indices) of a list.
// Negative ListType elements are left as is.
template<class ListType>
......
......@@ -2497,7 +2497,7 @@ Foam::labelBits Foam::indexedOctree<Type>::findNode
template <class Type>
Foam::label Foam::indexedOctree<Type>::find(const point& sample) const
Foam::label Foam::indexedOctree<Type>::findInside(const point& sample) const
{
labelBits index = findNode(0, sample);
......@@ -2526,7 +2526,7 @@ Foam::label Foam::indexedOctree<Type>::find(const point& sample) const
template <class Type>
Foam::labelList Foam::indexedOctree<Type>::findIndices
const Foam::labelList& Foam::indexedOctree<Type>::findIndices
(
const point& sample
) const
......@@ -2544,7 +2544,7 @@ Foam::labelList Foam::indexedOctree<Type>::findIndices
}
else
{
return labelList(0);
return emptyList<label>();
}
}
......
......@@ -552,11 +552,12 @@ public:
// Use getNode and getOctant to extract info, or call findIndices.
labelBits findNode(const label nodeI, const point&) const;
//- Find shape containing point in tree
label find(const point&) const;
//- Find shape containing point. Only implemented for certain
// shapes.
label findInside(const point&) const;
//- Find the shape indices that occupy the result of findNode
labelList findIndices(const point&) const;
const labelList& findIndices(const point&) const;
//- Determine type (inside/outside/mixed) for point. unknown if
// cannot be determined (e.g. non-manifold surface)
......
......@@ -745,7 +745,7 @@ Foam::label Foam::meshSearch::findCell
{
if (useTreeSearch)
{
return cellTree().find(location);
return cellTree().findInside(location);
}
else
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment