mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 18:45:43 +00:00
89fa2c0293
By removing the ability to have multiple CellSets in a DataSet we can simplify the following things: - Cell Fields now don't require a CellSet name when being constructed - Filters don't need to manage what the active cellset is
43 lines
1.3 KiB
C++
43 lines
1.3 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.
|
|
//============================================================================
|
|
|
|
namespace vtkm
|
|
{
|
|
namespace filter
|
|
{
|
|
|
|
VTKM_CONT ImageConnectivity::ImageConnectivity()
|
|
{
|
|
this->SetOutputFieldName("component");
|
|
}
|
|
|
|
template <typename T, typename StorageType, typename DerivedPolicy>
|
|
inline VTKM_CONT vtkm::cont::DataSet ImageConnectivity::DoExecute(
|
|
const vtkm::cont::DataSet& input,
|
|
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
|
const vtkm::filter::FieldMetadata& fieldMetadata,
|
|
const vtkm::filter::PolicyBase<DerivedPolicy>& policy)
|
|
{
|
|
if (!fieldMetadata.IsPointField())
|
|
{
|
|
throw vtkm::cont::ErrorBadValue("Active field for ImageConnectivity must be a point field.");
|
|
}
|
|
|
|
vtkm::cont::ArrayHandle<vtkm::Id> component;
|
|
|
|
vtkm::worklet::connectivity::ImageConnectivity().Run(
|
|
vtkm::filter::ApplyPolicy(input.GetCellSet(), policy), field, component);
|
|
|
|
auto result = CreateResult(input, component, this->GetOutputFieldName(), fieldMetadata);
|
|
return result;
|
|
}
|
|
}
|
|
}
|