2018-06-22 13:23:28 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2018-06-22 13:23:28 +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.
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#ifndef vtk_m_filter_CoordianteSystemTransform_h
|
|
|
|
#define vtk_m_filter_CoordianteSystemTransform_h
|
|
|
|
|
|
|
|
#include <vtkm/filter/FilterField.h>
|
|
|
|
#include <vtkm/worklet/CoordinateSystemTransform.h>
|
|
|
|
|
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace filter
|
|
|
|
{
|
|
|
|
/// \brief
|
|
|
|
///
|
|
|
|
/// Generate a coordinate transformation on coordiantes from a dataset.
|
|
|
|
class CylindricalCoordinateTransform
|
2018-06-24 20:29:20 +00:00
|
|
|
: public vtkm::filter::FilterField<CylindricalCoordinateTransform>
|
2018-06-22 13:23:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-12-05 17:55:57 +00:00
|
|
|
using SupportedTypes = vtkm::TypeListFieldVec3;
|
2019-08-02 02:03:04 +00:00
|
|
|
|
2018-06-22 13:23:28 +00:00
|
|
|
VTKM_CONT
|
2020-03-05 20:21:47 +00:00
|
|
|
CylindricalCoordinateTransform() = default;
|
2018-06-22 13:23:28 +00:00
|
|
|
|
|
|
|
VTKM_CONT void SetCartesianToCylindrical() { Worklet.SetCartesianToCylindrical(); }
|
|
|
|
VTKM_CONT void SetCylindricalToCartesian() { Worklet.SetCylindricalToCartesian(); }
|
|
|
|
|
2018-08-30 15:53:18 +00:00
|
|
|
template <typename T, typename StorageType, typename DerivedPolicy>
|
2018-06-22 13:23:28 +00:00
|
|
|
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
|
|
|
|
const vtkm::cont::ArrayHandle<T, StorageType>& field,
|
|
|
|
const vtkm::filter::FieldMetadata& fieldMeta,
|
2018-08-30 15:53:18 +00:00
|
|
|
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
2018-06-22 13:23:28 +00:00
|
|
|
|
|
|
|
private:
|
2018-06-24 20:29:20 +00:00
|
|
|
vtkm::worklet::CylindricalCoordinateTransform Worklet;
|
2018-06-22 13:23:28 +00:00
|
|
|
};
|
|
|
|
|
2018-06-25 17:29:18 +00:00
|
|
|
class SphericalCoordinateTransform : public vtkm::filter::FilterField<SphericalCoordinateTransform>
|
2018-06-22 13:23:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-12-05 17:55:57 +00:00
|
|
|
using SupportedTypes = vtkm::TypeListFieldVec3;
|
2019-08-02 02:03:04 +00:00
|
|
|
|
2018-06-22 13:23:28 +00:00
|
|
|
VTKM_CONT
|
2020-03-05 20:21:47 +00:00
|
|
|
SphericalCoordinateTransform() = default;
|
2018-06-22 13:23:28 +00:00
|
|
|
|
|
|
|
VTKM_CONT void SetCartesianToSpherical() { Worklet.SetCartesianToSpherical(); }
|
|
|
|
VTKM_CONT void SetSphericalToCartesian() { Worklet.SetSphericalToCartesian(); }
|
|
|
|
|
2018-08-30 15:53:18 +00:00
|
|
|
template <typename T, typename StorageType, typename DerivedPolicy>
|
2020-03-05 20:21:47 +00:00
|
|
|
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet&,
|
|
|
|
const vtkm::cont::ArrayHandle<T, StorageType>&,
|
|
|
|
const vtkm::filter::FieldMetadata&,
|
|
|
|
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
2018-06-22 13:23:28 +00:00
|
|
|
|
|
|
|
private:
|
2018-06-25 17:29:18 +00:00
|
|
|
vtkm::worklet::SphericalCoordinateTransform Worklet;
|
2018-06-22 13:23:28 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
} // namespace vtkm::filter
|
|
|
|
|
|
|
|
#include <vtkm/filter/CoordinateSystemTransform.hxx>
|
|
|
|
|
|
|
|
#endif // vtk_m_filter_CoordianteSystemTransform_h
|