18 #ifndef viskores_exec_PointLocatorSparseGrid_h
19 #define viskores_exec_PointLocatorSparseGrid_h
40 typename viskores::cont::CoordinateSystem::MultiplexerArrayType::ReadPortalType;
53 , Dxdydz((max - Min) / Dims)
56 , CellLower(cellLower)
57 , CellUpper(cellUpper)
80 nearestNeighborId = -1;
81 distance2 = viskores::Infinity<viskores::FloatDefault>();
83 this->FindInCell(queryPoint, ijk, nearestNeighborId, distance2);
87 viskores::Max(viskores::Max(this->Dims[0], this->Dims[1]), this->Dims[2]);
89 for (level = 1; (nearestNeighborId < 0) && (level < maxLevel); ++level)
91 this->FindInBox(queryPoint, ijk, level, nearestNeighborId, distance2);
97 this->FindInBox(queryPoint, ijk, level, nearestNeighborId, distance2);
117 ijk[0] + (ijk[1] * this->Dims[0]) + (ijk[2] * this->Dims[0] * this->Dims[1]);
120 for (
viskores::Id index = lower; index < upper; index++)
125 if (distance2 < nearestDistance2)
127 nearestNeighborId = pointid;
128 nearestDistance2 = distance2;
139 if ((boxCenter[0] - level) >= 0)
141 this->FindInXPlane(queryPoint,
147 if ((boxCenter[0] + level) < this->Dims[0])
149 this->FindInXPlane(queryPoint,
156 if ((boxCenter[1] - level) >= 0)
158 this->FindInYPlane(queryPoint,
164 if ((boxCenter[1] + level) < this->Dims[1])
166 this->FindInYPlane(queryPoint,
173 if ((boxCenter[2] - level) >= 0)
175 this->FindInZPlane(queryPoint,
181 if ((boxCenter[2] + level) < this->Dims[2])
183 this->FindInZPlane(queryPoint,
200 for (
viskores::Id index = 0; index < numInPlane; ++index)
203 viskores::Id3(index % mod[0], index % mod[1], index % mod[2]) + origin;
204 if ((ijk[0] >= 0) && (ijk[0] < this->Dims[0]) && (ijk[1] >= 0) && (ijk[1] < this->Dims[1]) &&
205 (ijk[2] >= 0) && (ijk[2] < this->Dims[2]))
207 this->FindInCell(queryPoint, ijk, nearestNeighborId, nearestDistance2);
220 viskores::Id3 div = { yWidth * zWidth, yWidth * zWidth, yWidth };
225 queryPoint, planeCenter, div, mod, origin, numInPlane, nearestNeighborId, nearestDistance2);
236 viskores::Id3 div = { xWidth * zWidth, xWidth * zWidth, xWidth };
241 queryPoint, planeCenter, div, mod, origin, numInPlane, nearestNeighborId, nearestDistance2);
252 viskores::Id3 div = { xWidth * yWidth, xWidth, xWidth * yWidth };
257 queryPoint, planeCenter, div, mod, origin, numInPlane, nearestNeighborId, nearestDistance2);
264 #endif // viskores_exec_PointLocatorSparseGrid_h