VTK-m  2.0
worklet/Tetrahedralize.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_Tetrahedralize_h
11 #define vtkm_m_worklet_Tetrahedralize_h
12 
15 
16 namespace vtkm
17 {
18 namespace worklet
19 {
20 
22 {
23 public:
24  //
25  // Distribute multiple copies of cell data depending on cells create from original
26  //
28  {
29  using ControlSignature = void(FieldIn inIndices, FieldOut outIndices);
30  using ExecutionSignature = void(_1, _2);
31 
33 
34  template <typename CountArrayType>
35  VTKM_CONT static ScatterType MakeScatter(const CountArrayType& countArray)
36  {
37  return ScatterType(countArray);
38  }
39 
40  template <typename T>
41  VTKM_EXEC void operator()(T inputIndex, T& outputIndex) const
42  {
43  outputIndex = inputIndex;
44  }
45  };
46 
48  : OutCellScatter(vtkm::cont::ArrayHandle<vtkm::IdComponent>{})
49  {
50  }
51 
52  // Tetrahedralize explicit data set, save number of tetra cells per input
53  template <typename CellSetType>
54  vtkm::cont::CellSetSingleType<> Run(const CellSetType& cellSet)
55  {
56  TetrahedralizeExplicit worklet;
58  vtkm::cont::CellSetSingleType<> result = worklet.Run(cellSet, outCellsPerCell);
59  this->OutCellScatter = DistributeCellData::MakeScatter(outCellsPerCell);
60  return result;
61  }
62 
63  // Tetrahedralize structured data set, save number of tetra cells per input
65  {
68  vtkm::cont::CellSetSingleType<> result = worklet.Run(cellSet, outCellsPerCell);
69  this->OutCellScatter = DistributeCellData::MakeScatter(outCellsPerCell);
70  return result;
71  }
72 
74  {
75  throw vtkm::cont::ErrorBadType("CellSetStructured<2> can't be tetrahedralized");
76  }
77 
79  {
80  throw vtkm::cont::ErrorBadType("CellSetStructured<1> can't be tetrahedralized");
81  }
82 
84 
85 private:
87 };
88 }
89 } // namespace vtkm::worklet
90 
91 #endif // vtkm_m_worklet_Tetrahedralize_h
vtkm::worklet::Tetrahedralize::GetOutCellScatter
DistributeCellData::ScatterType GetOutCellScatter() const
Definition: worklet/Tetrahedralize.h:83
vtkm::cont::ArrayHandle< vtkm::IdComponent >
vtkm::worklet::TetrahedralizeStructured::Run
vtkm::cont::CellSetSingleType Run(const CellSetType &cellSet, vtkm::cont::ArrayHandle< vtkm::IdComponent > &outCellsPerCell)
Definition: TetrahedralizeStructured.h:79
vtkm::worklet::Tetrahedralize
Definition: worklet/Tetrahedralize.h:21
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
TetrahedralizeStructured.h
vtkm::worklet::Tetrahedralize::DistributeCellData::ControlSignature
void(FieldIn inIndices, FieldOut outIndices) ControlSignature
Definition: worklet/Tetrahedralize.h:29
vtkm::worklet::WorkletMapField::FieldOut
A control signature tag for output fields.
Definition: WorkletMapField.h:60
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::cont::CellSetStructured< 3 >
vtkm::worklet::Tetrahedralize::DistributeCellData::MakeScatter
static VTKM_CONT ScatterType MakeScatter(const CountArrayType &countArray)
Definition: worklet/Tetrahedralize.h:35
vtkm::worklet::Tetrahedralize::DistributeCellData::operator()
VTKM_EXEC void operator()(T inputIndex, T &outputIndex) const
Definition: worklet/Tetrahedralize.h:41
vtkm::worklet::Tetrahedralize::DistributeCellData
Definition: worklet/Tetrahedralize.h:27
vtkm::worklet::TetrahedralizeStructured
Compute the tetrahedralize cells for a uniform grid data set.
Definition: TetrahedralizeStructured.h:75
TetrahedralizeExplicit.h
vtkm::cont::CellSetSingleType
Definition: CastAndCall.h:34
vtkm::worklet::Tetrahedralize::DistributeCellData::ScatterType
vtkm::worklet::ScatterCounting ScatterType
Definition: worklet/Tetrahedralize.h:32
vtkm::cont::ErrorBadType
This class is thrown when VTK-m encounters data of a type that is incompatible with the current opera...
Definition: ErrorBadType.h:25
vtkm::worklet::ScatterCounting
A scatter that maps input to some numbers of output.
Definition: ScatterCounting.h:44
vtkm::worklet::TetrahedralizeExplicit
Compute the tetrahedralize cells for an explicit grid data set.
Definition: TetrahedralizeExplicit.h:34
vtkm::worklet::WorkletMapField::FieldIn
A control signature tag for input fields.
Definition: WorkletMapField.h:49
vtkm::worklet::Tetrahedralize::Run
vtkm::cont::CellSetSingleType Run(const CellSetType &cellSet)
Definition: worklet/Tetrahedralize.h:54
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::worklet::Tetrahedralize::Run
vtkm::cont::CellSetSingleType Run(const vtkm::cont::CellSetStructured< 3 > &cellSet)
Definition: worklet/Tetrahedralize.h:64
vtkm::worklet::TetrahedralizeExplicit::Run
vtkm::cont::CellSetSingleType Run(const CellSetType &cellSet, vtkm::cont::ArrayHandle< vtkm::IdComponent > &outCellsPerCell)
Definition: TetrahedralizeExplicit.h:100
vtkm::worklet::Tetrahedralize::DistributeCellData::ExecutionSignature
void(_1, _2) ExecutionSignature
Definition: worklet/Tetrahedralize.h:30
vtkm::worklet::Tetrahedralize::Tetrahedralize
Tetrahedralize()
Definition: worklet/Tetrahedralize.h:47
vtkm::worklet::Tetrahedralize::Run
vtkm::cont::CellSetSingleType Run(const vtkm::cont::CellSetStructured< 1 > &)
Definition: worklet/Tetrahedralize.h:78
vtkm::worklet::Tetrahedralize::Run
vtkm::cont::CellSetSingleType Run(const vtkm::cont::CellSetStructured< 2 > &)
Definition: worklet/Tetrahedralize.h:73
vtkm::worklet::WorkletMapField
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38
vtkm::worklet::Tetrahedralize::OutCellScatter
DistributeCellData::ScatterType OutCellScatter
Definition: worklet/Tetrahedralize.h:86