VTK-m  2.0
Clip.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 vtkm_m_worklet_Clip_h
11 #define vtkm_m_worklet_Clip_h
12 
17 #include <vtkm/worklet/Keys.h>
21 
22 #include <vtkm/cont/Algorithm.h>
23 #include <vtkm/cont/ArrayCopy.h>
29 #include <vtkm/cont/Timer.h>
31 
32 #include <vtkm/ImplicitFunction.h>
33 
34 #include <utility>
35 #include <vtkm/exec/FunctorBase.h>
36 
37 #if defined(THRUST_MAJOR_VERSION) && THRUST_MAJOR_VERSION == 1 && THRUST_MINOR_VERSION == 8 && \
38  THRUST_SUBMINOR_VERSION < 3
39 // Workaround a bug in thrust 1.8.0 - 1.8.2 scan implementations which produces
40 // wrong results
42 VTKM_THIRDPARTY_PRE_INCLUDE
43 #include <thrust/detail/type_traits.h>
44 VTKM_THIRDPARTY_POST_INCLUDE
45 #define THRUST_SCAN_WORKAROUND
46 #endif
47 
48 namespace vtkm
49 {
50 namespace worklet
51 {
52 struct ClipStats
53 {
57 
58  // Stats for interpolating new points within cell.
63 
64  struct SumOp
65  {
67  ClipStats operator()(const ClipStats& stat1, const ClipStats& stat2) const
68  {
69  ClipStats sum = stat1;
70  sum.NumberOfCells += stat2.NumberOfCells;
71  sum.NumberOfIndices += stat2.NumberOfIndices;
77  return sum;
78  }
79  };
80 };
81 
83 {
87 
88  struct LessThanOp
89  {
90  VTKM_EXEC
91  bool operator()(const EdgeInterpolation& v1, const EdgeInterpolation& v2) const
92  {
93  return (v1.Vertex1 < v2.Vertex1) || (v1.Vertex1 == v2.Vertex1 && v1.Vertex2 < v2.Vertex2);
94  }
95  };
96 
97  struct EqualToOp
98  {
99  VTKM_EXEC
100  bool operator()(const EdgeInterpolation& v1, const EdgeInterpolation& v2) const
101  {
102  return v1.Vertex1 == v2.Vertex1 && v1.Vertex2 == v2.Vertex2;
103  }
104  };
105 };
106 
107 namespace internal
108 {
109 
110 template <typename T>
111 VTKM_EXEC_CONT T Scale(const T& val, vtkm::Float64 scale)
112 {
113  return static_cast<T>(scale * static_cast<vtkm::Float64>(val));
114 }
115 
116 template <typename T, vtkm::IdComponent NumComponents>
118  vtkm::Float64 scale)
119 {
120  return val * scale;
121 }
122 
123 template <typename Device>
124 class ExecutionConnectivityExplicit
125 {
126 private:
127  using UInt8Portal = typename vtkm::cont::ArrayHandle<vtkm::UInt8>::WritePortalType;
128  using IdComponentPortal = typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::WritePortalType;
129  using IdPortal = typename vtkm::cont::ArrayHandle<vtkm::Id>::WritePortalType;
130 
131 public:
132  VTKM_CONT
133  ExecutionConnectivityExplicit() = default;
134 
135  VTKM_CONT
136  ExecutionConnectivityExplicit(vtkm::cont::ArrayHandle<vtkm::UInt8> shapes,
140  ClipStats stats,
141  vtkm::cont::Token& token)
142  : Shapes(shapes.PrepareForOutput(stats.NumberOfCells, Device(), token))
143  , NumberOfIndices(numberOfIndices.PrepareForOutput(stats.NumberOfCells, Device(), token))
144  , Connectivity(connectivity.PrepareForOutput(stats.NumberOfIndices, Device(), token))
145  , Offsets(offsets.PrepareForOutput(stats.NumberOfCells, Device(), token))
146  {
147  }
148 
149  VTKM_EXEC
150  void SetCellShape(vtkm::Id cellIndex, vtkm::UInt8 shape) { this->Shapes.Set(cellIndex, shape); }
151 
152  VTKM_EXEC
153  void SetNumberOfIndices(vtkm::Id cellIndex, vtkm::IdComponent numIndices)
154  {
155  this->NumberOfIndices.Set(cellIndex, numIndices);
156  }
157 
158  VTKM_EXEC
159  void SetIndexOffset(vtkm::Id cellIndex, vtkm::Id indexOffset)
160  {
161  this->Offsets.Set(cellIndex, indexOffset);
162  }
163 
164  VTKM_EXEC
165  void SetConnectivity(vtkm::Id connectivityIndex, vtkm::Id pointIndex)
166  {
167  this->Connectivity.Set(connectivityIndex, pointIndex);
168  }
169 
170 private:
171  UInt8Portal Shapes;
172  IdComponentPortal NumberOfIndices;
173  IdPortal Connectivity;
174  IdPortal Offsets;
175 };
176 
177 class ConnectivityExplicit : vtkm::cont::ExecutionObjectBase
178 {
179 public:
180  VTKM_CONT
181  ConnectivityExplicit() = default;
182 
183  VTKM_CONT
184  ConnectivityExplicit(const vtkm::cont::ArrayHandle<vtkm::UInt8>& shapes,
185  const vtkm::cont::ArrayHandle<vtkm::IdComponent>& numberOfIndices,
186  const vtkm::cont::ArrayHandle<vtkm::Id>& connectivity,
187  const vtkm::cont::ArrayHandle<vtkm::Id>& offsets,
188  const ClipStats& stats)
189  : Shapes(shapes)
190  , NumberOfIndices(numberOfIndices)
191  , Connectivity(connectivity)
192  , Offsets(offsets)
193  , Stats(stats)
194  {
195  }
196 
197  template <typename Device>
198  VTKM_CONT ExecutionConnectivityExplicit<Device> PrepareForExecution(
199  Device,
200  vtkm::cont::Token& token) const
201  {
202  ExecutionConnectivityExplicit<Device> execConnectivity(
203  this->Shapes, this->NumberOfIndices, this->Connectivity, this->Offsets, this->Stats, token);
204  return execConnectivity;
205  }
206 
207 private:
213 };
214 
215 
216 } // namespace internal
217 
218 class Clip
219 {
220  // Add support for invert
221 public:
223 
225 
227  {
228  public:
229  VTKM_CONT
230  ComputeStats(vtkm::Float64 value, bool invert)
231  : Value(value)
232  , Invert(invert)
233  {
234  }
235 
236  using ControlSignature =
237  void(CellSetIn, FieldInPoint, ExecObject clippingData, FieldOutCell, FieldOutCell);
238 
239  using ExecutionSignature = void(CellShape, PointCount, _2, _3, _4, _5);
240 
241  using InputDomain = _1;
242 
243  template <typename CellShapeTag, typename ScalarFieldVec, typename DeviceAdapter>
244  VTKM_EXEC void operator()(CellShapeTag shape,
245  vtkm::IdComponent pointCount,
246  const ScalarFieldVec& scalars,
247  const internal::ClipTables::DevicePortal<DeviceAdapter>& clippingData,
248  ClipStats& clipStat,
249  vtkm::Id& clipDataIndex) const
250  {
251  (void)shape; // C4100 false positive workaround
252  vtkm::Id caseId = 0;
253  for (vtkm::IdComponent iter = pointCount - 1; iter >= 0; iter--)
254  {
255  if (!this->Invert && static_cast<vtkm::Float64>(scalars[iter]) <= this->Value)
256  {
257  caseId++;
258  }
259  else if (this->Invert && static_cast<vtkm::Float64>(scalars[iter]) >= this->Value)
260  {
261  caseId++;
262  }
263  if (iter > 0)
264  caseId *= 2;
265  }
266  vtkm::Id index = clippingData.GetCaseIndex(shape.Id, caseId);
267  clipDataIndex = index;
268  vtkm::Id numberOfCells = clippingData.ValueAt(index++);
269  clipStat.NumberOfCells = numberOfCells;
270  for (vtkm::IdComponent shapes = 0; shapes < numberOfCells; shapes++)
271  {
272  vtkm::Id cellShape = clippingData.ValueAt(index++);
273  vtkm::Id numberOfIndices = clippingData.ValueAt(index++);
274  if (cellShape == 0)
275  {
276  --clipStat.NumberOfCells;
277  // Shape is 0, which is a case of interpolating new point within a cell
278  // Gather stats for later operation.
279  clipStat.NumberOfInCellPoints = 1;
280  clipStat.NumberOfInCellInterpPoints = numberOfIndices;
281  for (vtkm::IdComponent points = 0; points < numberOfIndices; points++, index++)
282  {
283  //Find how many points need to be calculated using edge interpolation.
284  vtkm::Id element = clippingData.ValueAt(index);
285  clipStat.NumberOfInCellEdgeIndices += (element < 100) ? 1 : 0;
286  }
287  }
288  else
289  {
290  // Collect number of indices required for storing current shape
291  clipStat.NumberOfIndices += numberOfIndices;
292  // Collect number of new points
293  for (vtkm::IdComponent points = 0; points < numberOfIndices; points++, index++)
294  {
295  //Find how many points need to found using edge interpolation.
296  vtkm::Id element = clippingData.ValueAt(index);
297  if (element == 255)
298  {
299  clipStat.NumberOfInCellIndices++;
300  }
301  else if (element < 100)
302  {
303  clipStat.NumberOfEdgeIndices++;
304  }
305  }
306  }
307  }
308  }
309 
310  private:
312  bool Invert;
313  };
314 
316  {
317  public:
318  VTKM_CONT
320  : Value(value)
321  {
322  }
323 
324  using ControlSignature = void(CellSetIn,
325  FieldInPoint,
326  FieldInCell clipTableIndices,
327  FieldInCell clipStats,
328  ExecObject clipTables,
329  ExecObject connectivityObject,
330  WholeArrayOut edgePointReverseConnectivity,
331  WholeArrayOut edgePointInterpolation,
332  WholeArrayOut inCellReverseConnectivity,
333  WholeArrayOut inCellEdgeReverseConnectivity,
334  WholeArrayOut inCellEdgeInterpolation,
335  WholeArrayOut inCellInterpolationKeys,
336  WholeArrayOut inCellInterpolationInfo,
337  WholeArrayOut cellMapOutputToInput);
338 
339  using ExecutionSignature = void(CellShape,
340  WorkIndex,
341  PointIndices,
342  _2,
343  _3,
344  _4,
345  _5,
346  _6,
347  _7,
348  _8,
349  _9,
350  _10,
351  _11,
352  _12,
353  _13,
354  _14);
355 
356  template <typename CellShapeTag,
357  typename PointVecType,
358  typename ScalarVecType,
359  typename ConnectivityObject,
360  typename IdArrayType,
361  typename EdgeInterpolationPortalType,
362  typename DeviceAdapter>
363  VTKM_EXEC void operator()(CellShapeTag shape,
364  vtkm::Id workIndex,
365  const PointVecType& points,
366  const ScalarVecType& scalars,
367  vtkm::Id clipDataIndex,
368  const ClipStats& clipStats,
369  const internal::ClipTables::DevicePortal<DeviceAdapter>& clippingData,
370  ConnectivityObject& connectivityObject,
371  IdArrayType& edgePointReverseConnectivity,
372  EdgeInterpolationPortalType& edgePointInterpolation,
373  IdArrayType& inCellReverseConnectivity,
374  IdArrayType& inCellEdgeReverseConnectivity,
375  EdgeInterpolationPortalType& inCellEdgeInterpolation,
376  IdArrayType& inCellInterpolationKeys,
377  IdArrayType& inCellInterpolationInfo,
378  IdArrayType& cellMapOutputToInput) const
379  {
380  (void)shape;
381  vtkm::Id clipIndex = clipDataIndex;
382  // Start index for the cells of this case.
383  vtkm::Id cellIndex = clipStats.NumberOfCells;
384  // Start index to store connevtivity of this case.
385  vtkm::Id connectivityIndex = clipStats.NumberOfIndices;
386  // Start indices for reverse mapping into connectivity for this case.
387  vtkm::Id edgeIndex = clipStats.NumberOfEdgeIndices;
388  vtkm::Id inCellIndex = clipStats.NumberOfInCellIndices;
389  vtkm::Id inCellPoints = clipStats.NumberOfInCellPoints;
390  // Start Indices to keep track of interpolation points for new cell.
391  vtkm::Id inCellInterpPointIndex = clipStats.NumberOfInCellInterpPoints;
392  vtkm::Id inCellEdgeInterpIndex = clipStats.NumberOfInCellEdgeIndices;
393 
394  // Iterate over the shapes for the current cell and begin to fill connectivity.
395  vtkm::Id numberOfCells = clippingData.ValueAt(clipIndex++);
396  for (vtkm::Id cell = 0; cell < numberOfCells; ++cell)
397  {
398  vtkm::UInt8 cellShape = clippingData.ValueAt(clipIndex++);
399  vtkm::IdComponent numberOfPoints = clippingData.ValueAt(clipIndex++);
400  if (cellShape == 0)
401  {
402  // Case for a new cell point.
403 
404  // 1. Output the input cell id for which we need to generate new point.
405  // 2. Output number of points used for interpolation.
406  // 3. If vertex
407  // - Add vertex to connectivity interpolation information.
408  // 4. If edge
409  // - Add edge interpolation information for new points.
410  // - Reverse connectivity map for new points.
411  // Make an array which has all the elements that need to be used
412  // for interpolation.
413  for (vtkm::IdComponent point = 0; point < numberOfPoints;
414  point++, inCellInterpPointIndex++, clipIndex++)
415  {
416  vtkm::IdComponent entry =
417  static_cast<vtkm::IdComponent>(clippingData.ValueAt(clipIndex));
418  inCellInterpolationKeys.Set(inCellInterpPointIndex, workIndex);
419  if (entry >= 100)
420  {
421  inCellInterpolationInfo.Set(inCellInterpPointIndex, points[entry - 100]);
422  }
423  else
424  {
425  internal::ClipTables::EdgeVec edge = clippingData.GetEdge(shape.Id, entry);
426  VTKM_ASSERT(edge[0] != 255);
427  VTKM_ASSERT(edge[1] != 255);
429  ei.Vertex1 = points[edge[0]];
430  ei.Vertex2 = points[edge[1]];
431  // For consistency purposes keep the points ordered.
432  if (ei.Vertex1 > ei.Vertex2)
433  {
434  this->swap(ei.Vertex1, ei.Vertex2);
435  this->swap(edge[0], edge[1]);
436  }
437  ei.Weight = (static_cast<vtkm::Float64>(scalars[edge[0]]) - this->Value) /
438  static_cast<vtkm::Float64>(scalars[edge[1]] - scalars[edge[0]]);
439 
440  inCellEdgeReverseConnectivity.Set(inCellEdgeInterpIndex, inCellInterpPointIndex);
441  inCellEdgeInterpolation.Set(inCellEdgeInterpIndex, ei);
442  inCellEdgeInterpIndex++;
443  }
444  }
445  }
446  else
447  {
448  // Just a normal cell, generate edge representations,
449 
450  // 1. Add cell type to connectivity information.
451  // 2. If vertex
452  // - Add vertex to connectivity information.
453  // 3. If edge point
454  // - Add edge to edge points
455  // - Add edge point index to edge point reverse connectivity.
456  // 4. If cell point
457  // - Add cell point index to connectivity
458  // (as there is only one cell point per required cell)
459  // 5. Store input cell index against current cell for mapping cell data.
460  connectivityObject.SetCellShape(cellIndex, cellShape);
461  connectivityObject.SetNumberOfIndices(cellIndex, numberOfPoints);
462  connectivityObject.SetIndexOffset(cellIndex, connectivityIndex);
463  for (vtkm::IdComponent point = 0; point < numberOfPoints; point++, clipIndex++)
464  {
465  vtkm::IdComponent entry =
466  static_cast<vtkm::IdComponent>(clippingData.ValueAt(clipIndex));
467  if (entry == 255) // case of cell point interpolation
468  {
469  // Add index of the corresponding cell point.
470  inCellReverseConnectivity.Set(inCellIndex++, connectivityIndex);
471  connectivityObject.SetConnectivity(connectivityIndex, inCellPoints);
472  connectivityIndex++;
473  }
474  else if (entry >= 100) // existing vertex
475  {
476  connectivityObject.SetConnectivity(connectivityIndex++, points[entry - 100]);
477  }
478  else // case of a new edge point
479  {
480  internal::ClipTables::EdgeVec edge = clippingData.GetEdge(shape.Id, entry);
481  VTKM_ASSERT(edge[0] != 255);
482  VTKM_ASSERT(edge[1] != 255);
484  ei.Vertex1 = points[edge[0]];
485  ei.Vertex2 = points[edge[1]];
486  // For consistency purposes keep the points ordered.
487  if (ei.Vertex1 > ei.Vertex2)
488  {
489  this->swap(ei.Vertex1, ei.Vertex2);
490  this->swap(edge[0], edge[1]);
491  }
492  ei.Weight = (static_cast<vtkm::Float64>(scalars[edge[0]]) - this->Value) /
493  static_cast<vtkm::Float64>(scalars[edge[1]] - scalars[edge[0]]);
494  //Add to set of new edge points
495  //Add reverse connectivity;
496  edgePointReverseConnectivity.Set(edgeIndex, connectivityIndex++);
497  edgePointInterpolation.Set(edgeIndex, ei);
498  edgeIndex++;
499  }
500  }
501  cellMapOutputToInput.Set(cellIndex, workIndex);
502  ++cellIndex;
503  }
504  }
505  }
506 
507  template <typename T>
508  VTKM_EXEC void swap(T& v1, T& v2) const
509  {
510  T temp = v1;
511  v1 = v2;
512  v2 = temp;
513  }
514 
515  private:
517  };
518 
520  {
521  public:
522  VTKM_CONT
524  : EdgePointOffset(edgePointOffset)
525  {
526  }
527 
528  using ControlSignature = void(FieldIn sourceValue,
529  FieldIn destinationIndices,
530  WholeArrayOut destinationData);
531 
532  using ExecutionSignature = void(_1, _2, _3);
533 
534  using InputDomain = _1;
535 
536  template <typename ConnectivityDataType>
537  VTKM_EXEC void operator()(vtkm::Id sourceValue,
538  vtkm::Id destinationIndex,
539  ConnectivityDataType& destinationData) const
540  {
541  destinationData.Set(destinationIndex, (sourceValue + EdgePointOffset));
542  }
543 
544  private:
546  };
547 
549  {
550  public:
551  VTKM_CONT
553  : InCellPointOffset(inCellPointOffset)
554  {
555  }
556 
557  using ControlSignature = void(FieldIn destinationIndices, WholeArrayOut destinationData);
558 
559  using ExecutionSignature = void(_1, _2);
560 
561  using InputDomain = _1;
562 
563  template <typename ConnectivityDataType>
564  VTKM_EXEC void operator()(vtkm::Id destinationIndex,
565  ConnectivityDataType& destinationData) const
566  {
567  auto sourceValue = destinationData.Get(destinationIndex);
568  destinationData.Set(destinationIndex, (sourceValue + InCellPointOffset));
569  }
570 
571  private:
573  };
574 
581  , EdgePointsOffset()
583  {
584  }
585 
586  template <typename CellSetType, typename ScalarsArrayHandle>
587  vtkm::cont::CellSetExplicit<> Run(const CellSetType& cellSet,
588  const ScalarsArrayHandle& scalars,
589  vtkm::Float64 value,
590  bool invert)
591  {
592  // Create the required output fields.
594  vtkm::cont::ArrayHandle<vtkm::Id> clipTableIndices;
595 
596  ComputeStats statsWorklet(value, invert);
597  //Send this CellSet to process
598  vtkm::worklet::DispatcherMapTopology<ComputeStats> statsDispatcher(statsWorklet);
599  statsDispatcher.Invoke(cellSet, scalars, this->ClipTablesInstance, clipStats, clipTableIndices);
600 
601  ClipStats zero;
603  ClipStats total =
604  vtkm::cont::Algorithm::ScanExclusive(clipStats, cellSetStats, ClipStats::SumOp(), zero);
605  clipStats.ReleaseResources();
606 
611  internal::ConnectivityExplicit connectivityObject(
612  shapes, numberOfIndices, connectivity, offsets, total);
613 
614  //Begin Process of Constructing the new CellSet.
615  vtkm::cont::ArrayHandle<vtkm::Id> edgePointReverseConnectivity;
616  edgePointReverseConnectivity.Allocate(total.NumberOfEdgeIndices);
618  edgeInterpolation.Allocate(total.NumberOfEdgeIndices);
619 
620  vtkm::cont::ArrayHandle<vtkm::Id> cellPointReverseConnectivity;
621  cellPointReverseConnectivity.Allocate(total.NumberOfInCellIndices);
622  vtkm::cont::ArrayHandle<vtkm::Id> cellPointEdgeReverseConnectivity;
623  cellPointEdgeReverseConnectivity.Allocate(total.NumberOfInCellEdgeIndices);
624  vtkm::cont::ArrayHandle<EdgeInterpolation> cellPointEdgeInterpolation;
625  cellPointEdgeInterpolation.Allocate(total.NumberOfInCellEdgeIndices);
626 
630 
631  GenerateCellSet cellSetWorklet(value);
632  //Send this CellSet to process
633  vtkm::worklet::DispatcherMapTopology<GenerateCellSet> cellSetDispatcher(cellSetWorklet);
634  cellSetDispatcher.Invoke(cellSet,
635  scalars,
636  clipTableIndices,
637  cellSetStats,
638  this->ClipTablesInstance,
639  connectivityObject,
640  edgePointReverseConnectivity,
641  edgeInterpolation,
642  cellPointReverseConnectivity,
643  cellPointEdgeReverseConnectivity,
644  cellPointEdgeInterpolation,
647  this->CellMapOutputToInput);
648 
649  // Get unique EdgeInterpolation : unique edge points.
650  // LowerBound for edgeInterpolation : get index into new edge points array.
651  // LowerBound for cellPointEdgeInterpolation : get index into new edge points array.
653  edgeInterpolation, edgePointReverseConnectivity, EdgeInterpolation::LessThanOp());
654  vtkm::cont::Algorithm::Copy(edgeInterpolation, this->EdgePointsInterpolation);
656 
657  vtkm::cont::ArrayHandle<vtkm::Id> edgeInterpolationIndexToUnique;
659  edgeInterpolation,
660  edgeInterpolationIndexToUnique,
662 
663  vtkm::cont::ArrayHandle<vtkm::Id> cellInterpolationIndexToUnique;
665  cellPointEdgeInterpolation,
666  cellInterpolationIndexToUnique,
668 
669  this->EdgePointsOffset = scalars.GetNumberOfValues();
670  this->InCellPointsOffset =
671  this->EdgePointsOffset + this->EdgePointsInterpolation.GetNumberOfValues();
672 
673  // Scatter these values into the connectivity array,
674  // scatter indices are given in reverse connectivity.
675  ScatterEdgeConnectivity scatterEdgePointConnectivity(this->EdgePointsOffset);
677  scatterEdgePointConnectivity);
678  scatterEdgeDispatcher.Invoke(
679  edgeInterpolationIndexToUnique, edgePointReverseConnectivity, connectivity);
680  scatterEdgeDispatcher.Invoke(cellInterpolationIndexToUnique,
681  cellPointEdgeReverseConnectivity,
683  // Add offset in connectivity of all new in-cell points.
684  ScatterInCellConnectivity scatterInCellPointConnectivity(this->InCellPointsOffset);
686  scatterInCellPointConnectivity);
687  scatterInCellDispatcher.Invoke(cellPointReverseConnectivity, connectivity);
688 
690  vtkm::Id numberOfPoints = scalars.GetNumberOfValues() +
691  this->EdgePointsInterpolation.GetNumberOfValues() + total.NumberOfInCellPoints;
692 
693  vtkm::cont::ConvertNumComponentsToOffsets(numberOfIndices, offsets);
694 
695  output.Fill(numberOfPoints, shapes, connectivity, offsets);
696  return output;
697  }
698 
699  template <typename CellSetType, typename ImplicitFunction>
701  {
702  public:
703  VTKM_CONT
705  const CellSetType& cellSet,
706  const ImplicitFunction& function,
707  vtkm::Float64 offset,
708  bool invert,
710  : Clipper(clipper)
711  , CellSet(&cellSet)
712  , Function(function)
713  , Offset(offset)
714  , Invert(invert)
715  , Result(result)
716  {
717  }
718 
719  template <typename ArrayHandleType>
720  VTKM_CONT void operator()(const ArrayHandleType& handle) const
721  {
722  // Evaluate the implicit function on the input coordinates using
723  // ArrayHandleTransform
724  vtkm::cont::ArrayHandleTransform<ArrayHandleType,
726  clipScalars(handle, this->Function);
727 
728  // Clip at locations where the implicit function evaluates to `Offset`
729  *this->Result = this->Clipper->Run(*this->CellSet, clipScalars, this->Offset, this->Invert);
730  }
731 
732  private:
734  const CellSetType* CellSet;
735  ImplicitFunction Function;
737  bool Invert;
739  };
740 
741  template <typename CellSetType, typename ImplicitFunction>
742  vtkm::cont::CellSetExplicit<> Run(const CellSetType& cellSet,
743  const ImplicitFunction& clipFunction,
744  vtkm::Float64 offset,
745  const vtkm::cont::CoordinateSystem& coords,
746  bool invert)
747  {
749 
751  this, cellSet, clipFunction, offset, invert, &output);
752 
753  CastAndCall(coords, clip);
754  return output;
755  }
756 
757  template <typename CellSetType, typename ImplicitFunction>
758  vtkm::cont::CellSetExplicit<> Run(const CellSetType& cellSet,
759  const ImplicitFunction& clipFunction,
760  const vtkm::cont::CoordinateSystem& coords,
761  bool invert)
762  {
763  return this->Run(cellSet, clipFunction, 0.0, coords, invert);
764  }
765 
766  template <typename ArrayHandleType>
768  {
769  public:
770  using ValueType = typename ArrayHandleType::ValueType;
772 
774  vtkm::cont::ArrayHandle<vtkm::Id> inCellInterpolationKeys,
775  vtkm::cont::ArrayHandle<vtkm::Id> inCellInterpolationInfo,
776  vtkm::Id edgePointsOffset,
777  vtkm::Id inCellPointsOffset,
778  ArrayHandleType* output)
779  : EdgeInterpolationArray(edgeInterpolationArray)
780  , InCellInterpolationKeys(inCellInterpolationKeys)
781  , InCellInterpolationInfo(inCellInterpolationInfo)
782  , EdgePointsOffset(edgePointsOffset)
783  , InCellPointsOffset(inCellPointsOffset)
784  , Output(output)
785  {
786  }
787 
789  {
790  public:
792  : EdgePointsOffset(edgePointsOffset)
793  {
794  }
795 
796  using ControlSignature = void(FieldIn edgeInterpolations, WholeArrayInOut outputField);
797 
798  using ExecutionSignature = void(_1, _2, WorkIndex);
799 
800  template <typename EdgeInterp, typename OutputFieldPortal>
801  VTKM_EXEC void operator()(const EdgeInterp& ei,
802  OutputFieldPortal& field,
803  vtkm::Id workIndex) const
804  {
805  using T = typename OutputFieldPortal::ValueType;
806  T v1 = field.Get(ei.Vertex1);
807  T v2 = field.Get(ei.Vertex2);
808  field.Set(this->EdgePointsOffset + workIndex,
809  static_cast<T>(internal::Scale(T(v1 - v2), ei.Weight) + v1));
810  }
811 
812  private:
814  };
815 
817  {
818  public:
819  using ControlSignature = void(KeysIn keys, ValuesIn toReduce, ReducedValuesOut centroid);
820 
821  using ExecutionSignature = void(_2, _3);
822 
823  template <typename MappedValueVecType, typename MappedValueType>
824  VTKM_EXEC void operator()(const MappedValueVecType& toReduce, MappedValueType& centroid) const
825  {
826  vtkm::IdComponent numValues = toReduce.GetNumberOfComponents();
827  MappedValueType sum = toReduce[0];
828  for (vtkm::IdComponent i = 1; i < numValues; i++)
829  {
830  MappedValueType value = toReduce[i];
831  // static_cast is for when MappedValueType is a small int that gets promoted to int32.
832  sum = static_cast<MappedValueType>(sum + value);
833  }
834  centroid = internal::Scale(sum, 1. / static_cast<vtkm::Float64>(numValues));
835  }
836  };
837 
838  template <typename Storage>
840  {
842 
843  vtkm::Id numberOfOriginalValues = field.GetNumberOfValues();
844  vtkm::Id numberOfEdgePoints = EdgeInterpolationArray.GetNumberOfValues();
845  vtkm::Id numberOfInCellPoints = interpolationKeys.GetUniqueKeys().GetNumberOfValues();
846 
847  ArrayHandleType result;
848  result.Allocate(numberOfOriginalValues + numberOfEdgePoints + numberOfInCellPoints);
849  vtkm::cont::Algorithm::CopySubRange(field, 0, numberOfOriginalValues, result);
850 
851  PerformEdgeInterpolations edgeInterpWorklet(numberOfOriginalValues);
853  edgeInterpWorklet);
854  edgeInterpDispatcher.Invoke(this->EdgeInterpolationArray, result);
855 
856  // Perform a gather on output to get all required values for calculation of
857  // centroids using the interpolation info array.
858  using IdHandle = vtkm::cont::ArrayHandle<vtkm::Id>;
859  using ValueHandle = vtkm::cont::ArrayHandle<ValueType>;
861  InCellInterpolationInfo, result);
862 
865  inCellInterpolationDispatcher;
866  inCellInterpolationDispatcher.Invoke(interpolationKeys, toReduceValues, reducedValues);
867  vtkm::Id inCellPointsOffset = numberOfOriginalValues + numberOfEdgePoints;
869  reducedValues, 0, reducedValues.GetNumberOfValues(), result, inCellPointsOffset);
870  *(this->Output) = result;
871  }
872 
873  private:
879  ArrayHandleType* Output;
880  };
881 
882  template <typename ValueType, typename StorageType>
885  {
886  using ResultType = vtkm::cont::ArrayHandle<ValueType>;
887  using Worker = InterpolateField<ResultType>;
888 
889  ResultType output;
890 
891  Worker worker = Worker(this->EdgePointsInterpolation,
894  this->EdgePointsOffset,
895  this->InCellPointsOffset,
896  &output);
897  worker(fieldData);
898 
899  return output;
900  }
901 
903  {
904  return this->CellMapOutputToInput;
905  }
906 
907 private:
908  internal::ClipTables ClipTablesInstance;
915 };
916 }
917 } // namespace vtkm::worklet
918 
919 #if defined(THRUST_SCAN_WORKAROUND)
920 namespace thrust
921 {
922 namespace detail
923 {
924 
925 // causes a different code path which does not have the bug
926 template <>
927 struct is_integral<vtkm::worklet::ClipStats> : public true_type
928 {
929 };
930 }
931 } // namespace thrust::detail
932 #endif
933 
934 #endif // vtkm_m_worklet_Clip_h
vtkm::worklet::Clip
Definition: Clip.h:218
vtkm::worklet::Clip::ClipTablesInstance
internal::ClipTables ClipTablesInstance
Definition: Clip.h:908
vtkm::worklet::Clip::ClipWithImplicitFunction::Clipper
Clip * Clipper
Definition: Clip.h:733
vtkm::cont::ArrayHandle::GetNumberOfValues
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
vtkm::cont::Algorithm::SortByKey
static VTKM_CONT void SortByKey(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values)
Definition: Algorithm.h:993
vtkm::cont::ArrayHandle< vtkm::UInt8 >
vtkm::worklet::Clip::Run
vtkm::cont::CellSetExplicit Run(const CellSetType &cellSet, const ImplicitFunction &clipFunction, vtkm::Float64 offset, const vtkm::cont::CoordinateSystem &coords, bool invert)
Definition: Clip.h:742
vtkm::worklet::Clip::ScatterInCellConnectivity::ExecutionSignature
void(_1, _2) ExecutionSignature
Definition: Clip.h:559
vtkm::worklet::Clip::ScatterEdgeConnectivity::ScatterEdgeConnectivity
VTKM_CONT ScatterEdgeConnectivity(vtkm::Id edgePointOffset)
Definition: Clip.h:523
vtkm::worklet::Clip::ComputeStats::ControlSignature
void(CellSetIn, FieldInPoint, ExecObject clippingData, FieldOutCell, FieldOutCell) ControlSignature
Definition: Clip.h:237
vtkm::worklet::ClipStats::NumberOfInCellPoints
vtkm::Id NumberOfInCellPoints
Definition: Clip.h:59
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::worklet::Clip::ScatterEdgeConnectivity::EdgePointOffset
vtkm::Id EdgePointOffset
Definition: Clip.h:545
WorkletMapField.h
VTKM_ASSERT
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
CellSetExplicit.h
vtkm::worklet::Clip::InterpolateField::PerformInCellInterpolations
Definition: Clip.h:816
vtkm::worklet::Clip::InterpolateField::EdgePointsOffset
vtkm::Id EdgePointsOffset
Definition: Clip.h:877
vtkm::worklet::Clip::ClipWithImplicitFunction::Invert
bool Invert
Definition: Clip.h:737
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::worklet::Clip::ComputeStats::ComputeStats
VTKM_CONT ComputeStats(vtkm::Float64 value, bool invert)
Definition: Clip.h:230
vtkm::cont::ArrayHandle::Allocate
VTKM_CONT void Allocate(vtkm::Id numberOfValues, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
Allocates an array large enough to hold the given number of values.
Definition: ArrayHandle.h:465
vtkm::worklet::Clip::GenerateCellSet::ExecutionSignature
void(CellShape, WorkIndex, PointIndices, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) ExecutionSignature
Definition: Clip.h:354
vtkm::worklet::Clip::GenerateCellSet::operator()
VTKM_EXEC void operator()(CellShapeTag shape, vtkm::Id workIndex, const PointVecType &points, const ScalarVecType &scalars, vtkm::Id clipDataIndex, const ClipStats &clipStats, const internal::ClipTables::DevicePortal< DeviceAdapter > &clippingData, ConnectivityObject &connectivityObject, IdArrayType &edgePointReverseConnectivity, EdgeInterpolationPortalType &edgePointInterpolation, IdArrayType &inCellReverseConnectivity, IdArrayType &inCellEdgeReverseConnectivity, EdgeInterpolationPortalType &inCellEdgeInterpolation, IdArrayType &inCellInterpolationKeys, IdArrayType &inCellInterpolationInfo, IdArrayType &cellMapOutputToInput) const
Definition: Clip.h:363
vtkm::worklet::WorkletVisitCellsWithPoints::PointCount
IncidentElementCount PointCount
Definition: WorkletMapTopology.h:267
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::worklet::WorkletReduceByKey::ValuesIn
A control signature tag for input values.
Definition: WorkletReduceByKey.h:70
vtkm::worklet::EdgeInterpolation
Definition: Clip.h:82
vtkm::worklet::Clip::ScatterInCellConnectivity::ScatterInCellConnectivity
VTKM_CONT ScatterInCellConnectivity(vtkm::Id inCellPointOffset)
Definition: Clip.h:552
vtkm::worklet::Clip::InterpolateField::InterpolateField
InterpolateField(vtkm::cont::ArrayHandle< EdgeInterpolation > edgeInterpolationArray, vtkm::cont::ArrayHandle< vtkm::Id > inCellInterpolationKeys, vtkm::cont::ArrayHandle< vtkm::Id > inCellInterpolationInfo, vtkm::Id edgePointsOffset, vtkm::Id inCellPointsOffset, ArrayHandleType *output)
Definition: Clip.h:773
vtkm::worklet::Clip::ScatterEdgeConnectivity
Definition: Clip.h:519
vtkm::worklet::Clip::GenerateCellSet::Value
vtkm::Float64 Value
Definition: Clip.h:516
vtkm::cont::Algorithm::LowerBounds
static VTKM_CONT void LowerBounds(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output)
Definition: Algorithm.h:604
vtkm::worklet::Clip::ScatterInCellConnectivity::operator()
VTKM_EXEC void operator()(vtkm::Id destinationIndex, ConnectivityDataType &destinationData) const
Definition: Clip.h:564
vtkm::worklet::Clip::ScatterInCellConnectivity
Definition: Clip.h:548
Keys.h
vtkm::worklet::Clip::EdgePointsInterpolation
vtkm::cont::ArrayHandle< EdgeInterpolation > EdgePointsInterpolation
Definition: Clip.h:909
vtkm::cont::Algorithm::CopySubRange
static VTKM_CONT bool CopySubRange(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::Id inputStartIndex, vtkm::Id numberOfElementsToCopy, vtkm::cont::ArrayHandle< U, COut > &output, vtkm::Id outputIndex=0)
Definition: Algorithm.h:472
vtkm::worklet::Clip::ComputeStats::ExecutionSignature
void(CellShape, PointCount, _2, _3, _4, _5) ExecutionSignature
Definition: Clip.h:239
vtkm::worklet::Clip::InterpolateField::EdgeInterpolationArray
vtkm::cont::ArrayHandle< EdgeInterpolation > EdgeInterpolationArray
Definition: Clip.h:874
vtkm::worklet::Clip::InterpolateField::InCellInterpolationInfo
vtkm::cont::ArrayHandle< vtkm::Id > InCellInterpolationInfo
Definition: Clip.h:876
vtkm::worklet::Clip::InterpolateField::PerformEdgeInterpolations::PerformEdgeInterpolations
PerformEdgeInterpolations(vtkm::Id edgePointsOffset)
Definition: Clip.h:791
vtkm::cont::Algorithm::Copy
static VTKM_CONT bool Copy(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:410
vtkm::worklet::Clip::ScatterEdgeConnectivity::InputDomain
_1 InputDomain
Definition: Clip.h:534
vtkm::worklet::Clip::ScatterEdgeConnectivity::ControlSignature
void(FieldIn sourceValue, FieldIn destinationIndices, WholeArrayOut destinationData) ControlSignature
Definition: Clip.h:530
vtkm::worklet::WorkletReduceByKey::ReducedValuesOut
A control signature tag for reduced output values.
Definition: WorkletReduceByKey.h:150
ArrayHandleView.h
vtkm::cont::CastAndCall
void CastAndCall(const DynamicObject &dynamicObject, Functor &&f, Args &&... args)
A Generic interface to CastAndCall.
Definition: CastAndCall.h:47
CoordinateSystem.h
vtkm::worklet::WorkletVisitCellsWithPoints::PointIndices
IncidentElementIndices PointIndices
Definition: WorkletMapTopology.h:269
vtkm::worklet::Clip::Run
vtkm::cont::CellSetExplicit Run(const CellSetType &cellSet, const ScalarsArrayHandle &scalars, vtkm::Float64 value, bool invert)
Definition: Clip.h:587
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::worklet::Clip::GetCellMapOutputToInput
vtkm::cont::ArrayHandle< vtkm::Id > GetCellMapOutputToInput() const
Definition: Clip.h:902
vtkm::worklet::Clip::InterpolateField::operator()
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle< ValueType, Storage > &field) const
Definition: Clip.h:839
ArrayCopy.h
vtkm::worklet::EdgeInterpolation::Vertex2
vtkm::Id Vertex2
Definition: Clip.h:85
DispatcherMapField.h
vtkm::worklet::Clip::ClipWithImplicitFunction::operator()
VTKM_CONT void operator()(const ArrayHandleType &handle) const
Definition: Clip.h:720
ThrustPatches.h
vtkm::worklet::Clip::InCellInterpolationInfo
vtkm::cont::ArrayHandle< vtkm::Id > InCellInterpolationInfo
Definition: Clip.h:911
vtkm::cont::CoordinateSystem
Definition: CoordinateSystem.h:25
vtkm::worklet::Clip::InterpolateField::PerformEdgeInterpolations::EdgePointsOffset
vtkm::Id EdgePointsOffset
Definition: Clip.h:813
vtkm::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
vtkm::worklet::Clip::InterpolateField::PerformEdgeInterpolations::operator()
VTKM_EXEC void operator()(const EdgeInterp &ei, OutputFieldPortal &field, vtkm::Id workIndex) const
Definition: Clip.h:801
vtkm::worklet::Clip::ProcessPointField
vtkm::cont::ArrayHandle< ValueType > ProcessPointField(const vtkm::cont::ArrayHandle< ValueType, StorageType > &fieldData) const
Definition: Clip.h:883
vtkm::worklet::Clip::GenerateCellSet::swap
VTKM_EXEC void swap(T &v1, T &v2) const
Definition: Clip.h:508
vtkm::worklet::EdgeInterpolation::EqualToOp::operator()
VTKM_EXEC bool operator()(const EdgeInterpolation &v1, const EdgeInterpolation &v2) const
Definition: Clip.h:100
vtkm::worklet::Clip::InterpolateField::PerformEdgeInterpolations::ExecutionSignature
void(_1, _2, WorkIndex) ExecutionSignature
Definition: Clip.h:798
vtkm::worklet::Clip::InterpolateField::PerformInCellInterpolations::ControlSignature
void(KeysIn keys, ValuesIn toReduce, ReducedValuesOut centroid) ControlSignature
Definition: Clip.h:819
vtkm::worklet::Clip::ScatterEdgeConnectivity::operator()
VTKM_EXEC void operator()(vtkm::Id sourceValue, vtkm::Id destinationIndex, ConnectivityDataType &destinationData) const
Definition: Clip.h:537
vtkm::cont::Algorithm::Unique
static VTKM_CONT void Unique(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:1063
vtkm::worklet::Clip::ComputeStats::operator()
VTKM_EXEC void operator()(CellShapeTag shape, vtkm::IdComponent pointCount, const ScalarFieldVec &scalars, const internal::ClipTables::DevicePortal< DeviceAdapter > &clippingData, ClipStats &clipStat, vtkm::Id &clipDataIndex) const
Definition: Clip.h:244
UnknownArrayHandle.h
vtkm::worklet::Clip::ComputeStats::Invert
bool Invert
Definition: Clip.h:312
vtkm::worklet::DispatcherMapField
Dispatcher for worklets that inherit from WorkletMapField.
Definition: DispatcherMapField.h:25
WorkletReduceByKey.h
vtkm::worklet::Clip::ClipWithImplicitFunction::Function
ImplicitFunction Function
Definition: Clip.h:735
ArrayHandlePermutation.h
Timer.h
Algorithm.h
vtkm::worklet::Clip::ScatterInCellConnectivity::InputDomain
_1 InputDomain
Definition: Clip.h:561
vtkm::worklet::Clip::ComputeStats::Value
vtkm::Float64 Value
Definition: Clip.h:311
vtkm::worklet::DispatcherMapTopology
Dispatcher for worklets that inherit from WorkletMapTopology.
Definition: DispatcherMapTopology.h:31
vtkm::worklet::WorkletMapField::FieldIn
A control signature tag for input fields.
Definition: WorkletMapField.h:49
vtkm::worklet::Clip::ClipWithImplicitFunction::ClipWithImplicitFunction
VTKM_CONT ClipWithImplicitFunction(Clip *clipper, const CellSetType &cellSet, const ImplicitFunction &function, vtkm::Float64 offset, bool invert, vtkm::cont::CellSetExplicit<> *result)
Definition: Clip.h:704
vtkm::worklet::WorkletReduceByKey
Definition: WorkletReduceByKey.h:42
vtkm::worklet::ClipStats::NumberOfInCellInterpPoints
vtkm::Id NumberOfInCellInterpPoints
Definition: Clip.h:61
FunctorBase.h
vtkm::cont::Algorithm::ScanExclusive
static VTKM_CONT T ScanExclusive(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:816
vtkm::worklet::ClipStats::NumberOfInCellIndices
vtkm::Id NumberOfInCellIndices
Definition: Clip.h:60
vtkm::cont::ArrayHandlePermutation
Implicitly permutes the values in an array.
Definition: ArrayHandlePermutation.h:227
vtkm::worklet::EdgeInterpolation::EqualToOp
Definition: Clip.h:97
vtkm::worklet::Clip::InterpolateField::Output
ArrayHandleType * Output
Definition: Clip.h:879
vtkm::worklet::WorkletVisitCellsWithPoints
Base class for worklets that map from Points to Cells.
Definition: WorkletMapTopology.h:255
vtkm::worklet::contourtree_augmented::IdArrayType
vtkm::cont::ArrayHandle< vtkm::Id > IdArrayType
Definition: filter/scalar_topology/worklet/contourtree_augmented/Types.h:90
vtkm::worklet::Clip::InterpolateField::PerformEdgeInterpolations::ControlSignature
void(FieldIn edgeInterpolations, WholeArrayInOut outputField) ControlSignature
Definition: Clip.h:796
vtkm::worklet::WorkletVisitCellsWithPoints::FieldInPoint
FieldInIncident FieldInPoint
Definition: WorkletMapTopology.h:259
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::worklet::WorkletReduceByKey::KeysIn
A control signature tag for input keys.
Definition: WorkletReduceByKey.h:56
vtkm::worklet::Clip::CellMapOutputToInput
vtkm::cont::ArrayHandle< vtkm::Id > CellMapOutputToInput
Definition: Clip.h:912
vtkm::cont::CellSetExplicit::Fill
VTKM_CONT void Fill(vtkm::Id numPoints, const vtkm::cont::ArrayHandle< vtkm::UInt8, ShapesStorageTag > &cellTypes, const vtkm::cont::ArrayHandle< vtkm::Id, ConnectivityStorageTag > &connectivity, const vtkm::cont::ArrayHandle< vtkm::Id, OffsetsStorageTag > &offsets)
Second method to add cells – all at once.
vtkm::worklet::Clip::ComputeStats::InputDomain
_1 InputDomain
Definition: Clip.h:241
vtkm::cont::ArrayHandleTransform
Implicitly transform values of one array to another with a functor.
Definition: ArrayHandleTransform.h:437
vtkm::cont::ArrayHandle::WritePortalType
typename StorageType::WritePortalType WritePortalType
Definition: ArrayHandle.h:295
vtkm::worklet::Clip::InCellInterpolationKeys
vtkm::cont::ArrayHandle< vtkm::Id > InCellInterpolationKeys
Definition: Clip.h:910
vtkm::worklet::Clip::ScatterEdgeConnectivity::ExecutionSignature
void(_1, _2, _3) ExecutionSignature
Definition: Clip.h:532
vtkm::worklet::Keys::GetUniqueKeys
VTKM_CONT KeyArrayHandleType GetUniqueKeys() const
Definition: Keys.h:175
vtkm::UInt8
uint8_t UInt8
Definition: Types.h:157
vtkm::worklet::Clip::GenerateCellSet::ControlSignature
void(CellSetIn, FieldInPoint, FieldInCell clipTableIndices, FieldInCell clipStats, ExecObject clipTables, ExecObject connectivityObject, WholeArrayOut edgePointReverseConnectivity, WholeArrayOut edgePointInterpolation, WholeArrayOut inCellReverseConnectivity, WholeArrayOut inCellEdgeReverseConnectivity, WholeArrayOut inCellEdgeInterpolation, WholeArrayOut inCellInterpolationKeys, WholeArrayOut inCellInterpolationInfo, WholeArrayOut cellMapOutputToInput) ControlSignature
Definition: Clip.h:337
vtkm::worklet::Clip::GenerateCellSet::GenerateCellSet
VTKM_CONT GenerateCellSet(vtkm::Float64 value)
Definition: Clip.h:319
vtkm::worklet::Clip::InterpolateField::PerformInCellInterpolations::ExecutionSignature
void(_2, _3) ExecutionSignature
Definition: Clip.h:821
ImplicitFunction.h
DispatcherReduceByKey.h
vtkm::worklet::Clip::ComputeStats
Definition: Clip.h:226
vtkm::worklet::Clip::EdgePointsOffset
vtkm::Id EdgePointsOffset
Definition: Clip.h:913
vtkm::worklet::Clip::Run
vtkm::cont::CellSetExplicit Run(const CellSetType &cellSet, const ImplicitFunction &clipFunction, const vtkm::cont::CoordinateSystem &coords, bool invert)
Definition: Clip.h:758
vtkm::worklet::Clip::InterpolateField::PerformInCellInterpolations::operator()
VTKM_EXEC void operator()(const MappedValueVecType &toReduce, MappedValueType &centroid) const
Definition: Clip.h:824
vtkm::cont::ExecutionObjectBase
Base ExecutionObjectBase for execution objects to inherit from so that you can use an arbitrary objec...
Definition: ExecutionObjectBase.h:31
vtkm::worklet::Clip::InterpolateField
Definition: Clip.h:767
vtkm::Vec
A short fixed-length array.
Definition: Types.h:767
vtkm::cont::ConvertNumComponentsToOffsets
VTKM_CONT_EXPORT void ConvertNumComponentsToOffsets(const vtkm::cont::UnknownArrayHandle &numComponentsArray, vtkm::cont::ArrayHandle< vtkm::Id > &offsetsArray, vtkm::Id &componentsArraySize, vtkm::cont::DeviceAdapterId device=vtkm::cont::DeviceAdapterTagAny{})
vtkm::worklet::ClipStats::NumberOfCells
vtkm::Id NumberOfCells
Definition: Clip.h:54
vtkm::worklet::ClipStats::SumOp::operator()
VTKM_EXEC_CONT ClipStats operator()(const ClipStats &stat1, const ClipStats &stat2) const
Definition: Clip.h:67
vtkm::worklet::Clip::ClipWithImplicitFunction
Definition: Clip.h:700
vtkm::worklet::ClipStats::SumOp
Definition: Clip.h:64
ConvertNumComponentsToOffsets.h
vtkm::worklet::DispatcherReduceByKey
Dispatcher for worklets that inherit from WorkletReduceByKey.
Definition: DispatcherReduceByKey.h:27
vtkm::cont::CellSetExplicit
Definition: CastAndCall.h:36
vtkm::ImplicitFunctionValueFunctor
A helpful functor that calls the value method of a given ImplicitFunction.
Definition: ImplicitFunction.h:71
vtkm::worklet::ClipStats::NumberOfIndices
vtkm::Id NumberOfIndices
Definition: Clip.h:55
vtkm::worklet::Clip::ScatterInCellConnectivity::InCellPointOffset
vtkm::Id InCellPointOffset
Definition: Clip.h:572
vtkm::worklet::Keys< vtkm::Id >
vtkm::worklet::EdgeInterpolation::Vertex1
vtkm::Id Vertex1
Definition: Clip.h:84
vtkm::worklet::Clip::InterpolateField::ValueType
typename ArrayHandleType::ValueType ValueType
Definition: Clip.h:770
vtkm::List
Definition: List.h:34
vtkm::Float64
double Float64
Definition: Types.h:155
vtkm::worklet::Clip::InterpolateField::InCellPointsOffset
vtkm::Id InCellPointsOffset
Definition: Clip.h:878
vtkm::worklet::Clip::ClipWithImplicitFunction::CellSet
const CellSetType * CellSet
Definition: Clip.h:734
vtkm::worklet::Clip::InterpolateField::InCellInterpolationKeys
vtkm::cont::ArrayHandle< vtkm::Id > InCellInterpolationKeys
Definition: Clip.h:875
vtkm::worklet::Clip::InCellPointsOffset
vtkm::Id InCellPointsOffset
Definition: Clip.h:914
vtkm::worklet::ClipStats
Definition: Clip.h:52
DispatcherMapTopology.h
WorkletMapTopology.h
vtkm::worklet::EdgeInterpolation::Weight
vtkm::Float64 Weight
Definition: Clip.h:86
ClipTables.h
vtkm::cont::ArrayHandle::ReleaseResources
VTKM_CONT void ReleaseResources() const
Releases all resources in both the control and execution environments.
Definition: ArrayHandle.h:559
vtkm::worklet::Clip::Clip
Clip()
Definition: Clip.h:575
vtkm::worklet::Clip::ClipWithImplicitFunction::Result
vtkm::cont::CellSetExplicit * Result
Definition: Clip.h:738
vtkm::worklet::Clip::ScatterInCellConnectivity::ControlSignature
void(FieldIn destinationIndices, WholeArrayOut destinationData) ControlSignature
Definition: Clip.h:557
vtkm::worklet::EdgeInterpolation::LessThanOp::operator()
VTKM_EXEC bool operator()(const EdgeInterpolation &v1, const EdgeInterpolation &v2) const
Definition: Clip.h:91
vtkm::worklet::ClipStats::NumberOfEdgeIndices
vtkm::Id NumberOfEdgeIndices
Definition: Clip.h:56
vtkm::worklet::WorkletVisitCellsWithPoints::FieldInCell
FieldInVisit FieldInCell
Definition: WorkletMapTopology.h:261
vtkm::worklet::WorkletMapField
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38
vtkm::worklet::EdgeInterpolation::LessThanOp
Definition: Clip.h:88
vtkm::worklet::Clip::GenerateCellSet
Definition: Clip.h:315
vtkm::worklet::WorkletVisitCellsWithPoints::FieldOutCell
FieldOut FieldOutCell
Definition: WorkletMapTopology.h:263
vtkm::exec::arg::WorkIndex
The ExecutionSignature tag to use to get the work index.
Definition: WorkIndex.h:39
vtkm::worklet::Clip::InterpolateField::PerformEdgeInterpolations
Definition: Clip.h:788
vtkm::worklet::ClipStats::NumberOfInCellEdgeIndices
vtkm::Id NumberOfInCellEdgeIndices
Definition: Clip.h:62
vtkm::worklet::Clip::ClipWithImplicitFunction::Offset
vtkm::Float64 Offset
Definition: Clip.h:736