VTK-m  2.0
worklet/Mask.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_Mask_h
11 #define vtkm_m_worklet_Mask_h
12 
14 
15 #include <vtkm/cont/ArrayCopy.h>
16 #include <vtkm/cont/ArrayHandle.h>
20 
21 namespace vtkm
22 {
23 namespace worklet
24 {
25 
26 // Subselect points using stride for now, creating new cellset of vertices
27 class Mask
28 {
29 public:
30  template <typename CellSetType>
31  vtkm::cont::CellSetPermutation<CellSetType> Run(const CellSetType& cellSet, const vtkm::Id stride)
32  {
34 
35  vtkm::Id numberOfInputCells = cellSet.GetNumberOfCells();
36  vtkm::Id numberOfSampledCells = numberOfInputCells / stride;
37  vtkm::cont::ArrayHandleCounting<vtkm::Id> strideArray(0, stride, numberOfSampledCells);
38 
39  vtkm::cont::ArrayCopy(strideArray, this->ValidCellIds);
40 
41  return OutputType(this->ValidCellIds, cellSet);
42  }
43 
45 
46 private:
48 };
49 }
50 } // namespace vtkm::worklet
51 
52 #endif // vtkm_m_worklet_Mask_h
vtkm::cont::ArrayHandle< vtkm::Id >
ArrayHandle.h
vtkm::cont::CellSetPermutation::GetNumberOfCells
VTKM_CONT vtkm::Id GetNumberOfCells() const override
Definition: CellSetPermutation.h:368
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::cont::CellSetPermutation
Definition: CastAndCall.h:38
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
ArrayCopy.h
vtkm::worklet::Mask::Run
vtkm::cont::CellSetPermutation< CellSetType > Run(const CellSetType &cellSet, const vtkm::Id stride)
Definition: worklet/Mask.h:31
vtkm::worklet::Mask::ValidCellIds
vtkm::cont::ArrayHandle< vtkm::Id > ValidCellIds
Definition: worklet/Mask.h:47
ArrayHandlePermutation.h
vtkm::cont::ArrayHandleCounting< vtkm::Id >
vtkm::worklet::Mask::GetValidCellIds
vtkm::cont::ArrayHandle< vtkm::Id > GetValidCellIds() const
Definition: worklet/Mask.h:44
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::Mask
Definition: worklet/Mask.h:27
CellSetPermutation.h
ArrayHandleCounting.h
WorkletMapTopology.h