2017-03-08 23:04:12 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2017-03-08 23:04:12 +00:00
|
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
|
|
//============================================================================
|
|
|
|
#ifndef vtkm_m_worklet_MaskPoints_h
|
|
|
|
#define vtkm_m_worklet_MaskPoints_h
|
|
|
|
|
2018-08-30 15:53:18 +00:00
|
|
|
#include <vtkm/cont/ArrayCopy.h>
|
2017-03-08 23:04:12 +00:00
|
|
|
#include <vtkm/cont/ArrayHandle.h>
|
|
|
|
#include <vtkm/cont/ArrayHandleCounting.h>
|
2017-05-18 14:51:24 +00:00
|
|
|
#include <vtkm/cont/DataSet.h>
|
2017-03-08 23:04:12 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace worklet
|
|
|
|
{
|
2017-03-08 23:04:12 +00:00
|
|
|
|
|
|
|
// Subselect points using stride for now, creating new cellset of vertices
|
2017-03-29 20:04:58 +00:00
|
|
|
class MaskPoints
|
2017-03-08 23:04:12 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-08-30 15:53:18 +00:00
|
|
|
template <typename CellSetType>
|
|
|
|
vtkm::cont::CellSetSingleType<> Run(const CellSetType& cellSet, const vtkm::Id stride)
|
2017-03-08 23:04:12 +00:00
|
|
|
{
|
|
|
|
vtkm::Id numberOfInputPoints = cellSet.GetNumberOfPoints();
|
|
|
|
vtkm::Id numberOfSampledPoints = numberOfInputPoints / stride;
|
|
|
|
vtkm::cont::ArrayHandleCounting<vtkm::Id> strideArray(0, stride, numberOfSampledPoints);
|
|
|
|
|
|
|
|
vtkm::cont::ArrayHandle<vtkm::Id> pointIds;
|
2018-08-30 15:53:18 +00:00
|
|
|
vtkm::cont::ArrayCopy(strideArray, pointIds);
|
2017-03-08 23:04:12 +00:00
|
|
|
|
|
|
|
// Make CellSetSingleType with VERTEX at each point id
|
2019-08-13 21:28:37 +00:00
|
|
|
vtkm::cont::CellSetSingleType<> outCellSet;
|
2017-05-18 14:29:41 +00:00
|
|
|
outCellSet.Fill(numberOfInputPoints, vtkm::CellShapeTagVertex::Id, 1, pointIds);
|
2017-03-08 23:04:12 +00:00
|
|
|
|
|
|
|
return outCellSet;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
} // namespace vtkm::worklet
|
|
|
|
|
|
|
|
#endif // vtkm_m_worklet_MaskPoints_h
|