VTK-m  2.0
worklet/ExternalFaces.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_ExternalFaces_h
11 #define vtk_m_worklet_ExternalFaces_h
12 
13 #include <vtkm/CellShape.h>
14 #include <vtkm/Hash.h>
15 #include <vtkm/Math.h>
16 
17 #include <vtkm/exec/CellFace.h>
18 
19 #include <vtkm/cont/Algorithm.h>
20 #include <vtkm/cont/ArrayCopy.h>
23 #include <vtkm/cont/ArrayHandle.h>
34 #include <vtkm/cont/DataSet.h>
35 #include <vtkm/cont/Field.h>
36 #include <vtkm/cont/Timer.h>
37 
40 #include <vtkm/worklet/Keys.h>
44 
45 namespace vtkm
46 {
47 namespace worklet
48 {
49 
51 {
52  //Worklet that returns the number of external faces for each structured cell
54  {
55  public:
56  using ControlSignature = void(CellSetIn inCellSet,
57  FieldOut numFacesInCell,
58  FieldInPoint pointCoordinates);
59  using ExecutionSignature = _2(CellShape, _3);
60  using InputDomain = _1;
61 
62  VTKM_CONT
64  const vtkm::Vec3f_64& max_point)
65  : MinPoint(min_point)
66  , MaxPoint(max_point)
67  {
68  }
69 
70  VTKM_EXEC
72  vtkm::Float64 grid_max,
73  vtkm::Float64 cell_min,
74  vtkm::Float64 cell_max)
75  {
76  vtkm::IdComponent count = 0;
77 
78  bool cell_min_at_grid_boundary = cell_min <= grid_min;
79  bool cell_max_at_grid_boundary = cell_max >= grid_max;
80 
81  if (cell_min_at_grid_boundary && !cell_max_at_grid_boundary)
82  {
83  count++;
84  }
85  else if (!cell_min_at_grid_boundary && cell_max_at_grid_boundary)
86  {
87  count++;
88  }
89  else if (cell_min_at_grid_boundary && cell_max_at_grid_boundary)
90  {
91  count += 2;
92  }
93 
94  return count;
95  }
96 
97  template <typename CellShapeTag, typename PointCoordVecType>
99  const PointCoordVecType& pointCoordinates) const
100  {
101  (void)shape; // C4100 false positive workaround
102  VTKM_ASSERT(shape.Id == CELL_SHAPE_HEXAHEDRON);
103 
104  vtkm::IdComponent count = 0;
105 
107  MinPoint[0], MaxPoint[0], pointCoordinates[0][0], pointCoordinates[1][0]);
108 
110  MinPoint[1], MaxPoint[1], pointCoordinates[0][1], pointCoordinates[3][1]);
111 
113  MinPoint[2], MaxPoint[2], pointCoordinates[0][2], pointCoordinates[4][2]);
114 
115  return count;
116  }
117 
118  private:
121  };
122 
123 
124  //Worklet that finds face connectivity for each structured cell
126  {
127  public:
128  using ControlSignature = void(CellSetIn inCellSet,
129  WholeCellSetIn<> inputCell,
130  FieldOut faceShapes,
131  FieldOut facePointCount,
132  FieldOut faceConnectivity,
133  FieldInPoint pointCoordinates);
134  using ExecutionSignature = void(CellShape, VisitIndex, InputIndex, _2, _3, _4, _5, _6);
135  using InputDomain = _1;
136 
138 
139  template <typename CountArrayType>
140  VTKM_CONT static ScatterType MakeScatter(const CountArrayType& countArray)
141  {
142  VTKM_IS_ARRAY_HANDLE(CountArrayType);
143  return ScatterType(countArray);
144  }
145 
146  VTKM_CONT
147  BuildConnectivityStructured(const vtkm::Vec3f_64& min_point, const vtkm::Vec3f_64& max_point)
148  : MinPoint(min_point)
149  , MaxPoint(max_point)
150  {
151  }
152 
153  enum FaceType
154  {
159  };
160 
161  VTKM_EXEC
162  static inline bool FoundFaceOnDimension(vtkm::Float64 grid_min,
163  vtkm::Float64 grid_max,
164  vtkm::Float64 cell_min,
165  vtkm::Float64 cell_max,
166  vtkm::IdComponent& faceIndex,
167  vtkm::IdComponent& count,
168  vtkm::IdComponent dimensionFaceOffset,
169  vtkm::IdComponent visitIndex)
170  {
171  bool cell_min_at_grid_boundary = cell_min <= grid_min;
172  bool cell_max_at_grid_boundary = cell_max >= grid_max;
173 
174  FaceType Faces = FaceType::FACE_NONE;
175 
176  if (cell_min_at_grid_boundary && !cell_max_at_grid_boundary)
177  {
178  Faces = FaceType::FACE_GRID_MIN;
179  }
180  else if (!cell_min_at_grid_boundary && cell_max_at_grid_boundary)
181  {
182  Faces = FaceType::FACE_GRID_MAX;
183  }
184  else if (cell_min_at_grid_boundary && cell_max_at_grid_boundary)
185  {
186  Faces = FaceType::FACE_GRID_MIN_AND_MAX;
187  }
188 
189  if (Faces == FaceType::FACE_NONE)
190  return false;
191 
192  if (Faces == FaceType::FACE_GRID_MIN)
193  {
194  if (visitIndex == count)
195  {
196  faceIndex = dimensionFaceOffset;
197  return true;
198  }
199  else
200  {
201  count++;
202  }
203  }
204  else if (Faces == FaceType::FACE_GRID_MAX)
205  {
206  if (visitIndex == count)
207  {
208  faceIndex = dimensionFaceOffset + 1;
209  return true;
210  }
211  else
212  {
213  count++;
214  }
215  }
216  else if (Faces == FaceType::FACE_GRID_MIN_AND_MAX)
217  {
218  if (visitIndex == count)
219  {
220  faceIndex = dimensionFaceOffset;
221  return true;
222  }
223  count++;
224  if (visitIndex == count)
225  {
226  faceIndex = dimensionFaceOffset + 1;
227  return true;
228  }
229  count++;
230  }
231 
232  return false;
233  }
234 
235  template <typename PointCoordVecType>
237  vtkm::IdComponent visitIndex,
238  const PointCoordVecType& pointCoordinates) const
239  {
240  vtkm::IdComponent count = 0;
241  vtkm::IdComponent faceIndex = 0;
242  // Search X dimension
244  MaxPoint[0],
245  pointCoordinates[0][0],
246  pointCoordinates[1][0],
247  faceIndex,
248  count,
249  0,
250  visitIndex))
251  {
252  // Search Y dimension
254  MaxPoint[1],
255  pointCoordinates[0][1],
256  pointCoordinates[3][1],
257  faceIndex,
258  count,
259  2,
260  visitIndex))
261  {
262  // Search Z dimension
264  MaxPoint[2],
265  pointCoordinates[0][2],
266  pointCoordinates[4][2],
267  faceIndex,
268  count,
269  4,
270  visitIndex);
271  }
272  }
273  return faceIndex;
274  }
275 
276  template <typename CellShapeTag,
277  typename CellSetType,
278  typename PointCoordVecType,
279  typename ConnectivityType>
280  VTKM_EXEC void operator()(CellShapeTag shape,
281  vtkm::IdComponent visitIndex,
282  vtkm::Id inputIndex,
283  const CellSetType& cellSet,
284  vtkm::UInt8& shapeOut,
285  vtkm::IdComponent& numFacePointsOut,
286  ConnectivityType& faceConnectivity,
287  const PointCoordVecType& pointCoordinates) const
288  {
289  VTKM_ASSERT(shape.Id == CELL_SHAPE_HEXAHEDRON);
290 
291  vtkm::IdComponent faceIndex = FindFaceIndexForVisit(visitIndex, pointCoordinates);
292 
293  vtkm::IdComponent numFacePoints;
294  vtkm::exec::CellFaceNumberOfPoints(faceIndex, shape, numFacePoints);
295  VTKM_ASSERT(numFacePoints == faceConnectivity.GetNumberOfComponents());
296 
297  typename CellSetType::IndicesType inCellIndices = cellSet.GetIndices(inputIndex);
298 
299  shapeOut = vtkm::CELL_SHAPE_QUAD;
300  numFacePointsOut = 4;
301 
302  for (vtkm::IdComponent facePointIndex = 0; facePointIndex < numFacePoints; facePointIndex++)
303  {
304  vtkm::IdComponent localFaceIndex;
305  vtkm::ErrorCode status =
306  vtkm::exec::CellFaceLocalIndex(facePointIndex, faceIndex, shape, localFaceIndex);
307  if (status == vtkm::ErrorCode::Success)
308  {
309  faceConnectivity[facePointIndex] = inCellIndices[localFaceIndex];
310  }
311  else
312  {
313  // An error condition, but do we want to crash the operation?
314  faceConnectivity[facePointIndex] = 0;
315  }
316  }
317  }
318 
319  private:
322  };
323 
324  //Worklet that returns the number of faces for each cell/shape
326  {
327  public:
328  using ControlSignature = void(CellSetIn inCellSet, FieldOut numFacesInCell);
329  using ExecutionSignature = void(CellShape, _2);
330  using InputDomain = _1;
331 
332  template <typename CellShapeTag>
333  VTKM_EXEC void operator()(CellShapeTag shape, vtkm::IdComponent& numFaces) const
334  {
335  vtkm::exec::CellFaceNumberOfFaces(shape, numFaces);
336  }
337  };
338 
339  //Worklet that identifies a cell face by a hash value. Not necessarily completely unique.
341  {
342  public:
343  using ControlSignature = void(CellSetIn cellset,
344  FieldOut faceHashes,
345  FieldOut originCells,
346  FieldOut originFaces);
347  using ExecutionSignature = void(_2, _3, _4, CellShape, PointIndices, InputIndex, VisitIndex);
348  using InputDomain = _1;
349 
351 
352  template <typename CellShapeTag, typename CellNodeVecType>
354  vtkm::Id& cellIndex,
355  vtkm::IdComponent& faceIndex,
356  CellShapeTag shape,
357  const CellNodeVecType& cellNodeIds,
358  vtkm::Id inputIndex,
359  vtkm::IdComponent visitIndex) const
360  {
361  vtkm::Id3 faceId;
362  vtkm::exec::CellFaceCanonicalId(visitIndex, shape, cellNodeIds, faceId);
363  faceHash = vtkm::Hash(faceId);
364 
365  cellIndex = inputIndex;
366  faceIndex = visitIndex;
367  }
368  };
369 
370  // Worklet that identifies the number of cells written out per face.
371  // Because there can be collisions in the face ids, this instance might
372  // represent multiple faces, which have to be checked. The resulting
373  // number is the total number of external faces.
375  {
376  public:
377  using ControlSignature = void(KeysIn keys,
378  WholeCellSetIn<> inputCells,
379  ValuesIn originCells,
380  ValuesIn originFaces,
381  ReducedValuesOut numOutputCells);
382  using ExecutionSignature = _5(_2, _3, _4);
383  using InputDomain = _1;
384 
385  template <typename CellSetType, typename OriginCellsType, typename OriginFacesType>
386  VTKM_EXEC vtkm::IdComponent operator()(const CellSetType& cellSet,
387  const OriginCellsType& originCells,
388  const OriginFacesType& originFaces) const
389  {
390  vtkm::IdComponent numCellsOnHash = originCells.GetNumberOfComponents();
391  VTKM_ASSERT(originFaces.GetNumberOfComponents() == numCellsOnHash);
392 
393  // Start by assuming all faces are unique, then remove one for each
394  // face we find a duplicate for.
395  vtkm::IdComponent numExternalFaces = numCellsOnHash;
396 
397  for (vtkm::IdComponent myIndex = 0;
398  myIndex < numCellsOnHash - 1; // Don't need to check last face
399  myIndex++)
400  {
401  vtkm::Id3 myFace;
402  vtkm::exec::CellFaceCanonicalId(originFaces[myIndex],
403  cellSet.GetCellShape(originCells[myIndex]),
404  cellSet.GetIndices(originCells[myIndex]),
405  myFace);
406  for (vtkm::IdComponent otherIndex = myIndex + 1; otherIndex < numCellsOnHash; otherIndex++)
407  {
408  vtkm::Id3 otherFace;
409  vtkm::exec::CellFaceCanonicalId(originFaces[otherIndex],
410  cellSet.GetCellShape(originCells[otherIndex]),
411  cellSet.GetIndices(originCells[otherIndex]),
412  otherFace);
413  if (myFace == otherFace)
414  {
415  // Faces are the same. Must be internal. Remove 2, one for each face. We don't have to
416  // worry about otherFace matching anything else because a proper topology will have at
417  // most 2 cells sharing a face, so there should be no more matches.
418  numExternalFaces -= 2;
419  break;
420  }
421  }
422  }
423 
424  return numExternalFaces;
425  }
426  };
427 
428 private:
429  // Resolves duplicate hashes by finding a specified unique face for a given hash.
430  // Given a cell set (from a WholeCellSetIn) and the cell/face id pairs for each face
431  // associated with a given hash, returns the index of the cell/face provided of the
432  // visitIndex-th unique face. Basically, this method searches through all the cell/face
433  // pairs looking for unique sets and returns the one associated with visitIndex.
434  template <typename CellSetType, typename OriginCellsType, typename OriginFacesType>
435  VTKM_EXEC static vtkm::IdComponent FindUniqueFace(const CellSetType& cellSet,
436  const OriginCellsType& originCells,
437  const OriginFacesType& originFaces,
438  vtkm::IdComponent visitIndex)
439  {
440  vtkm::IdComponent numCellsOnHash = originCells.GetNumberOfComponents();
441  VTKM_ASSERT(originFaces.GetNumberOfComponents() == numCellsOnHash);
442 
443  // Find the visitIndex-th unique face.
444  vtkm::IdComponent numFound = 0;
445  vtkm::IdComponent myIndex = 0;
446  while (true)
447  {
448  VTKM_ASSERT(myIndex < numCellsOnHash);
449  vtkm::Id3 myFace;
450  vtkm::exec::CellFaceCanonicalId(originFaces[myIndex],
451  cellSet.GetCellShape(originCells[myIndex]),
452  cellSet.GetIndices(originCells[myIndex]),
453  myFace);
454  bool foundPair = false;
455  for (vtkm::IdComponent otherIndex = myIndex + 1; otherIndex < numCellsOnHash; otherIndex++)
456  {
457  vtkm::Id3 otherFace;
458  vtkm::exec::CellFaceCanonicalId(originFaces[otherIndex],
459  cellSet.GetCellShape(originCells[otherIndex]),
460  cellSet.GetIndices(originCells[otherIndex]),
461  otherFace);
462  if (myFace == otherFace)
463  {
464  // Faces are the same. Must be internal.
465  foundPair = true;
466  break;
467  }
468  }
469 
470  if (!foundPair)
471  {
472  if (numFound == visitIndex)
473  {
474  break;
475  }
476  else
477  {
478  numFound++;
479  }
480  }
481 
482  myIndex++;
483  }
484 
485  return myIndex;
486  }
487 
488 public:
489  // Worklet that returns the number of points for each outputted face.
490  // Have to manage the case where multiple faces have the same hash.
492  {
493  public:
494  using ControlSignature = void(KeysIn keys,
495  WholeCellSetIn<> inputCells,
496  ValuesIn originCells,
497  ValuesIn originFaces,
498  ReducedValuesOut numPointsInFace);
499  using ExecutionSignature = void(_2, _3, _4, VisitIndex, _5);
500  using InputDomain = _1;
501 
503 
504  template <typename CountArrayType>
505  VTKM_CONT static ScatterType MakeScatter(const CountArrayType& countArray)
506  {
507  VTKM_IS_ARRAY_HANDLE(CountArrayType);
508  return ScatterType(countArray);
509  }
510 
511  template <typename CellSetType, typename OriginCellsType, typename OriginFacesType>
512  VTKM_EXEC void operator()(const CellSetType& cellSet,
513  const OriginCellsType& originCells,
514  const OriginFacesType& originFaces,
515  vtkm::IdComponent visitIndex,
516  vtkm::IdComponent& numFacePoints) const
517  {
518  vtkm::IdComponent myIndex =
519  ExternalFaces::FindUniqueFace(cellSet, originCells, originFaces, visitIndex);
520 
521  vtkm::exec::CellFaceNumberOfPoints(
522  originFaces[myIndex], cellSet.GetCellShape(originCells[myIndex]), numFacePoints);
523  }
524  };
525 
526  // Worklet that returns the shape and connectivity for each external face
528  {
529  public:
530  using ControlSignature = void(KeysIn keys,
531  WholeCellSetIn<> inputCells,
532  ValuesIn originCells,
533  ValuesIn originFaces,
534  ReducedValuesOut shapesOut,
535  ReducedValuesOut connectivityOut,
536  ReducedValuesOut cellIdMapOut);
537  using ExecutionSignature = void(_2, _3, _4, VisitIndex, _5, _6, _7);
538  using InputDomain = _1;
539 
541 
542  template <typename CellSetType,
543  typename OriginCellsType,
544  typename OriginFacesType,
545  typename ConnectivityType>
546  VTKM_EXEC void operator()(const CellSetType& cellSet,
547  const OriginCellsType& originCells,
548  const OriginFacesType& originFaces,
549  vtkm::IdComponent visitIndex,
550  vtkm::UInt8& shapeOut,
551  ConnectivityType& connectivityOut,
552  vtkm::Id& cellIdMapOut) const
553  {
554  const vtkm::IdComponent myIndex =
555  ExternalFaces::FindUniqueFace(cellSet, originCells, originFaces, visitIndex);
556  const vtkm::IdComponent myFace = originFaces[myIndex];
557 
558 
559  typename CellSetType::CellShapeTag shapeIn = cellSet.GetCellShape(originCells[myIndex]);
560  vtkm::exec::CellFaceShape(myFace, shapeIn, shapeOut);
561  cellIdMapOut = originCells[myIndex];
562 
563  vtkm::IdComponent numFacePoints;
564  vtkm::exec::CellFaceNumberOfPoints(myFace, shapeIn, numFacePoints);
565 
566  VTKM_ASSERT(numFacePoints == connectivityOut.GetNumberOfComponents());
567 
568  typename CellSetType::IndicesType inCellIndices = cellSet.GetIndices(originCells[myIndex]);
569 
570  for (vtkm::IdComponent facePointIndex = 0; facePointIndex < numFacePoints; facePointIndex++)
571  {
572  vtkm::IdComponent localFaceIndex;
573  vtkm::ErrorCode status =
574  vtkm::exec::CellFaceLocalIndex(facePointIndex, myFace, shapeIn, localFaceIndex);
575  if (status == vtkm::ErrorCode::Success)
576  {
577  connectivityOut[facePointIndex] = inCellIndices[localFaceIndex];
578  }
579  else
580  {
581  // An error condition, but do we want to crash the operation?
582  connectivityOut[facePointIndex] = 0;
583  }
584  }
585  }
586  };
587 
589  {
590  public:
591  using ControlSignature = void(CellSetIn inCellSet, FieldOut isPolyDataCell);
592  using ExecutionSignature = _2(CellShape);
593  using InputDomain = _1;
594 
595  template <typename CellShapeTag>
596  VTKM_EXEC vtkm::IdComponent operator()(CellShapeTag shape) const
597  {
598  vtkm::IdComponent numFaces;
599  vtkm::exec::CellFaceNumberOfFaces(shape, numFaces);
600  return !numFaces;
601  }
602  };
603 
605  {
606  public:
608 
609  using ControlSignature = void(CellSetIn inCellSet, FieldOut numPoints);
611  using InputDomain = _1;
612 
613  VTKM_EXEC vtkm::Id operator()(vtkm::Id count) const { return count; }
614  };
615 
617  {
618  public:
620 
621  using ControlSignature = void(CellSetIn inputTopology,
622  FieldOut shapes,
623  FieldOut pointIndices,
624  FieldOut cellIdMapOut);
625  using ExecutionSignature = void(CellShape, PointIndices, InputIndex, _2, _3, _4);
626 
627  template <typename CellShape, typename InPointIndexType, typename OutPointIndexType>
628  VTKM_EXEC void operator()(const CellShape& inShape,
629  const InPointIndexType& inPoints,
630  vtkm::Id inputIndex,
631  vtkm::UInt8& outShape,
632  OutPointIndexType& outPoints,
633  vtkm::Id& cellIdMapOut) const
634  {
635  cellIdMapOut = inputIndex;
636  outShape = inShape.Id;
637 
638  vtkm::IdComponent numPoints = inPoints.GetNumberOfComponents();
639  VTKM_ASSERT(numPoints == outPoints.GetNumberOfComponents());
640  for (vtkm::IdComponent pointIndex = 0; pointIndex < numPoints; pointIndex++)
641  {
642  outPoints[pointIndex] = inPoints[pointIndex];
643  }
644  }
645  };
646 
647  template <typename T>
648  struct BiasFunctor
649  {
651  explicit BiasFunctor(T bias = T(0))
652  : Bias(bias)
653  {
654  }
655 
657  T operator()(T x) const { return x + this->Bias; }
658 
659  T Bias;
660  };
661 
662 public:
663  VTKM_CONT
665  : PassPolyData(true)
666  {
667  }
668 
669  VTKM_CONT
670  void SetPassPolyData(bool flag) { this->PassPolyData = flag; }
671 
672  VTKM_CONT
673  bool GetPassPolyData() const { return this->PassPolyData; }
674 
676 
677 
683  template <typename ShapeStorage, typename ConnectivityStorage, typename OffsetsStorage>
685  const vtkm::cont::CellSetStructured<3>& inCellSet,
686  const vtkm::cont::CoordinateSystem& coord,
688  {
689  vtkm::Vec3f_64 MinPoint;
690  vtkm::Vec3f_64 MaxPoint;
691 
692  vtkm::Id3 PointDimensions = inCellSet.GetPointDimensions();
693 
694  using DefaultHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
695  using CartesianArrayHandle =
697 
698  auto coordData = coord.GetData();
699  if (coordData.CanConvert<CartesianArrayHandle>())
700  {
701  const auto vertices = coordData.AsArrayHandle<CartesianArrayHandle>();
702  const auto vertsSize = vertices.GetNumberOfValues();
703  const auto tmp = vtkm::cont::ArrayGetValues({ 0, vertsSize - 1 }, vertices);
704  MinPoint = tmp[0];
705  MaxPoint = tmp[1];
706  }
707  else
708  {
709  auto vertices = coordData.AsArrayHandle<vtkm::cont::ArrayHandleUniformPointCoordinates>();
710  auto Coordinates = vertices.ReadPortal();
711 
712  MinPoint = Coordinates.GetOrigin();
713  vtkm::Vec3f_64 spacing = Coordinates.GetSpacing();
714 
715  vtkm::Vec3f_64 unitLength;
716  unitLength[0] = static_cast<vtkm::Float64>(PointDimensions[0] - 1);
717  unitLength[1] = static_cast<vtkm::Float64>(PointDimensions[1] - 1);
718  unitLength[2] = static_cast<vtkm::Float64>(PointDimensions[2] - 1);
719  MaxPoint = MinPoint + spacing * unitLength;
720  }
721 
722  // Create a worklet to count the number of external faces on each cell
725  numExternalFacesDispatcher((NumExternalFacesPerStructuredCell(MinPoint, MaxPoint)));
726 
727  numExternalFacesDispatcher.Invoke(inCellSet, numExternalFaces, coordData);
728 
729  vtkm::Id numberOfExternalFaces =
730  vtkm::cont::Algorithm::Reduce(numExternalFaces, 0, vtkm::Sum());
731 
732  auto scatterCellToExternalFace = BuildConnectivityStructured::MakeScatter(numExternalFaces);
733 
734  // Maps output cells to input cells. Store this for cell field mapping.
735  this->CellIdMap = scatterCellToExternalFace.GetOutputToInputMap();
736 
737  numExternalFaces.ReleaseResources();
738 
739  vtkm::Id connectivitySize = 4 * numberOfExternalFaces;
743  // Must pre allocate because worklet invocation will not have enough
744  // information to.
745  faceConnectivity.Allocate(connectivitySize);
746 
748  buildConnectivityStructuredDispatcher(BuildConnectivityStructured(MinPoint, MaxPoint),
749  scatterCellToExternalFace);
750 
751  buildConnectivityStructuredDispatcher.Invoke(
752  inCellSet,
753  inCellSet,
754  faceShapes,
755  facePointCount,
756  vtkm::cont::make_ArrayHandleGroupVec<4>(faceConnectivity),
757  coordData);
758 
759  auto offsets = vtkm::cont::ConvertNumComponentsToOffsets(facePointCount);
760 
761  outCellSet.Fill(inCellSet.GetNumberOfPoints(), faceShapes, faceConnectivity, offsets);
762  }
763 
766  template <typename InCellSetType,
767  typename ShapeStorage,
768  typename ConnectivityStorage,
769  typename OffsetsStorage>
771  const InCellSetType& inCellSet,
773  {
774  using PointCountArrayType = vtkm::cont::ArrayHandle<vtkm::IdComponent>;
776  using OffsetsArrayType = vtkm::cont::ArrayHandle<vtkm::Id, OffsetsStorage>;
777  using ConnectivityArrayType = vtkm::cont::ArrayHandle<vtkm::Id, ConnectivityStorage>;
778 
779  //Create a worklet to map the number of faces to each cell
782 
783  numFacesDispatcher.Invoke(inCellSet, facesPerCell);
784 
785  vtkm::worklet::ScatterCounting scatterCellToFace(facesPerCell);
786  facesPerCell.ReleaseResources();
787 
788  PointCountArrayType polyDataPointCount;
789  ShapeArrayType polyDataShapes;
790  OffsetsArrayType polyDataOffsets;
791  ConnectivityArrayType polyDataConnectivity;
792  vtkm::cont::ArrayHandle<vtkm::Id> polyDataCellIdMap;
793  vtkm::Id polyDataConnectivitySize = 0;
794  if (this->PassPolyData)
795  {
798 
799  isPolyDataCellDispatcher.Invoke(inCellSet, isPolyDataCell);
800 
801  vtkm::worklet::ScatterCounting scatterPolyDataCells(isPolyDataCell);
802 
803  isPolyDataCell.ReleaseResources();
804 
805  if (scatterPolyDataCells.GetOutputRange(inCellSet.GetNumberOfCells()) != 0)
806  {
808  countPolyDataCellPointsDispatcher(scatterPolyDataCells);
809 
810  countPolyDataCellPointsDispatcher.Invoke(inCellSet, polyDataPointCount);
811 
813  polyDataPointCount, polyDataOffsets, polyDataConnectivitySize);
814 
816  scatterPolyDataCells);
817 
818  polyDataConnectivity.Allocate(polyDataConnectivitySize);
819 
820  passPolyDataCellsDispatcher.Invoke(
821  inCellSet,
822  polyDataShapes,
823  vtkm::cont::make_ArrayHandleGroupVecVariable(polyDataConnectivity, polyDataOffsets),
824  polyDataCellIdMap);
825  }
826  }
827 
828  if (scatterCellToFace.GetOutputRange(inCellSet.GetNumberOfCells()) == 0)
829  {
830  if (!polyDataConnectivitySize)
831  {
832  // Data has no faces. Output is empty.
833  outCellSet.PrepareToAddCells(0, 0);
834  outCellSet.CompleteAddingCells(inCellSet.GetNumberOfPoints());
835  return;
836  }
837  else
838  {
839  // Pass only input poly data to output
840  outCellSet.Fill(
841  inCellSet.GetNumberOfPoints(), polyDataShapes, polyDataConnectivity, polyDataOffsets);
842  this->CellIdMap = polyDataCellIdMap;
843  return;
844  }
845  }
846 
850  vtkm::worklet::DispatcherMapTopology<FaceHash> faceHashDispatcher(scatterCellToFace);
851 
852  faceHashDispatcher.Invoke(inCellSet, faceHashes, originCells, originFaces);
853 
854  vtkm::worklet::Keys<vtkm::HashType> faceKeys(faceHashes);
855 
858 
859  faceCountDispatcher.Invoke(faceKeys, inCellSet, originCells, originFaces, faceOutputCount);
860 
861  auto scatterCullInternalFaces = NumPointsPerFace::MakeScatter(faceOutputCount);
862 
863  PointCountArrayType facePointCount;
865  scatterCullInternalFaces);
866 
867  pointsPerFaceDispatcher.Invoke(faceKeys, inCellSet, originCells, originFaces, facePointCount);
868 
869  ShapeArrayType faceShapes;
870 
871  OffsetsArrayType faceOffsets;
872  vtkm::Id connectivitySize;
873  vtkm::cont::ConvertNumComponentsToOffsets(facePointCount, faceOffsets, connectivitySize);
874 
875  ConnectivityArrayType faceConnectivity;
876  // Must pre allocate because worklet invocation will not have enough
877  // information to.
878  faceConnectivity.Allocate(connectivitySize);
879 
881  scatterCullInternalFaces);
882 
883  vtkm::cont::ArrayHandle<vtkm::Id> faceToCellIdMap;
884 
885  // Create a view that doesn't have the last offset:
886  auto faceOffsetsTrim =
887  vtkm::cont::make_ArrayHandleView(faceOffsets, 0, faceOffsets.GetNumberOfValues() - 1);
888 
889  buildConnectivityDispatcher.Invoke(
890  faceKeys,
891  inCellSet,
892  originCells,
893  originFaces,
894  faceShapes,
895  vtkm::cont::make_ArrayHandleGroupVecVariable(faceConnectivity, faceOffsets),
896  faceToCellIdMap);
897 
898  if (!polyDataConnectivitySize)
899  {
900  outCellSet.Fill(inCellSet.GetNumberOfPoints(), faceShapes, faceConnectivity, faceOffsets);
901  this->CellIdMap = faceToCellIdMap;
902  }
903  else
904  {
905  // Join poly data to face data output
907  faceShapes, polyDataShapes);
908  ShapeArrayType joinedShapesArray;
909  vtkm::cont::ArrayCopy(faceShapesArray, joinedShapesArray);
910 
912  facePointCount, polyDataPointCount);
913  PointCountArrayType joinedPointCountArray;
914  vtkm::cont::ArrayCopy(pointCountArray, joinedPointCountArray);
915 
917  connectivityArray(faceConnectivity, polyDataConnectivity);
918  ConnectivityArrayType joinedConnectivity;
919  vtkm::cont::ArrayCopy(connectivityArray, joinedConnectivity);
920 
921  // Adjust poly data offsets array with face connectivity size before join
922  auto adjustedPolyDataOffsets = vtkm::cont::make_ArrayHandleTransform(
923  polyDataOffsets, BiasFunctor<vtkm::Id>(faceConnectivity.GetNumberOfValues()));
924 
925  auto offsetsArray =
926  vtkm::cont::make_ArrayHandleConcatenate(faceOffsetsTrim, adjustedPolyDataOffsets);
927  OffsetsArrayType joinedOffsets;
928  // Need to compile a special device copy because the precompiled ArrayCopy does not
929  // know how to copy the ArrayHandleTransform.
930  vtkm::cont::ArrayCopyDevice(offsetsArray, joinedOffsets);
931 
934  cellIdMapArray(faceToCellIdMap, polyDataCellIdMap);
935  vtkm::cont::ArrayHandle<vtkm::Id> joinedCellIdMap;
936  vtkm::cont::ArrayCopy(cellIdMapArray, joinedCellIdMap);
937 
938  outCellSet.Fill(
939  inCellSet.GetNumberOfPoints(), joinedShapesArray, joinedConnectivity, joinedOffsets);
940  this->CellIdMap = joinedCellIdMap;
941  }
942  }
943 
945 
946 private:
949 
950 }; //struct ExternalFaces
951 }
952 } //namespace vtkm::worklet
953 
954 #endif //vtk_m_worklet_ExternalFaces_h
ArrayHandleConcatenate.h
vtkm::cont::ArrayCopyDevice
VTKM_CONT void ArrayCopyDevice(const vtkm::cont::ArrayHandle< InValueType, InStorage > &source, vtkm::cont::ArrayHandle< OutValueType, OutStorage > &destination)
Does a deep copy from one array to another array.
Definition: ArrayCopyDevice.h:75
vtkm::worklet::ExternalFaces::BuildConnectivity
Definition: worklet/ExternalFaces.h:527
vtkm::worklet::ExternalFaces::FindUniqueFace
static VTKM_EXEC vtkm::IdComponent FindUniqueFace(const CellSetType &cellSet, const OriginCellsType &originCells, const OriginFacesType &originFaces, vtkm::IdComponent visitIndex)
Definition: worklet/ExternalFaces.h:435
vtkm::cont::ArrayHandle< vtkm::FloatDefault >
vtkm::worklet::ExternalFaces::CountPolyDataCellPoints::ExecutionSignature
_2(PointCount) ExecutionSignature
Definition: worklet/ExternalFaces.h:610
ArrayHandle.h
vtkm::ErrorCode
ErrorCode
Definition: ErrorCode.h:19
vtkm::worklet::ExternalFaces::PassPolyDataCells::ControlSignature
void(CellSetIn inputTopology, FieldOut shapes, FieldOut pointIndices, FieldOut cellIdMapOut) ControlSignature
Definition: worklet/ExternalFaces.h:624
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::ExecutionSignature
void(CellShape, VisitIndex, InputIndex, _2, _3, _4, _5, _6) ExecutionSignature
Definition: worklet/ExternalFaces.h:134
vtkm::worklet::ExternalFaces::CountPolyDataCellPoints
Definition: worklet/ExternalFaces.h:604
vtkm::Hash
VTKM_EXEC_CONT vtkm::HashType Hash(const InVecType &inVec)
Returns a 32-bit hash on a group of integer-type values.
Definition: Hash.h:106
vtkm::worklet::ExternalFaces::NumExternalFacesPerStructuredCell::ExecutionSignature
_2(CellShape, _3) ExecutionSignature
Definition: worklet/ExternalFaces.h:59
vtkm::worklet::ExternalFaces::NumFacesPerCell::ExecutionSignature
void(CellShape, _2) ExecutionSignature
Definition: worklet/ExternalFaces.h:329
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::ExternalFaces::CountPolyDataCellPoints::InputDomain
_1 InputDomain
Definition: worklet/ExternalFaces.h:611
vtkm::worklet::ExternalFaces::FaceHash::ControlSignature
void(CellSetIn cellset, FieldOut faceHashes, FieldOut originCells, FieldOut originFaces) ControlSignature
Definition: worklet/ExternalFaces.h:346
vtkm::worklet::ExternalFaces::IsPolyDataCell::InputDomain
_1 InputDomain
Definition: worklet/ExternalFaces.h:593
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::FindFaceIndexForVisit
VTKM_EXEC vtkm::IdComponent FindFaceIndexForVisit(vtkm::IdComponent visitIndex, const PointCoordVecType &pointCoordinates) const
Definition: worklet/ExternalFaces.h:236
vtkm::cont::ArrayHandleConcatenate
Definition: ArrayHandleConcatenate.h:241
vtkm::cont::make_ArrayHandleView
ArrayHandleView< ArrayHandleType > make_ArrayHandleView(const ArrayHandleType &array, vtkm::Id startIndex, vtkm::Id numValues)
Definition: ArrayHandleView.h:222
vtkm::worklet::ExternalFaces::NumPointsPerFace::ExecutionSignature
void(_2, _3, _4, VisitIndex, _5) ExecutionSignature
Definition: worklet/ExternalFaces.h:499
VTKM_ASSERT
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
CellSetExplicit.h
vtkm::worklet::ExternalFaces::BiasFunctor::BiasFunctor
VTKM_EXEC_CONT BiasFunctor(T bias=T(0))
Definition: worklet/ExternalFaces.h:651
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
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::ExternalFaces::SetPassPolyData
VTKM_CONT void SetPassPolyData(bool flag)
Definition: worklet/ExternalFaces.h:670
vtkm::worklet::ExternalFaces::NumExternalFacesPerStructuredCell::MaxPoint
vtkm::Vec3f_64 MaxPoint
Definition: worklet/ExternalFaces.h:120
vtkm::worklet::ExternalFaces::BiasFunctor
Definition: worklet/ExternalFaces.h:648
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::cont::CellSetStructured< 3 >
vtkm::cont::CellSetExplicit::PrepareToAddCells
VTKM_CONT void PrepareToAddCells(vtkm::Id numCells, vtkm::Id connectivityMaxLen)
First method to add cells – one at a time.
vtkm::worklet::ExternalFaces::NumExternalFacesPerStructuredCell::NumExternalFacesPerStructuredCell
VTKM_CONT NumExternalFacesPerStructuredCell(const vtkm::Vec3f_64 &min_point, const vtkm::Vec3f_64 &max_point)
Definition: worklet/ExternalFaces.h:63
vtkm::worklet::ExternalFaces::IsPolyDataCell::operator()
VTKM_EXEC vtkm::IdComponent operator()(CellShapeTag shape) const
Definition: worklet/ExternalFaces.h:596
vtkm::ErrorCode::Success
@ Success
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::FACE_GRID_MIN
@ FACE_GRID_MIN
Definition: worklet/ExternalFaces.h:155
vtkm::worklet::ExternalFaces::PassPolyDataCells
Definition: worklet/ExternalFaces.h:616
ArrayHandleTransform.h
Keys.h
vtkm::cont::ArrayHandleCartesianProduct
ArrayHandleCartesianProduct is a specialization of ArrayHandle.
Definition: ArrayHandleCartesianProduct.h:326
vtkm::cont::ArrayGetValues
VTKM_CONT void ArrayGetValues(const vtkm::cont::ArrayHandle< vtkm::Id, SIds > &ids, const vtkm::cont::ArrayHandle< T, SData > &data, vtkm::cont::ArrayHandle< T, SOut > &output)
Obtain a small set of values from an ArrayHandle with minimal device transfers.
Definition: ArrayGetValues.h:119
vtkm::worklet::ExternalFaces::ReleaseCellMapArrays
void ReleaseCellMapArrays()
Definition: worklet/ExternalFaces.h:675
vtkm::worklet::ExternalFaces::BuildConnectivity::ExecutionSignature
void(_2, _3, _4, VisitIndex, _5, _6, _7) ExecutionSignature
Definition: worklet/ExternalFaces.h:537
vtkm::worklet::ExternalFaces::IsPolyDataCell::ExecutionSignature
_2(CellShape) ExecutionSignature
Definition: worklet/ExternalFaces.h:592
ArrayHandleConstant.h
vtkm::worklet::ExternalFaces::NumFacesPerCell::InputDomain
_1 InputDomain
Definition: worklet/ExternalFaces.h:330
CellFace.h
vtkm::worklet::ExternalFaces::NumFacesPerCell::ControlSignature
void(CellSetIn inCellSet, FieldOut numFacesInCell) ControlSignature
Definition: worklet/ExternalFaces.h:328
vtkm::worklet::WorkletReduceByKey::ReducedValuesOut
A control signature tag for reduced output values.
Definition: WorkletReduceByKey.h:150
CellShape.h
ArrayHandleView.h
vtkm::worklet::WorkletVisitCellsWithPoints::PointIndices
IncidentElementIndices PointIndices
Definition: WorkletMapTopology.h:269
vtkm::HashType
vtkm::UInt32 HashType
Definition: Hash.h:20
vtkm::worklet::ExternalFaces::FaceHash::InputDomain
_1 InputDomain
Definition: worklet/ExternalFaces.h:348
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
ArrayCopy.h
vtkm::worklet::ExternalFaces::IsPolyDataCell::ControlSignature
void(CellSetIn inCellSet, FieldOut isPolyDataCell) ControlSignature
Definition: worklet/ExternalFaces.h:591
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::FoundFaceOnDimension
static VTKM_EXEC bool FoundFaceOnDimension(vtkm::Float64 grid_min, vtkm::Float64 grid_max, vtkm::Float64 cell_min, vtkm::Float64 cell_max, vtkm::IdComponent &faceIndex, vtkm::IdComponent &count, vtkm::IdComponent dimensionFaceOffset, vtkm::IdComponent visitIndex)
Definition: worklet/ExternalFaces.h:162
vtkm::worklet::ExternalFaces::FaceHash
Definition: worklet/ExternalFaces.h:340
ScatterCounting.h
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::FACE_NONE
@ FACE_NONE
Definition: worklet/ExternalFaces.h:158
vtkm::cont::CoordinateSystem
Definition: CoordinateSystem.h:25
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::MaxPoint
vtkm::Vec3f_64 MaxPoint
Definition: worklet/ExternalFaces.h:321
vtkm::Sum
Binary Predicate that takes two arguments argument x, and y and returns sum (addition) of the two val...
Definition: BinaryOperators.h:33
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::operator()
VTKM_EXEC void operator()(CellShapeTag shape, vtkm::IdComponent visitIndex, vtkm::Id inputIndex, const CellSetType &cellSet, vtkm::UInt8 &shapeOut, vtkm::IdComponent &numFacePointsOut, ConnectivityType &faceConnectivity, const PointCoordVecType &pointCoordinates) const
Definition: worklet/ExternalFaces.h:280
vtkm::worklet::ScatterCounting
A scatter that maps input to some numbers of output.
Definition: ScatterCounting.h:44
vtkm::worklet::ExternalFaces::FaceHash::operator()
VTKM_EXEC void operator()(vtkm::HashType &faceHash, vtkm::Id &cellIndex, vtkm::IdComponent &faceIndex, CellShapeTag shape, const CellNodeVecType &cellNodeIds, vtkm::Id inputIndex, vtkm::IdComponent visitIndex) const
Definition: worklet/ExternalFaces.h:353
vtkm::cont::CellSetStructured::GetNumberOfPoints
vtkm::Id GetNumberOfPoints() const override
Definition: CellSetStructured.h:40
vtkm::worklet::ExternalFaces::FaceCounts::InputDomain
_1 InputDomain
Definition: worklet/ExternalFaces.h:383
vtkm::worklet::ExternalFaces::GetPassPolyData
VTKM_CONT bool GetPassPolyData() const
Definition: worklet/ExternalFaces.h:673
vtkm::worklet::ExternalFaces::NumFacesPerCell
Definition: worklet/ExternalFaces.h:325
vtkm::worklet::ExternalFaces::NumExternalFacesPerStructuredCell::operator()
VTKM_EXEC vtkm::IdComponent operator()(CellShapeTag shape, const PointCoordVecType &pointCoordinates) const
Definition: worklet/ExternalFaces.h:98
WorkletReduceByKey.h
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::MinPoint
vtkm::Vec3f_64 MinPoint
Definition: worklet/ExternalFaces.h:320
Math.h
vtkm::cont::make_ArrayHandleTransform
VTKM_CONT vtkm::cont::ArrayHandleTransform< HandleType, FunctorType > make_ArrayHandleTransform(HandleType handle, FunctorType functor)
make_ArrayHandleTransform is convenience function to generate an ArrayHandleTransform.
Definition: ArrayHandleTransform.h:474
ArrayCopyDevice.h
ArrayHandlePermutation.h
Timer.h
Algorithm.h
vtkm::worklet::DispatcherMapTopology
Dispatcher for worklets that inherit from WorkletMapTopology.
Definition: DispatcherMapTopology.h:31
ArrayHandleIndex.h
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::BuildConnectivityStructured
VTKM_CONT BuildConnectivityStructured(const vtkm::Vec3f_64 &min_point, const vtkm::Vec3f_64 &max_point)
Definition: worklet/ExternalFaces.h:147
vtkm::worklet::WorkletReduceByKey
Definition: WorkletReduceByKey.h:42
VTKM_IS_ARRAY_HANDLE
#define VTKM_IS_ARRAY_HANDLE(T)
Definition: ArrayHandle.h:132
vtkm::worklet::ScatterCounting::GetOutputRange
VTKM_CONT vtkm::Id GetOutputRange(vtkm::Id inputRange) const
Definition: ScatterCounting.h:90
vtkm::worklet::ExternalFaces::NumExternalFacesPerStructuredCell::InputDomain
_1 InputDomain
Definition: worklet/ExternalFaces.h:60
vtkm::worklet::WorkletVisitCellsWithPoints
Base class for worklets that map from Points to Cells.
Definition: WorkletMapTopology.h:255
vtkm::cont::ArrayCopy
void ArrayCopy(const SourceArrayType &source, DestArrayType &destination)
Does a deep copy from one array to another array.
Definition: ArrayCopy.h:142
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::FACE_GRID_MAX
@ FACE_GRID_MAX
Definition: worklet/ExternalFaces.h:156
vtkm::cont::make_ArrayHandleGroupVecVariable
VTKM_CONT vtkm::cont::ArrayHandleGroupVecVariable< ComponentsArrayHandleType, OffsetsArrayHandleType > make_ArrayHandleGroupVecVariable(const ComponentsArrayHandleType &componentsArray, const OffsetsArrayHandleType &offsetsArray)
make_ArrayHandleGroupVecVariable is convenience function to generate an ArrayHandleGroupVecVariable.
Definition: ArrayHandleGroupVecVariable.h:308
vtkm::worklet::ExternalFaces::FaceCounts::operator()
VTKM_EXEC vtkm::IdComponent operator()(const CellSetType &cellSet, const OriginCellsType &originCells, const OriginFacesType &originFaces) const
Definition: worklet/ExternalFaces.h:386
vtkm::worklet::ExternalFaces::NumPointsPerFace::InputDomain
_1 InputDomain
Definition: worklet/ExternalFaces.h:500
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::ControlSignature
void(CellSetIn inCellSet, WholeCellSetIn<> inputCell, FieldOut faceShapes, FieldOut facePointCount, FieldOut faceConnectivity, FieldInPoint pointCoordinates) ControlSignature
Definition: worklet/ExternalFaces.h:133
vtkm::worklet::ExternalFaces::NumPointsPerFace::ScatterType
vtkm::worklet::ScatterCounting ScatterType
Definition: worklet/ExternalFaces.h:502
vtkm::worklet::WorkletVisitCellsWithPoints::FieldInPoint
FieldInIncident FieldInPoint
Definition: WorkletMapTopology.h:259
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::cont::ArrayHandleUniformPointCoordinates::GetOrigin
VTKM_CONT vtkm::Vec3f GetOrigin() const
vtkm::worklet::WorkletReduceByKey::KeysIn
A control signature tag for input keys.
Definition: WorkletReduceByKey.h:56
vtkm::worklet::ExternalFaces::Run
VTKM_CONT void Run(const vtkm::cont::CellSetStructured< 3 > &inCellSet, const vtkm::cont::CoordinateSystem &coord, vtkm::cont::CellSetExplicit< ShapeStorage, ConnectivityStorage, OffsetsStorage > &outCellSet)
ExternalFaces: Extract Faces on outside of geometry for regular grids.
Definition: worklet/ExternalFaces.h:684
vtkm::CELL_SHAPE_HEXAHEDRON
@ CELL_SHAPE_HEXAHEDRON
Definition: CellShape.h:48
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::ExternalFaces::BiasFunctor::operator()
VTKM_EXEC_CONT T operator()(T x) const
Definition: worklet/ExternalFaces.h:657
vtkm::worklet::ExternalFaces::BiasFunctor::Bias
T Bias
Definition: worklet/ExternalFaces.h:659
vtkm::UInt8
uint8_t UInt8
Definition: Types.h:157
vtkm::worklet::ExternalFaces::FaceHash::ExecutionSignature
void(_2, _3, _4, CellShape, PointIndices, InputIndex, VisitIndex) ExecutionSignature
Definition: worklet/ExternalFaces.h:347
vtkm::cont::make_ArrayHandleConcatenate
VTKM_CONT ArrayHandleConcatenate< ArrayHandleType1, ArrayHandleType2 > make_ArrayHandleConcatenate(const ArrayHandleType1 &array1, const ArrayHandleType2 &array2)
Definition: ArrayHandleConcatenate.h:266
ArrayHandleGroupVec.h
ArrayGetValues.h
vtkm::worklet::ExternalFaces::NumExternalFacesPerStructuredCell::CountExternalFacesOnDimension
static VTKM_EXEC vtkm::IdComponent CountExternalFacesOnDimension(vtkm::Float64 grid_min, vtkm::Float64 grid_max, vtkm::Float64 cell_min, vtkm::Float64 cell_max)
Definition: worklet/ExternalFaces.h:71
DispatcherReduceByKey.h
vtkm::cont::CellSetStructured::GetPointDimensions
SchedulingRangeType GetPointDimensions() const
Definition: CellSetStructured.h:64
vtkm::worklet::ExternalFaces::NumFacesPerCell::operator()
VTKM_EXEC void operator()(CellShapeTag shape, vtkm::IdComponent &numFaces) const
Definition: worklet/ExternalFaces.h:333
vtkm::Vec< vtkm::Float64, 3 >
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::ExternalFaces::FaceCounts
Definition: worklet/ExternalFaces.h:374
vtkm::worklet::ExternalFaces::CellIdMap
vtkm::cont::ArrayHandle< vtkm::Id > CellIdMap
Definition: worklet/ExternalFaces.h:947
ConvertNumComponentsToOffsets.h
vtkm::worklet::DispatcherReduceByKey
Dispatcher for worklets that inherit from WorkletReduceByKey.
Definition: DispatcherReduceByKey.h:27
vtkm::worklet::ExternalFaces::NumExternalFacesPerStructuredCell
Definition: worklet/ExternalFaces.h:53
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::FaceType
FaceType
Definition: worklet/ExternalFaces.h:153
vtkm::cont::ArrayHandleUniformPointCoordinates
ArrayHandleUniformPointCoordinates is a specialization of ArrayHandle.
Definition: ArrayHandleUniformPointCoordinates.h:45
vtkm::worklet::ExternalFaces::NumExternalFacesPerStructuredCell::ControlSignature
void(CellSetIn inCellSet, FieldOut numFacesInCell, FieldInPoint pointCoordinates) ControlSignature
Definition: worklet/ExternalFaces.h:58
vtkm::cont::Algorithm::Reduce
static VTKM_CONT U Reduce(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue)
Definition: Algorithm.h:656
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::CellSetExplicit
Definition: CastAndCall.h:36
vtkm::worklet::ExternalFaces::PassPolyDataCells::operator()
VTKM_EXEC void operator()(const CellShape &inShape, const InPointIndexType &inPoints, vtkm::Id inputIndex, vtkm::UInt8 &outShape, OutPointIndexType &outPoints, vtkm::Id &cellIdMapOut) const
Definition: worklet/ExternalFaces.h:628
vtkm::worklet::Keys
Manage keys for a WorkletReduceByKey.
Definition: Keys.h:131
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::InputDomain
_1 InputDomain
Definition: worklet/ExternalFaces.h:135
vtkm::worklet::ExternalFaces::Run
VTKM_CONT void Run(const InCellSetType &inCellSet, vtkm::cont::CellSetExplicit< ShapeStorage, ConnectivityStorage, OffsetsStorage > &outCellSet)
ExternalFaces: Extract Faces on outside of geometry.
Definition: worklet/ExternalFaces.h:770
Field.h
vtkm::worklet::ExternalFaces::FaceCounts::ExecutionSignature
_5(_2, _3, _4) ExecutionSignature
Definition: worklet/ExternalFaces.h:382
vtkm::cont::CellSetExplicit::CompleteAddingCells
VTKM_CONT void CompleteAddingCells(vtkm::Id numPoints)
vtkm::worklet::ExternalFaces::BuildConnectivity::operator()
VTKM_EXEC void operator()(const CellSetType &cellSet, const OriginCellsType &originCells, const OriginFacesType &originFaces, vtkm::IdComponent visitIndex, vtkm::UInt8 &shapeOut, ConnectivityType &connectivityOut, vtkm::Id &cellIdMapOut) const
Definition: worklet/ExternalFaces.h:546
vtkm::worklet::ExternalFaces
Definition: worklet/ExternalFaces.h:50
vtkm::Float64
double Float64
Definition: Types.h:155
vtkm::worklet::ExternalFaces::NumPointsPerFace::MakeScatter
static VTKM_CONT ScatterType MakeScatter(const CountArrayType &countArray)
Definition: worklet/ExternalFaces.h:505
ArrayHandleGroupVecVariable.h
vtkm::worklet::ExternalFaces::NumPointsPerFace
Definition: worklet/ExternalFaces.h:491
vtkm::worklet::ExternalFaces::CountPolyDataCellPoints::operator()
VTKM_EXEC vtkm::Id operator()(vtkm::Id count) const
Definition: worklet/ExternalFaces.h:613
vtkm::cont::ArrayHandleUniformPointCoordinates::GetSpacing
VTKM_CONT vtkm::Vec3f GetSpacing() const
vtkm::worklet::ExternalFaces::GetCellIdMap
vtkm::cont::ArrayHandle< vtkm::Id > GetCellIdMap() const
Definition: worklet/ExternalFaces.h:944
vtkm::worklet::ExternalFaces::BuildConnectivity::ControlSignature
void(KeysIn keys, WholeCellSetIn<> inputCells, ValuesIn originCells, ValuesIn originFaces, ReducedValuesOut shapesOut, ReducedValuesOut connectivityOut, ReducedValuesOut cellIdMapOut) ControlSignature
Definition: worklet/ExternalFaces.h:536
vtkm::worklet::ExternalFaces::NumExternalFacesPerStructuredCell::MinPoint
vtkm::Vec3f_64 MinPoint
Definition: worklet/ExternalFaces.h:119
vtkm::worklet::ExternalFaces::BuildConnectivityStructured
Definition: worklet/ExternalFaces.h:125
vtkm::worklet::ExternalFaces::ExternalFaces
VTKM_CONT ExternalFaces()
Definition: worklet/ExternalFaces.h:664
vtkm::worklet::ExternalFaces::PassPolyData
bool PassPolyData
Definition: worklet/ExternalFaces.h:948
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::FACE_GRID_MIN_AND_MAX
@ FACE_GRID_MIN_AND_MAX
Definition: worklet/ExternalFaces.h:157
vtkm::exec::arg::VisitIndex
The ExecutionSignature tag to use to get the visit index.
Definition: VisitIndex.h:43
DispatcherMapTopology.h
WorkletMapTopology.h
Hash.h
vtkm::worklet::ExternalFaces::NumPointsPerFace::ControlSignature
void(KeysIn keys, WholeCellSetIn<> inputCells, ValuesIn originCells, ValuesIn originFaces, ReducedValuesOut numPointsInFace) ControlSignature
Definition: worklet/ExternalFaces.h:498
vtkm::worklet::ExternalFaces::PassPolyDataCells::ExecutionSignature
void(CellShape, PointIndices, InputIndex, _2, _3, _4) ExecutionSignature
Definition: worklet/ExternalFaces.h:625
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::MakeScatter
static VTKM_CONT ScatterType MakeScatter(const CountArrayType &countArray)
Definition: worklet/ExternalFaces.h:140
vtkm::worklet::ExternalFaces::IsPolyDataCell
Definition: worklet/ExternalFaces.h:588
vtkm::exec::arg::InputIndex
The ExecutionSignature tag to use to get the input index.
Definition: InputIndex.h:42
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::ExternalFaces::FaceCounts::ControlSignature
void(KeysIn keys, WholeCellSetIn<> inputCells, ValuesIn originCells, ValuesIn originFaces, ReducedValuesOut numOutputCells) ControlSignature
Definition: worklet/ExternalFaces.h:381
vtkm::worklet::ExternalFaces::CountPolyDataCellPoints::ControlSignature
void(CellSetIn inCellSet, FieldOut numPoints) ControlSignature
Definition: worklet/ExternalFaces.h:609
vtkm::cont::CoordinateSystem::GetData
VTKM_CONT vtkm::cont::UncertainArrayHandle< vtkm::TypeListFieldVec3, VTKM_DEFAULT_STORAGE_LIST > GetData() const
DataSet.h
vtkm::worklet::ExternalFaces::BuildConnectivity::InputDomain
_1 InputDomain
Definition: worklet/ExternalFaces.h:538
vtkm::worklet::ExternalFaces::NumPointsPerFace::operator()
VTKM_EXEC void operator()(const CellSetType &cellSet, const OriginCellsType &originCells, const OriginFacesType &originFaces, vtkm::IdComponent visitIndex, vtkm::IdComponent &numFacePoints) const
Definition: worklet/ExternalFaces.h:512
vtkm::CELL_SHAPE_QUAD
@ CELL_SHAPE_QUAD
Definition: CellShape.h:45
vtkm::worklet::ExternalFaces::BuildConnectivityStructured::ScatterType
vtkm::worklet::ScatterCounting ScatterType
Definition: worklet/ExternalFaces.h:137