2016-08-23 14:23:42 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2016-08-23 14:23:42 +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.
|
|
|
|
//============================================================================
|
|
|
|
|
2019-10-07 19:39:02 +00:00
|
|
|
#ifndef vtk_m_filter_ClipWithImplicitFunction_hxx
|
|
|
|
#define vtk_m_filter_ClipWithImplicitFunction_hxx
|
|
|
|
|
2016-08-23 14:23:42 +00:00
|
|
|
#include <vtkm/cont/ArrayHandlePermutation.h>
|
|
|
|
#include <vtkm/cont/CellSetPermutation.h>
|
2017-05-18 14:51:24 +00:00
|
|
|
#include <vtkm/cont/DynamicCellSet.h>
|
2016-08-23 14:23:42 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace filter
|
|
|
|
{
|
2016-08-23 14:23:42 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
2018-08-30 15:53:18 +00:00
|
|
|
template <typename DerivedPolicy>
|
2018-04-02 21:58:21 +00:00
|
|
|
inline vtkm::cont::DataSet ClipWithImplicitFunction::DoExecute(
|
2017-05-26 17:53:28 +00:00
|
|
|
const vtkm::cont::DataSet& input,
|
2019-09-09 13:39:23 +00:00
|
|
|
vtkm::filter::PolicyBase<DerivedPolicy> policy)
|
2016-08-23 14:23:42 +00:00
|
|
|
{
|
|
|
|
//get the cells and coordinates of the dataset
|
2019-08-13 17:08:54 +00:00
|
|
|
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
|
2016-08-23 14:23:42 +00:00
|
|
|
|
|
|
|
const vtkm::cont::CoordinateSystem& inputCoords =
|
2017-05-18 14:29:41 +00:00
|
|
|
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
|
2016-08-23 14:23:42 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
vtkm::cont::CellSetExplicit<> outputCellSet = this->Worklet.Run(
|
2019-09-09 22:08:11 +00:00
|
|
|
vtkm::filter::ApplyPolicyCellSet(cells, policy), this->Function, inputCoords, this->Invert);
|
2016-08-23 14:23:42 +00:00
|
|
|
|
2017-04-18 15:01:17 +00:00
|
|
|
// compute output coordinates
|
2018-08-30 15:53:18 +00:00
|
|
|
auto outputCoordsArray = this->Worklet.ProcessPointField(inputCoords.GetData());
|
2017-06-12 16:04:11 +00:00
|
|
|
vtkm::cont::CoordinateSystem outputCoords(inputCoords.GetName(), outputCoordsArray);
|
2017-04-18 15:01:17 +00:00
|
|
|
|
2016-08-23 14:23:42 +00:00
|
|
|
//create the output data
|
|
|
|
vtkm::cont::DataSet output;
|
2019-08-13 17:08:54 +00:00
|
|
|
output.SetCellSet(outputCellSet);
|
2017-05-18 14:29:41 +00:00
|
|
|
output.AddCoordinateSystem(outputCoords);
|
2016-08-23 14:23:42 +00:00
|
|
|
|
2018-04-02 21:58:21 +00:00
|
|
|
return output;
|
2016-08-23 14:23:42 +00:00
|
|
|
}
|
|
|
|
}
|
2017-06-12 16:04:11 +00:00
|
|
|
} // end namespace vtkm::filter
|
2019-10-07 19:39:02 +00:00
|
|
|
|
|
|
|
#endif
|