diff --git a/src/meshTools/indexedOctree/treeDataPoint.C b/src/meshTools/indexedOctree/treeDataPoint.C
index bffd4726de41da0ee2945c5ad3344e034f2ecf97..b5c52d4af6ffcb8f9babca050eab4e6ced56093b 100644
--- a/src/meshTools/indexedOctree/treeDataPoint.C
+++ b/src/meshTools/indexedOctree/treeDataPoint.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2004-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2004-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -26,7 +26,6 @@ License
 #include "treeDataPoint.H"
 #include "treeBoundBox.H"
 #include "indexedOctree.H"
-#include "polyMesh.H"
 #include "triangleFuncs.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@@ -42,6 +41,17 @@ Foam::treeDataPoint::treeDataPoint(const pointField& points)
 {}
 
 
+Foam::treeDataPoint::treeDataPoint
+(
+    const pointField& points,
+    const labelList& pointLabels
+)
+:
+    points_(points),
+    pointLabels_(pointLabels)
+{}
+
+
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 Foam::pointField Foam::treeDataPoint::points() const
@@ -69,7 +79,8 @@ bool Foam::treeDataPoint::overlaps
     const treeBoundBox& cubeBb
 ) const
 {
-    return cubeBb.contains(points_[index]);
+    label pointI = (pointLabels_.size() ? pointLabels_[index] : index);
+    return cubeBb.contains(points_[pointI]);
 }
 
 
@@ -88,8 +99,9 @@ void Foam::treeDataPoint::findNearest
     forAll(indices, i)
     {
         const label index = indices[i];
+        label pointI = (pointLabels_.size() ? pointLabels_[index] : index);
 
-        const point& pt = points_[index];
+        const point& pt = points_[pointI];
 
         scalar distSqr = magSqr(pt - sample);
 
@@ -122,8 +134,9 @@ void Foam::treeDataPoint::findNearest
     forAll(indices, i)
     {
         const label index = indices[i];
+        label pointI = (pointLabels_.size() ? pointLabels_[index] : index);
 
-        const point& shapePt = points_[index];
+        const point& shapePt = points_[pointI];
 
         if (tightest.contains(shapePt))
         {
diff --git a/src/meshTools/indexedOctree/treeDataPoint.H b/src/meshTools/indexedOctree/treeDataPoint.H
index 20b7dae2b6a1b514c3050578458299ccc67d94fd..4f67b15a3fc6686a40c13b020f697ee9ae2befa8 100644
--- a/src/meshTools/indexedOctree/treeDataPoint.H
+++ b/src/meshTools/indexedOctree/treeDataPoint.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2004-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2004-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,6 +30,8 @@ Description
     Used for searching for nearest point. No bounding boxes around points.
     Only overlaps and calcNearest are implemented, rest makes little sense.
 
+    Optionally works on subset of points.
+
 SourceFiles
     treeDataPoint.C
 
@@ -60,6 +62,9 @@ class treeDataPoint
 
         const pointField& points_;
 
+        //- Subset of points to work on (or empty)
+        const labelList pointLabels_;
+
 public:
 
     // Declare name of the class and its debug switch
@@ -68,9 +73,12 @@ public:
 
     // Constructors
 
-        //- Construct from components. Holds reference to points!
+        //- Construct from pointField. Holds reference!
         treeDataPoint(const pointField&);
 
+        //- Construct from subset of pointField. Holds reference!
+        treeDataPoint(const pointField&, const labelList&);
+
 
     // Member Functions
 
@@ -81,6 +89,11 @@ public:
                 return points_.size();
             }
 
+            inline const labelList& pointLabels() const
+            {
+                return pointLabels_;
+            }
+
             //- Get representative point cloud for all shapes inside
             //  (one point per shape)
             pointField points() const;