2017-03-08 23:04:12 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// Copyright 2015 Sandia Corporation.
|
|
|
|
// Copyright 2015 UT-Battelle, LLC.
|
|
|
|
// Copyright 2015 Los Alamos National Security.
|
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
|
|
|
// the U.S. Government retains certain rights in this software.
|
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
|
|
|
// Laboratory (LANL), the U.S. Government retains certain rights in
|
|
|
|
// this software.
|
|
|
|
//============================================================================
|
|
|
|
#ifndef vtkm_m_worklet_MaskPoints_h
|
|
|
|
#define vtkm_m_worklet_MaskPoints_h
|
|
|
|
|
|
|
|
#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
|
|
|
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
|
|
|
|
|
|
|
namespace vtkm {
|
|
|
|
namespace worklet {
|
|
|
|
|
|
|
|
// 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:
|
|
|
|
template <typename CellSetType,
|
|
|
|
typename DeviceAdapter>
|
|
|
|
vtkm::cont::CellSetSingleType<> Run(
|
|
|
|
const CellSetType &cellSet,
|
|
|
|
const vtkm::Id stride,
|
2017-03-28 22:07:56 +00:00
|
|
|
DeviceAdapter)
|
2017-03-08 23:04:12 +00:00
|
|
|
{
|
|
|
|
typedef typename vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter> DeviceAlgorithm;
|
2017-03-28 22:07:56 +00:00
|
|
|
|
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;
|
|
|
|
DeviceAlgorithm::Copy(strideArray, pointIds);
|
|
|
|
|
|
|
|
// Make CellSetSingleType with VERTEX at each point id
|
|
|
|
vtkm::cont::CellSetSingleType< > outCellSet("cells");
|
|
|
|
outCellSet.Fill(numberOfInputPoints,
|
|
|
|
vtkm::CellShapeTagVertex::Id,
|
|
|
|
1,
|
|
|
|
pointIds);
|
|
|
|
|
|
|
|
return outCellSet;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
} // namespace vtkm::worklet
|
|
|
|
|
|
|
|
#endif // vtkm_m_worklet_MaskPoints_h
|