mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: indexedOctree : renamed find to findInside, changed findIndices to return reference.
This commit is contained in:
@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user