VTK-m  2.0
worklet/MaskPoints.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_MaskPoints_h
11 #define vtkm_m_worklet_MaskPoints_h
12 
13 #include <vtkm/cont/ArrayCopy.h>
14 #include <vtkm/cont/ArrayHandle.h>
16 
17 namespace vtkm
18 {
19 namespace worklet
20 {
21 
22 // Subselect points using stride for now, creating new cellset of vertices
24 {
25 public:
26  template <typename CellSetType>
27  vtkm::cont::CellSetSingleType<> Run(const CellSetType& cellSet, const vtkm::Id stride)
28  {
29  vtkm::Id numberOfInputPoints = cellSet.GetNumberOfPoints();
30  vtkm::Id numberOfSampledPoints = numberOfInputPoints / stride;
31  vtkm::cont::ArrayHandleCounting<vtkm::Id> strideArray(0, stride, numberOfSampledPoints);
32 
34  vtkm::cont::ArrayCopy(strideArray, pointIds);
35 
36  // Make CellSetSingleType with VERTEX at each point id
38  outCellSet.Fill(numberOfInputPoints, vtkm::CellShapeTagVertex::Id, 1, pointIds);
39 
40  return outCellSet;
41  }
42 };
43 }
44 } // namespace vtkm::worklet
45 
46 #endif // vtkm_m_worklet_MaskPoints_h
vtkm::cont::ArrayHandle< vtkm::Id >
ArrayHandle.h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::worklet::MaskPoints::Run
vtkm::cont::CellSetSingleType Run(const CellSetType &cellSet, const vtkm::Id stride)
Definition: worklet/MaskPoints.h:27
vtkm::cont::CellSetSingleType
Definition: CastAndCall.h:34
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
ArrayCopy.h
vtkm::cont::ArrayHandleCounting< vtkm::Id >
vtkm::cont::ArrayCopy
void ArrayCopy(const SourceArrayType &source, DestArrayType &destination)
Does a deep copy from one array to another array.
Definition: ArrayCopy.h:142
ArrayHandleCounting.h
vtkm::worklet::MaskPoints
Definition: worklet/MaskPoints.h:23
vtkm::cont::CellSetSingleType::Fill
VTKM_CONT void Fill(vtkm::Id numPoints, vtkm::UInt8 shapeId, vtkm::IdComponent numberOfPointsPerCell, const vtkm::cont::ArrayHandle< vtkm::Id, ConnectivityStorageTag > &connectivity)
Definition: CellSetSingleType.h:186