Commit 27dade14 authored by Dave Pugmire's avatar Dave Pugmire
Browse files

Fixes for coordinate systems w/ help from Sujin.

parent db5ded3a
......@@ -72,7 +72,7 @@ set(header_template_sources
ClipWithField.hxx
ClipWithImplicitFunction.hxx
ContourTreeUniform.hxx
CoordinateSystemTransform.hxx
CoordinateSystemTransform.hxx
CrossProduct.hxx
DotProduct.hxx
Entropy.hxx
......
......@@ -31,9 +31,8 @@ namespace filter
/// \brief
///
/// Generate a coordinate transformation on coordiantes from a dataset.
template <typename S>
class CylindricalCoordinateTransform
: public vtkm::filter::FilterField<CylindricalCoordinateTransform<S>>
: public vtkm::filter::FilterField<CylindricalCoordinateTransform>
{
public:
VTKM_CONT
......@@ -50,11 +49,11 @@ public:
const DeviceAdapter& tag);
private:
vtkm::worklet::CylindricalCoordinateTransform<S> Worklet;
vtkm::worklet::CylindricalCoordinateTransform Worklet;
};
template <typename S>
class FilterTraits<CylindricalCoordinateTransform<S>>
template <>
class FilterTraits<CylindricalCoordinateTransform>
{
public:
//Point Elevation can only convert Float and Double Vec3 arrays
......
......@@ -27,17 +27,15 @@ namespace filter
{
//-----------------------------------------------------------------------------
template <typename S>
inline VTKM_CONT CylindricalCoordinateTransform<S>::CylindricalCoordinateTransform()
inline VTKM_CONT CylindricalCoordinateTransform::CylindricalCoordinateTransform()
: Worklet()
{
this->SetOutputFieldName("cylindricalCoordinateSystemTransform");
}
//-----------------------------------------------------------------------------
template <typename S>
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
inline VTKM_CONT vtkm::cont::DataSet CylindricalCoordinateTransform<S>::DoExecute(
inline VTKM_CONT vtkm::cont::DataSet CylindricalCoordinateTransform::DoExecute(
const vtkm::cont::DataSet& inDataSet,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMetadata,
......@@ -45,9 +43,7 @@ inline VTKM_CONT vtkm::cont::DataSet CylindricalCoordinateTransform<S>::DoExecut
const DeviceAdapter& device)
{
vtkm::cont::ArrayHandle<T> outArray;
vtkm::cont::ArrayHandle<T> inArray;
Worklet.Run(inDataSet.GetCoordinateSystem().GetData(), outArray, device);
Worklet.Run(field, outArray, device);
/*
vtkm::worklet::DispatcherMapField<vtkm::worklet::CylindricalCoordinateTransform<T>, DeviceAdapter> dispatcher(
......@@ -82,7 +78,7 @@ inline VTKM_CONT vtkm::cont::DataSet SphericalCoordinateTransform<T>::DoExecute(
const DeviceAdapter&)
{
vtkm::cont::ArrayHandle<T> outArray;
vtkm::worklet::DispatcherMapField<vtkm::worklet::CylindricalCoordinateTransform<T>, DeviceAdapter>
vtkm::worklet::DispatcherMapField<vtkm::worklet::SphericalCoordinateTransform<T>, DeviceAdapter>
dispatcher(this->Worklet);
dispatcher.Invoke(field, outArray);
......
......@@ -108,7 +108,7 @@ vtkm::cont::DataSet MakeTestDataSet(const CoordinateType& cType)
return dataSet;
}
#if 0
#if 0
void ValidatePointTransform(const vtkm::cont::CoordinateSystem& coords,
const std::string fieldName,
const vtkm::cont::DataSet& result,
......@@ -189,7 +189,7 @@ void TestCoordinateSystemTransform()
//Test cartesian to cyl
vtkm::cont::DataSet dsCart = MakeTestDataSet(CART);
vtkm::filter::CylindricalCoordinateTransform<vtkm::FloatDefault> cylTrn;
vtkm::filter::CylindricalCoordinateTransform cylTrn;
cylTrn.SetOutputFieldName("cylindricalCoords");
cylTrn.SetUseCoordinateSystemAsField(true);
......
......@@ -123,7 +123,6 @@ struct CarToSphere : public vtkm::worklet::WorkletMapField
};
};
template <typename T>
class CylindricalCoordinateTransform
{
public:
......@@ -136,9 +135,9 @@ public:
VTKM_CONT void SetCartesianToCylindrical() { cartesianToCylindrical = true; }
VTKM_CONT void SetCylindricalToCartesian() { cartesianToCylindrical = false; }
template <typename CoordsStorageType, typename DeviceAdapterTag>
void Run(const vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, CoordsStorageType>& inPoints,
vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, CoordsStorageType>& outPoints,
template <typename T, typename InStorageType, typename OutStorageType, typename DeviceAdapterTag>
void Run(const vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, InStorageType>& inPoints,
vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, OutStorageType>& outPoints,
DeviceAdapterTag) const
{
if (cartesianToCylindrical)
......@@ -153,7 +152,7 @@ public:
}
}
template <typename CoordsStorageType, typename DeviceAdapterTag>
template <typename T, typename CoordsStorageType, typename DeviceAdapterTag>
void Run(const vtkm::cont::CoordinateSystem& inPoints,
vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, CoordsStorageType>& outPoints,
DeviceAdapterTag) const
......
......@@ -153,7 +153,7 @@ void TestCoordinateSystemTransform()
//Test cartesian to cyl
vtkm::cont::DataSet dsCart = MakeTestDataSet(CART);
vtkm::worklet::CylindricalCoordinateTransform<vtkm::FloatDefault> cylTrn;
vtkm::worklet::CylindricalCoordinateTransform cylTrn;
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>> carToCylPts;
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>> revResult;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment