vtk-m2/vtkm/filter/Tube.hxx
2019-08-19 09:08:42 -04:00

61 lines
2.1 KiB
C++

//============================================================================
// 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.
//============================================================================
#include <vtkm/cont/ArrayCopy.h>
#include <vtkm/cont/ArrayHandleIndex.h>
#include <vtkm/cont/ErrorFilterExecution.h>
namespace vtkm
{
namespace filter
{
//-----------------------------------------------------------------------------
inline VTKM_CONT Tube::Tube()
: vtkm::filter::FilterDataSet<Tube>()
, Worklet()
{
}
//-----------------------------------------------------------------------------
template <typename Policy>
inline VTKM_CONT vtkm::cont::DataSet Tube::DoExecute(const vtkm::cont::DataSet& input,
vtkm::filter::PolicyBase<Policy>)
{
vtkm::worklet::Tube tube(this->Capping, this->NumberOfSides, this->Radius);
vtkm::cont::ArrayHandle<vtkm::Vec3f> newPoints;
vtkm::cont::CellSetSingleType<> newCells;
tube.Run(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()),
input.GetCellSet(this->GetActiveCellSetIndex()),
newPoints,
newCells);
vtkm::cont::DataSet outData;
vtkm::cont::CoordinateSystem outCoords("coordinates", newPoints);
outData.AddCellSet(newCells);
outData.AddCoordinateSystem(outCoords);
return outData;
}
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy>
inline VTKM_CONT bool Tube::DoMapField(vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<T, StorageType>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<DerivedPolicy>)
{
return false;
}
}
} // namespace vtkm::filter