2019-04-23 14:57:35 +00:00
|
|
|
//=============================================================================
|
|
|
|
//
|
2019-04-23 14:57:35 +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.
|
2019-04-23 14:57:35 +00:00
|
|
|
//
|
|
|
|
//=============================================================================
|
2019-04-23 14:57:35 +00:00
|
|
|
#ifndef vtk_m_filter_ComputeMoments_hxx
|
|
|
|
#define vtk_m_filter_ComputeMoments_hxx
|
|
|
|
|
|
|
|
#include <vtkm/cont/ArrayHandle.h>
|
|
|
|
#include <vtkm/filter/internal/CreateResult.h>
|
|
|
|
#include <vtkm/worklet/moments/ComputeMoments.h>
|
|
|
|
|
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace filter
|
|
|
|
{
|
|
|
|
|
|
|
|
VTKM_CONT ComputeMoments::ComputeMoments()
|
|
|
|
{
|
|
|
|
this->SetOutputFieldName("moments_");
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T, typename StorageType, typename DerivedPolicy>
|
|
|
|
inline VTKM_CONT vtkm::cont::DataSet ComputeMoments::DoExecute(
|
|
|
|
const vtkm::cont::DataSet& input,
|
|
|
|
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
|
|
|
const vtkm::filter::FieldMetadata& fieldMetadata,
|
2019-05-09 22:33:04 +00:00
|
|
|
const vtkm::filter::PolicyBase<DerivedPolicy>& policy)
|
2019-04-23 14:57:35 +00:00
|
|
|
{
|
|
|
|
if (fieldMetadata.GetAssociation() != vtkm::cont::Field::Association::POINTS)
|
|
|
|
{
|
|
|
|
throw vtkm::cont::ErrorBadValue("Active field for ComputeMoments must be a point field.");
|
|
|
|
}
|
|
|
|
|
|
|
|
vtkm::cont::DataSet output = internal::CreateResult(input);
|
2019-04-23 14:57:35 +00:00
|
|
|
|
2019-06-17 18:27:52 +00:00
|
|
|
auto worklet = vtkm::worklet::moments::ComputeMoments(this->Radius);
|
2019-04-23 14:57:35 +00:00
|
|
|
|
2019-07-24 15:32:03 +00:00
|
|
|
worklet.Run(input.GetCellSet(this->GetActiveCellSetIndex()), field, this->Order, output);
|
2019-04-23 14:57:35 +00:00
|
|
|
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif //vtk_m_filter_ComputeMoments_hxx
|