2018-01-09 19:01:43 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2018-01-09 19:01:43 +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.
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace filter
|
|
|
|
{
|
|
|
|
|
|
|
|
VTKM_CONT
|
|
|
|
inline void Probe::SetGeometry(const vtkm::cont::DataSet& geometry)
|
|
|
|
{
|
|
|
|
this->Geometry = vtkm::cont::DataSet();
|
2019-08-13 17:08:54 +00:00
|
|
|
this->Geometry.SetCellSet(geometry.GetCellSet());
|
2018-01-09 19:01:43 +00:00
|
|
|
this->Geometry.AddCoordinateSystem(geometry.GetCoordinateSystem());
|
|
|
|
}
|
|
|
|
|
2018-08-30 15:53:18 +00:00
|
|
|
template <typename DerivedPolicy>
|
2018-04-02 21:58:21 +00:00
|
|
|
VTKM_CONT inline vtkm::cont::DataSet Probe::DoExecute(
|
2018-01-09 19:01:43 +00:00
|
|
|
const vtkm::cont::DataSet& input,
|
2018-08-30 15:53:18 +00:00
|
|
|
vtkm::filter::PolicyBase<DerivedPolicy> policy)
|
2018-01-09 19:01:43 +00:00
|
|
|
{
|
2019-08-13 17:08:54 +00:00
|
|
|
this->Worklet.Run(vtkm::filter::ApplyPolicy(input.GetCellSet(), policy),
|
|
|
|
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()),
|
|
|
|
this->Geometry.GetCoordinateSystem().GetData());
|
2018-01-09 19:01:43 +00:00
|
|
|
|
|
|
|
auto output = this->Geometry;
|
2018-08-30 15:53:18 +00:00
|
|
|
auto hpf = this->Worklet.GetHiddenPointsField();
|
|
|
|
auto hcf =
|
|
|
|
this->Worklet.GetHiddenCellsField(vtkm::filter::ApplyPolicy(output.GetCellSet(), policy));
|
2018-01-09 19:01:43 +00:00
|
|
|
|
2019-08-13 14:10:52 +00:00
|
|
|
output.AddField(vtkm::cont::make_FieldPoint("HIDDEN", hpf));
|
2019-08-13 17:08:54 +00:00
|
|
|
output.AddField(vtkm::cont::make_FieldCell("HIDDEN", hcf));
|
2018-01-09 19:01:43 +00:00
|
|
|
|
2018-04-02 21:58:21 +00:00
|
|
|
return output;
|
2018-01-09 19:01:43 +00:00
|
|
|
}
|
|
|
|
|
2018-08-30 15:53:18 +00:00
|
|
|
template <typename T, typename StorageType, typename DerivedPolicy>
|
2018-04-02 21:58:21 +00:00
|
|
|
VTKM_CONT inline bool Probe::DoMapField(vtkm::cont::DataSet& result,
|
2018-01-09 19:01:43 +00:00
|
|
|
const vtkm::cont::ArrayHandle<T, StorageType>& input,
|
|
|
|
const vtkm::filter::FieldMetadata& fieldMeta,
|
2018-08-30 15:53:18 +00:00
|
|
|
vtkm::filter::PolicyBase<DerivedPolicy>)
|
2018-01-09 19:01:43 +00:00
|
|
|
{
|
|
|
|
if (fieldMeta.IsPointField())
|
|
|
|
{
|
|
|
|
auto fieldArray =
|
2018-08-30 15:53:18 +00:00
|
|
|
this->Worklet.ProcessPointField(input, typename DerivedPolicy::AllCellSetList());
|
2018-04-02 21:58:21 +00:00
|
|
|
result.AddField(fieldMeta.AsField(fieldArray));
|
2018-01-09 19:01:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (fieldMeta.IsCellField())
|
|
|
|
{
|
2018-08-30 15:53:18 +00:00
|
|
|
auto fieldArray = this->Worklet.ProcessCellField(input);
|
2018-04-02 21:58:21 +00:00
|
|
|
result.AddField(fieldMeta.AsField(fieldArray));
|
2018-01-09 19:01:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // vtkm::filter
|