Viskores  1.0
KernelSplatter.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_worklet_KernelSplatter_h
19 #define viskores_worklet_KernelSplatter_h
20 
21 #include <viskores/Math.h>
22 
28 #include <viskores/cont/DataSet.h>
30 #include <viskores/cont/Timer.h>
31 
35 
36 #include <viskores/worklet/splatkernels/Gaussian.h>
37 #include <viskores/worklet/splatkernels/KernelBase.h>
38 #include <viskores/worklet/splatkernels/Spline3rdOrder.h>
39 
40 //#define __VISKORES_GAUSSIAN_SPLATTER_BENCHMARK
41 
42 //----------------------------------------------------------------------------
43 // Macros for timing
44 //----------------------------------------------------------------------------
45 #if defined(__VISKORES_GAUSSIAN_SPLATTER_BENCHMARK) && !defined(START_TIMER_BLOCK)
46 // start timer
47 #define START_TIMER_BLOCK(name) \
48  viskores::cont::Timer timer_##name{ DeviceAdapter() }; \
49  timer_##name.Start();
50 
51 // stop timer
52 #define END_TIMER_BLOCK(name) \
53  std::cout << #name " : elapsed : " << timer_##name.GetElapsedTime() << "\n";
54 #endif
55 #if !defined(START_TIMER_BLOCK)
56 #define START_TIMER_BLOCK(name)
57 #define END_TIMER_BLOCK(name)
58 #endif
59 
60 //----------------------------------------------------------------------------
61 // Kernel splatter worklet/filter
62 //----------------------------------------------------------------------------
63 namespace viskores
64 {
65 namespace worklet
66 {
67 
68 namespace debug
69 {
70 #ifdef DEBUG_PRINT
71 //----------------------------------------------------------------------------
72 template <typename T, typename S = VISKORES_DEFAULT_STORAGE_TAG>
73 void OutputArrayDebug(const viskores::cont::ArrayHandle<T, S>& outputArray, const std::string& name)
74 {
75  using ValueType = T;
76  using StorageType = viskores::cont::internal::Storage<T, S>;
77  using PortalConstType = typename StorageType::PortalConstType;
78  PortalConstType readPortal = outputArray.ReadPortal();
80  std::vector<ValueType> result(readPortal.GetNumberOfValues());
81  std::copy(iterators.GetBegin(), iterators.GetEnd(), result.begin());
82  std::cout << name.c_str() << " " << outputArray.GetNumberOfValues() << "\n";
83  std::copy(result.begin(), result.end(), std::ostream_iterator<ValueType>(std::cout, " "));
84  std::cout << std::endl;
85 }
86 
87 //----------------------------------------------------------------------------
88 template <typename T, int S>
90  const std::string& name)
91 {
92  using ValueType = T;
93  using PortalConstType = typename viskores::cont::ArrayHandle<viskores::Vec<T, S>>::ReadPortalType;
94  PortalConstType readPortal = outputArray.ReadPortal();
96  std::cout << name.c_str() << " " << outputArray.GetNumberOfValues() << "\n";
97  auto portal = outputArray.ReadPortal();
98  for (int i = 0; i < outputArray.GetNumberOfValues(); ++i)
99  {
100  std::cout << portal.Get(i);
101  }
102  std::cout << std::endl;
103 }
104 //----------------------------------------------------------------------------
105 template <typename I, typename T, int S>
106 void OutputArrayDebug(
108  outputArray,
109  const std::string& name)
110 {
111  using PortalConstType = typename viskores::cont::
112  ArrayHandlePermutation<I, viskores::cont::ArrayHandle<viskores::Vec<T, S>>>::ReadPortalType;
113  PortalConstType readPortal = outputArray.ReadPortal();
115  std::cout << name.c_str() << " " << outputArray.GetNumberOfValues() << "\n";
116  auto outputPortal = outputArray.ReadPortal();
117  for (int i = 0; i < outputArray.GetNumberOfValues(); ++i)
118  {
119  std::cout << outputPortal.Get(i);
120  }
121  std::cout << std::endl;
122 }
123 
124 #else
125 template <typename T, typename S>
127  const std::string& viskoresNotUsed(name))
128 {
129 }
130 //----------------------------------------------------------------------------
131 template <typename T, int S>
134  const std::string& viskoresNotUsed(name))
135 {
136 }
137 //----------------------------------------------------------------------------
138 template <typename I, typename T, int S>
141  viskoresNotUsed(outputArray),
142  const std::string& viskoresNotUsed(name))
143 {
144 }
145 #endif
146 } // namespace debug
147 
148 template <typename Kernel, typename DeviceAdapter>
150 {
155  //
159  //
164  //
166 
167  //-----------------------------------------------------------------------
168  // zero an array,
169  // @TODO, get rid of this
170  //-----------------------------------------------------------------------
172  {
174  using ExecutionSignature = void(_1, WorkIndex, _2);
175  //
178 
179  template <typename T>
181  const viskores::Id& viskoresNotUsed(index),
182  T& voxel_value) const
183  {
184  voxel_value = T(0);
185  }
186  };
187 
188  //-----------------------------------------------------------------------
189  // Return the splat footprint/neighborhood of each sample point, as
190  // represented by min and max boundaries in each dimension.
191  // Also return the size of this footprint and the voxel coordinates
192  // of the splat point (floating point).
193  //-----------------------------------------------------------------------
195  {
196  private:
200  Kernel kernel_;
201 
202  public:
203  using ControlSignature =
205  using ExecutionSignature = void(_1, _2, _3, _4, _5, _6, _7, _8);
206 
209  const viskores::Vec3f_64& s,
210  const viskores::Id3& dim,
211  const Kernel& kernel)
212  : origin_(o)
213  , spacing_(s)
214  , VolumeDimensions(dim)
215  , kernel_(kernel)
216  {
217  }
218 
219  template <typename T, typename T2>
221  const T& y,
222  const T& z,
223  const T2& h,
224  viskores::Vec3f_64& splatPoint,
225  viskores::Id3& minFootprint,
226  viskores::Id3& maxFootprint,
227  viskores::Id& footprintSize) const
228  {
229  PointType splat, min, max;
230  viskores::Vec3f_64 sample = viskores::make_Vec(x, y, z);
231  viskores::Id size = 1;
232  double cutoff = kernel_.maxDistance(h);
233  for (int i = 0; i < 3; i++)
234  {
235  splat[i] = (sample[i] - this->origin_[i]) / this->spacing_[i];
236  min[i] = static_cast<viskores::Id>(ceil(static_cast<double>(splat[i]) - cutoff));
237  max[i] = static_cast<viskores::Id>(floor(static_cast<double>(splat[i]) + cutoff));
238  if (min[i] < 0)
239  {
240  min[i] = 0;
241  }
242  if (max[i] >= this->VolumeDimensions[i])
243  {
244  max[i] = this->VolumeDimensions[i] - 1;
245  }
246  size = static_cast<viskores::Id>(size * (1 + max[i] - min[i]));
247  }
248  splatPoint = splat;
249  minFootprint = min;
250  maxFootprint = max;
251  footprintSize = size;
252  }
253  };
254 
255  //-----------------------------------------------------------------------
256  // Return the "local" Id of a voxel within a splat point's footprint.
257  // A splat point that affects 5 neighboring voxel gridpoints would
258  // have local Ids 0,1,2,3,4
259  //-----------------------------------------------------------------------
261  {
262  public:
264  using ExecutionSignature = void(_1, _2, WorkIndex, _3);
265 
268 
269  template <typename T>
270  VISKORES_EXEC_CONT void operator()(const T& modulus,
271  const T& offset,
272  const viskores::Id& index,
273  T& localId) const
274  {
275  localId = (index - offset) % modulus;
276  }
277  };
278 
279  //-----------------------------------------------------------------------
280  // Compute the splat value of the input neighbour point.
281  // The voxel Id of this point within the volume is also determined.
282  //-----------------------------------------------------------------------
284  {
285  private:
292  Kernel kernel;
293 
294  public:
295  using ControlSignature =
297  using ExecutionSignature = void(_1, _2, _3, _4, _5, _6, _7, _8);
298 
301  const viskores::Vec3f_64& s,
302  const viskores::Id3& dim,
303  const Kernel& k)
304  : spacing_(s)
305  , origin_(orig)
306  , VolumeDim(dim)
307  , kernel(k)
308  {
309  }
310 
311  template <typename T, typename T2, typename P>
313  const T& minBound,
314  const T& maxBound,
315  const T2& kernel_H,
316  const T2& scale,
317  const viskores::Id localNeighborId,
318  viskores::Id& neighborVoxelId,
319  viskores::Float32& splatValue) const
320  {
321  viskores::Id yRange = 1 + maxBound[1] - minBound[1];
322  viskores::Id xRange = 1 + maxBound[0] - minBound[0];
323  viskores::Id divisor = yRange * xRange;
324  viskores::Id i = localNeighborId / divisor;
325  viskores::Id remainder = localNeighborId % divisor;
326  viskores::Id j = remainder / xRange;
327  viskores::Id k = remainder % xRange;
328  // note the order of k,j,i
329  viskores::Id3 voxel = minBound + viskores::make_Vec(k, j, i);
330  PointType dist = viskores::make_Vec((splatPoint[0] - voxel[0]) * spacing_[0],
331  (splatPoint[1] - voxel[1]) * spacing_[0],
332  (splatPoint[2] - voxel[2]) * spacing_[0]);
333  viskores::Float64 dist2 = viskores::Dot(dist, dist);
334 
335  // Compute splat value using the kernel distance_squared function
336  splatValue = scale * kernel.w2(kernel_H, dist2);
337  //
338  neighborVoxelId =
339  (voxel[2] * VolumeDim[0] * VolumeDim[1]) + (voxel[1] * VolumeDim[0]) + voxel[0];
340  if (neighborVoxelId < 0)
341  neighborVoxelId = -1;
342  else if (neighborVoxelId >= VolumeDim[0] * VolumeDim[1] * VolumeDim[2])
343  neighborVoxelId = VolumeDim[0] * VolumeDim[1] * VolumeDim[2] - 1;
344  }
345  };
346 
347  //-----------------------------------------------------------------------
348  // Scatter worklet that writes a splat value into the larger,
349  // master splat value array, using the splat value's voxel Id as an index.
350  //-----------------------------------------------------------------------
352  {
353  public:
354  using ControlSignature = void(FieldIn, FieldIn, WholeArrayOut);
355  using ExecutionSignature = void(_1, _2, _3);
356 
359 
360  template <typename ExecArgPortalType>
362  const viskores::Float64& splatValue,
363  ExecArgPortalType& execArg) const
364  {
365  execArg.Set(voxelIndex, static_cast<viskores::Float32>(splatValue));
366  }
367  };
368 
369  //-----------------------------------------------------------------------
370  // Construct a splatter filter/object
371  //
372  // @TODO, get the origin_ and spacing_ from the dataset coordinates
373  // instead of requiring them to be passed as parameters.
374  //-----------------------------------------------------------------------
376  viskores::Vec3f origin,
377  viskores::Vec3f spacing,
378  const viskores::cont::DataSet& dataset,
379  const Kernel& kernel)
380  : dims_(dims)
381  , origin_(origin)
382  , spacing_(spacing)
383  , dataset_(dataset)
384  , kernel_(kernel)
385  {
386  }
387 
388  //-----------------------------------------------------------------------
389  // class variables for the splat filter
390  //-----------------------------------------------------------------------
395  // The kernel used for this filter
396  Kernel kernel_;
397 
398  //-----------------------------------------------------------------------
399  // Run the filter, given the input params
400  //-----------------------------------------------------------------------
401  template <typename StorageT>
407  FloatHandleType scalarSplatOutput)
408  {
409  // Number of grid points in the volume bounding box
410  viskores::Id3 pointDimensions = viskores::make_Vec(dims_[0] + 1, dims_[1] + 1, dims_[2] + 1);
411  const viskores::Id numVolumePoints = (dims_[0] + 1) * (dims_[1] + 1) * (dims_[2] + 1);
412 
413  //---------------------------------------------------------------
414  // Get the splat footprint/neighborhood of each sample point, as
415  // represented by min and max boundaries in each dimension.
416  //---------------------------------------------------------------
417  PointHandleType splatPoints;
418  VecHandleType footprintMin;
419  VecHandleType footprintMax;
420  IdHandleType numNeighbors;
421  IdHandleType localNeighborIds;
422 
423  GetFootprint footprint_worklet(origin_, spacing_, pointDimensions, kernel_);
424  viskores::worklet::DispatcherMapField<GetFootprint> footprintDispatcher(footprint_worklet);
425  footprintDispatcher.SetDevice(DeviceAdapter());
426 
428  footprintDispatcher.Invoke(
429  xValues, yValues, zValues, rValues, splatPoints, footprintMin, footprintMax, numNeighbors);
431 
432  debug::OutputArrayDebug(numNeighbors, "numNeighbours");
433  debug::OutputArrayDebug(footprintMin, "footprintMin");
434  debug::OutputArrayDebug(footprintMax, "footprintMax");
435  debug::OutputArrayDebug(splatPoints, "splatPoints");
436 
437  //---------------------------------------------------------------
438  // Prefix sum of the number of affected splat voxels ("neighbors")
439  // for each sample point. The total sum represents the number of
440  // voxels for which splat values will be computed.
441  // prefix sum is used in neighbour id lookup
442  //---------------------------------------------------------------
443  IdHandleType numNeighborsPrefixSum;
444 
445  START_TIMER_BLOCK(numNeighborsPrefixSum)
446  const viskores::Id totalSplatSize =
448  numNeighborsPrefixSum);
449  END_TIMER_BLOCK(numNeighborsPrefixSum)
450 
451  std::cout << "totalSplatSize " << totalSplatSize << "\n";
452  debug::OutputArrayDebug(numNeighborsPrefixSum, "numNeighborsPrefixSum");
453 
454  // also get the neighbour counts exclusive sum for use in lookup of local neighbour id
455  IdHandleType numNeighborsExclusiveSum;
456  START_TIMER_BLOCK(numNeighborsExclusiveSum)
458  numNeighborsExclusiveSum);
459  //END_TIMER_BLOCK(numNeighborsExclusiveSum)
460  debug::OutputArrayDebug(numNeighborsExclusiveSum, "numNeighborsExclusiveSum");
461 
462  //---------------------------------------------------------------
463  // Generate a lookup array that, for each splat voxel, identifies
464  // the Id of its corresponding (sample) splat point.
465  // For example, if splat point 0 affects 5 neighbor voxels, then
466  // the five entries in the lookup array would be 0,0,0,0,0
467  //---------------------------------------------------------------
468  IdHandleType neighbor2SplatId;
469  IdCountingType countingArray(viskores::Id(0), 1, viskores::Id(totalSplatSize));
470  START_TIMER_BLOCK(Upper_bounds)
472  numNeighborsPrefixSum, countingArray, neighbor2SplatId);
473  END_TIMER_BLOCK(Upper_bounds)
474  countingArray.ReleaseResources();
475  debug::OutputArrayDebug(neighbor2SplatId, "neighbor2SplatId");
476 
477  //---------------------------------------------------------------
478  // Extract a "local" Id lookup array of the foregoing
479  // neighbor2SplatId array. So, the local version of 0,0,0,0,0
480  // would be 0,1,2,3,4
481  //---------------------------------------------------------------
482  IdPermType modulii(neighbor2SplatId, numNeighbors);
483  debug::OutputArrayDebug(modulii, "modulii");
484 
485  IdPermType offsets(neighbor2SplatId, numNeighborsExclusiveSum);
486  debug::OutputArrayDebug(offsets, "offsets");
487 
489  idDispatcher.SetDevice(DeviceAdapter());
490  START_TIMER_BLOCK(idDispatcher)
491  idDispatcher.Invoke(modulii, offsets, localNeighborIds);
492  END_TIMER_BLOCK(idDispatcher)
493  debug::OutputArrayDebug(localNeighborIds, "localNeighborIds");
494 
495  numNeighbors.ReleaseResources();
496  numNeighborsPrefixSum.ReleaseResources();
497  numNeighborsExclusiveSum.ReleaseResources();
498 
499  //---------------------------------------------------------------
500  // We will perform gather operations for the generated splat points
501  // using permutation arrays
502  //---------------------------------------------------------------
503  PointVecPermType ptSplatPoints(neighbor2SplatId, splatPoints);
504  VecPermType ptFootprintMins(neighbor2SplatId, footprintMin);
505  VecPermType ptFootprintMaxs(neighbor2SplatId, footprintMax);
506  FloatPermType radii(neighbor2SplatId, rValues);
507  FloatPermType scale(neighbor2SplatId, sValues);
508 
509  debug::OutputArrayDebug(radii, "radii");
510  debug::OutputArrayDebug(ptSplatPoints, "ptSplatPoints");
511  debug::OutputArrayDebug(ptFootprintMins, "ptFootprintMins");
512 
513  //---------------------------------------------------------------
514  // Calculate the splat value of each affected voxel
515  //---------------------------------------------------------------
516  FloatHandleType voxelSplatSums;
517  IdHandleType neighborVoxelIds;
518  IdHandleType uniqueVoxelIds;
519  FloatHandleType splatValues;
520 
521  GetSplatValue splatterDispatcher_worklet(origin_, spacing_, pointDimensions, kernel_);
523  splatterDispatcher_worklet);
524  splatterDispatcher.SetDevice(DeviceAdapter());
525 
527  splatterDispatcher.Invoke(ptSplatPoints,
528  ptFootprintMins,
529  ptFootprintMaxs,
530  radii,
531  scale,
532  localNeighborIds,
533  neighborVoxelIds,
534  splatValues);
536 
537  debug::OutputArrayDebug(splatValues, "splatValues");
538  debug::OutputArrayDebug(neighborVoxelIds, "neighborVoxelIds");
539 
540  ptSplatPoints.ReleaseResources();
541  ptFootprintMins.ReleaseResources();
542  ptFootprintMaxs.ReleaseResources();
543  neighbor2SplatId.ReleaseResources();
544  localNeighborIds.ReleaseResources();
545  splatPoints.ReleaseResources();
546  footprintMin.ReleaseResources();
547  footprintMax.ReleaseResources();
548  radii.ReleaseResources();
549 
550  //---------------------------------------------------------------
551  // Sort the voxel Ids in ascending order
552  //---------------------------------------------------------------
553  START_TIMER_BLOCK(SortByKey)
555  END_TIMER_BLOCK(SortByKey)
556  debug::OutputArrayDebug(splatValues, "splatValues");
557 
558  //---------------------------------------------------------------
559  // Do a reduction to sum all contributions for each affected voxel
560  //---------------------------------------------------------------
561  START_TIMER_BLOCK(ReduceByKey)
563  neighborVoxelIds, splatValues, uniqueVoxelIds, voxelSplatSums, viskores::Add());
564  END_TIMER_BLOCK(ReduceByKey)
565 
566  debug::OutputArrayDebug(neighborVoxelIds, "neighborVoxelIds");
567  debug::OutputArrayDebug(uniqueVoxelIds, "uniqueVoxelIds");
568  debug::OutputArrayDebug(voxelSplatSums, "voxelSplatSums");
569  //
570  neighborVoxelIds.ReleaseResources();
571  splatValues.ReleaseResources();
572 
573  //---------------------------------------------------------------
574  // initialize each field value to zero to begin with
575  //---------------------------------------------------------------
576  IdCountingType indexArray(viskores::Id(0), 1, numVolumePoints);
578  zeroDispatcher.SetDevice(DeviceAdapter());
579  zeroDispatcher.Invoke(indexArray, scalarSplatOutput);
580  //
581  indexArray.ReleaseResources();
582 
583  //---------------------------------------------------------------
584  // Scatter operation to write the previously-computed splat
585  // value sums into their corresponding entries in the output array
586  //---------------------------------------------------------------
588  scatterDispatcher.SetDevice(DeviceAdapter());
589 
591  scatterDispatcher.Invoke(uniqueVoxelIds, voxelSplatSums, scalarSplatOutput);
593  debug::OutputArrayDebug(scalarSplatOutput, "scalarSplatOutput");
594  //
595  uniqueVoxelIds.ReleaseResources();
596  voxelSplatSums.ReleaseResources();
597  }
598 
599 }; //struct KernelSplatter
600 }
601 } //namespace viskores::worklet
602 
603 #endif //viskores_worklet_KernelSplatter_h
viskores::worklet::KernelSplatterFilterUniformGrid
Definition: KernelSplatter.h:149
ArrayHandle.h
viskores::cont::DeviceAdapterAlgorithm::UpperBounds
static void UpperBounds(const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< T, CVal > &values, viskores::cont::ArrayHandle< viskores::Id, COut > &output)
Output is the last index in input for each item in values that wouldn't alter the ordering of input.
viskores::cont::ArrayHandle::ReadPortal
ReadPortalType ReadPortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:447
viskores::worklet::KernelSplatterFilterUniformGrid::UpdateVoxelSplats
Definition: KernelSplatter.h:351
viskores::worklet::KernelSplatterFilterUniformGrid::spacing_
FloatVec spacing_
Definition: KernelSplatter.h:393
viskores::worklet::KernelSplatterFilterUniformGrid::zero_voxel::zero_voxel
zero_voxel()
Definition: KernelSplatter.h:177
viskores::cont::DataSet
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::worklet::KernelSplatterFilterUniformGrid::GetSplatValue::ExponentFactor
viskores::Float64 ExponentFactor
Definition: KernelSplatter.h:290
viskores::Vec3f_64
viskores::Vec< viskores::Float64, 3 > Vec3f_64
Vec3f_64 corresponds to a 3-dimensional vector of 64-bit floating point values.
Definition: Types.h:1076
viskores::worklet::KernelSplatterFilterUniformGrid::zero_voxel::ExecutionSignature
void(_1, WorkIndex, _2) ExecutionSignature
Definition: KernelSplatter.h:174
viskores::worklet::KernelSplatterFilterUniformGrid::GetSplatValue::origin_
viskores::Vec3f_64 origin_
Definition: KernelSplatter.h:287
WorkletMapField.h
viskores::worklet::KernelSplatterFilterUniformGrid::GetSplatValue::ExecutionSignature
void(_1, _2, _3, _4, _5, _6, _7, _8) ExecutionSignature
Definition: KernelSplatter.h:297
viskores::worklet::WorkletMapField::FieldIn
A control signature tag for input fields.
Definition: WorkletMapField.h:68
viskoresNotUsed
#define viskoresNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:136
viskores::worklet::KernelSplatterFilterUniformGrid::GetFootprint::GetFootprint
GetFootprint(const viskores::Vec3f_64 &o, const viskores::Vec3f_64 &s, const viskores::Id3 &dim, const Kernel &kernel)
Definition: KernelSplatter.h:208
viskores::worklet::KernelSplatterFilterUniformGrid::GetFootprint::VolumeDimensions
viskores::Id3 VolumeDimensions
Definition: KernelSplatter.h:199
viskores::worklet::KernelSplatterFilterUniformGrid::origin_
FloatVec origin_
Definition: KernelSplatter.h:392
ArrayHandleTransform.h
viskores::worklet::KernelSplatterFilterUniformGrid::UpdateVoxelSplats::ControlSignature
void(FieldIn, FieldIn, WholeArrayOut) ControlSignature
Definition: KernelSplatter.h:354
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
viskores::worklet::KernelSplatterFilterUniformGrid::GetFootprint
Definition: KernelSplatter.h:194
viskores::worklet::WorkletMapField::FieldOut
A control signature tag for output fields.
Definition: WorkletMapField.h:88
viskores::worklet::KernelSplatterFilterUniformGrid::UpdateVoxelSplats::operator()
void operator()(const viskores::Id &voxelIndex, const viskores::Float64 &splatValue, ExecArgPortalType &execArg) const
Definition: KernelSplatter.h:361
END_TIMER_BLOCK
#define END_TIMER_BLOCK(name)
Definition: KernelSplatter.h:57
viskores::worklet::KernelSplatterFilterUniformGrid::GetSplatValue::spacing_
viskores::Vec3f_64 spacing_
Definition: KernelSplatter.h:286
viskores::worklet::KernelSplatterFilterUniformGrid::zero_voxel::operator()
void operator()(const viskores::Id &, const viskores::Id &, T &voxel_value) const
Definition: KernelSplatter.h:180
viskores::worklet::KernelSplatterFilterUniformGrid::GetSplatValue::VolumeDim
viskores::Id3 VolumeDim
Definition: KernelSplatter.h:288
VISKORES_EXEC_CONT
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
viskores::worklet::KernelSplatterFilterUniformGrid::ComputeLocalNeighborId::ComputeLocalNeighborId
ComputeLocalNeighborId()
Definition: KernelSplatter.h:267
DeviceAdapterAlgorithm.h
viskores::cont::DeviceAdapterAlgorithm::ScanExclusive
static T ScanExclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Compute an exclusive prefix sum operation on the input ArrayHandle.
DispatcherMapField.h
viskores::Add
Definition: Types.h:268
viskores::worklet::KernelSplatterFilterUniformGrid::GetSplatValue::ControlSignature
void(FieldIn, FieldIn, FieldIn, FieldIn, FieldIn, FieldIn, FieldOut, FieldOut) ControlSignature
Definition: KernelSplatter.h:296
viskores::worklet::debug::OutputArrayDebug
void OutputArrayDebug(const viskores::cont::ArrayHandle< T, S > &, const std::string &)
Definition: KernelSplatter.h:126
viskores::worklet::KernelSplatterFilterUniformGrid::GetFootprint::origin_
viskores::Vec3f_64 origin_
Definition: KernelSplatter.h:197
viskores::worklet::KernelSplatterFilterUniformGrid::GetSplatValue::kernel
Kernel kernel
Definition: KernelSplatter.h:292
ArrayHandleUniformPointCoordinates.h
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores::cont::ArrayHandle::ReleaseResources
void ReleaseResources() const
Releases all resources in both the control and execution environments.
Definition: ArrayHandle.h:600
viskores::worklet::KernelSplatterFilterUniformGrid::GetSplatValue
Definition: KernelSplatter.h:283
viskores::cont::DeviceAdapterAlgorithm::SortByKey
static void SortByKey(viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values)
Unstable ascending sort of keys and values.
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
Math.h
viskores::worklet::KernelSplatterFilterUniformGrid::GetFootprint::spacing_
viskores::Vec3f_64 spacing_
Definition: KernelSplatter.h:198
viskores::worklet::KernelSplatterFilterUniformGrid::dataset_
viskores::cont::DataSet dataset_
Definition: KernelSplatter.h:394
viskores::worklet::DispatcherMapField
Dispatcher for worklets that inherit from WorkletMapField.
Definition: DispatcherMapField.h:33
START_TIMER_BLOCK
#define START_TIMER_BLOCK(name)
Definition: KernelSplatter.h:56
ArrayHandlePermutation.h
Timer.h
viskores::worklet::KernelSplatterFilterUniformGrid::dims_
viskores::Id3 dims_
Definition: KernelSplatter.h:391
viskores::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:165
viskores::worklet::KernelSplatterFilterUniformGrid::GetSplatValue::GetSplatValue
GetSplatValue(const viskores::Vec3f_64 &orig, const viskores::Vec3f_64 &s, const viskores::Id3 &dim, const Kernel &k)
Definition: KernelSplatter.h:300
viskores::worklet::KernelSplatterFilterUniformGrid::zero_voxel
Definition: KernelSplatter.h:171
viskores::worklet::KernelSplatterFilterUniformGrid::ComputeLocalNeighborId
Definition: KernelSplatter.h:260
viskores::cont::DeviceAdapterAlgorithm::ScanInclusive
static T ScanInclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Compute an inclusive prefix sum operation on the input ArrayHandle.
viskores::cont::ArrayHandle::GetNumberOfValues
viskores::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:482
viskores::cont::ArrayHandleCounting
ArrayHandleCounting is a specialization of ArrayHandle.
Definition: ArrayHandleCounting.h:140
viskores::cont::ArrayPortalToIterators
Definition: ArrayPortalToIterators.h:35
viskores::worklet::KernelSplatterFilterUniformGrid::UpdateVoxelSplats::UpdateVoxelSplats
UpdateVoxelSplats()
Definition: KernelSplatter.h:358
viskores::make_Vec
constexpr viskores::Vec< T, viskores::IdComponent(sizeof...(Ts)+1)> make_Vec(T value0, Ts &&... args)
Initializes and returns a Vec containing all the arguments.
Definition: Types.h:1262
viskores::cont::DeviceAdapterAlgorithm::ReduceByKey
static void ReduceByKey(const viskores::cont::ArrayHandle< T, CKeyIn > &keys, const viskores::cont::ArrayHandle< U, CValIn > &values, viskores::cont::ArrayHandle< T, CKeyOut > &keys_output, viskores::cont::ArrayHandle< U, CValOut > &values_output, BinaryFunctor binary_functor)
Compute a accumulated sum operation on the input key value pairs.
viskores::worklet::KernelSplatterFilterUniformGrid::GetSplatValue::Radius2
viskores::Float64 Radius2
Definition: KernelSplatter.h:289
ArrayPortalFromIterators.h
viskores::worklet::KernelSplatterFilterUniformGrid::kernel_
Kernel kernel_
Definition: KernelSplatter.h:396
viskores::worklet::KernelSplatterFilterUniformGrid::ComputeLocalNeighborId::ExecutionSignature
void(_1, _2, WorkIndex, _3) ExecutionSignature
Definition: KernelSplatter.h:264
viskores::worklet::KernelSplatterFilterUniformGrid::run
void run(const viskores::cont::ArrayHandle< viskores::Float64, StorageT > xValues, const viskores::cont::ArrayHandle< viskores::Float64, StorageT > yValues, const viskores::cont::ArrayHandle< viskores::Float64, StorageT > zValues, const viskores::cont::ArrayHandle< viskores::Float32, StorageT > rValues, const viskores::cont::ArrayHandle< viskores::Float32, StorageT > sValues, FloatHandleType scalarSplatOutput)
Definition: KernelSplatter.h:402
viskores::worklet::KernelSplatterFilterUniformGrid::UpdateVoxelSplats::ExecutionSignature
void(_1, _2, _3) ExecutionSignature
Definition: KernelSplatter.h:355
viskores::Vec3f_32
viskores::Vec< viskores::Float32, 3 > Vec3f_32
Vec3f_32 corresponds to a 3-dimensional vector of 32-bit floating point values.
Definition: Types.h:1070
ArrayHandleCounting.h
viskores::worklet::KernelSplatterFilterUniformGrid::GetFootprint::operator()
void operator()(const T &x, const T &y, const T &z, const T2 &h, viskores::Vec3f_64 &splatPoint, viskores::Id3 &minFootprint, viskores::Id3 &maxFootprint, viskores::Id &footprintSize) const
Definition: KernelSplatter.h:220
viskores::worklet::WorkletMapField
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:47
viskores::worklet::KernelSplatterFilterUniformGrid::ComputeLocalNeighborId::ControlSignature
void(FieldIn, FieldIn, FieldOut) ControlSignature
Definition: KernelSplatter.h:263
viskores::Float64
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:169
viskores::worklet::KernelSplatterFilterUniformGrid::GetSplatValue::operator()
void operator()(const viskores::Vec< P, 3 > &splatPoint, const T &minBound, const T &maxBound, const T2 &kernel_H, const T2 &scale, const viskores::Id localNeighborId, viskores::Id &neighborVoxelId, viskores::Float32 &splatValue) const
Definition: KernelSplatter.h:312
viskores::Vec
A short fixed-length array.
Definition: Types.h:365
DataSet.h
viskores::cont::ArrayHandlePermutation
Implicitly permutes the values in an array.
Definition: ArrayHandlePermutation.h:242
viskores::worklet::KernelSplatterFilterUniformGrid::GetFootprint::ControlSignature
void(FieldIn, FieldIn, FieldIn, FieldIn, FieldOut, FieldOut, FieldOut, FieldOut) ControlSignature
Definition: KernelSplatter.h:204
viskores::worklet::KernelSplatterFilterUniformGrid::zero_voxel::ControlSignature
void(FieldIn, FieldOut) ControlSignature
Definition: KernelSplatter.h:173
viskores::worklet::KernelSplatterFilterUniformGrid::GetSplatValue::ScalingFactor
viskores::Float64 ScalingFactor
Definition: KernelSplatter.h:291
viskores::worklet::KernelSplatterFilterUniformGrid::GetFootprint::ExecutionSignature
void(_1, _2, _3, _4, _5, _6, _7, _8) ExecutionSignature
Definition: KernelSplatter.h:205
viskores::worklet::KernelSplatterFilterUniformGrid::GetFootprint::kernel_
Kernel kernel_
Definition: KernelSplatter.h:200
viskores::worklet::KernelSplatterFilterUniformGrid::KernelSplatterFilterUniformGrid
KernelSplatterFilterUniformGrid(const viskores::Id3 &dims, viskores::Vec3f origin, viskores::Vec3f spacing, const viskores::cont::DataSet &dataset, const Kernel &kernel)
Definition: KernelSplatter.h:375
viskores::exec::arg::WorkIndex
The ExecutionSignature tag to use to get the work index.
Definition: WorkIndex.h:47
viskores::worklet::KernelSplatterFilterUniformGrid::ComputeLocalNeighborId::operator()
void operator()(const T &modulus, const T &offset, const viskores::Id &index, T &localId) const
Definition: KernelSplatter.h:270