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