2018-06-01 15:36:32 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2018-06-01 15:36:32 +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_WarpVector_h
|
|
|
|
#define vtk_m_filter_WarpVector_h
|
|
|
|
|
|
|
|
#include <vtkm/filter/FilterField.h>
|
|
|
|
#include <vtkm/worklet/WarpVector.h>
|
|
|
|
|
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace filter
|
|
|
|
{
|
2019-06-03 17:33:31 +00:00
|
|
|
/// \brief Modify points by moving points along a vector multiplied by
|
2018-06-01 15:36:32 +00:00
|
|
|
/// the scale factor
|
|
|
|
///
|
2018-06-20 15:51:51 +00:00
|
|
|
/// A filter that modifies point coordinates by moving points along a vector
|
2019-06-03 17:33:31 +00:00
|
|
|
/// multiplied by a scale factor. It's a VTK-m version of the vtkWarpVector in VTK.
|
2018-06-01 15:36:32 +00:00
|
|
|
/// Useful for showing flow profiles or mechanical deformation.
|
|
|
|
/// This worklet does not modify the input points but generate new point
|
|
|
|
/// coordinate instance that has been warped.
|
|
|
|
class WarpVector : public vtkm::filter::FilterField<WarpVector>
|
|
|
|
{
|
|
|
|
public:
|
2019-12-05 17:55:57 +00:00
|
|
|
using SupportedTypes = vtkm::TypeListFieldVec3;
|
2019-09-08 06:09:14 +00:00
|
|
|
using AdditionalFieldStorage =
|
2019-12-05 21:38:41 +00:00
|
|
|
vtkm::List<vtkm::cont::ArrayHandleConstant<vtkm::Vec3f_32>::StorageTag,
|
|
|
|
vtkm::cont::ArrayHandleConstant<vtkm::Vec3f_64>::StorageTag>;
|
2019-08-02 02:03:04 +00:00
|
|
|
|
2018-06-01 15:36:32 +00:00
|
|
|
VTKM_CONT
|
|
|
|
WarpVector(vtkm::FloatDefault scale);
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/// Choose the vector field to operate on. In the warp op A + B *scale, B is
|
|
|
|
/// the vector field
|
|
|
|
VTKM_CONT
|
|
|
|
void SetVectorField(
|
|
|
|
const std::string& name,
|
|
|
|
vtkm::cont::Field::Association association = vtkm::cont::Field::Association::ANY)
|
|
|
|
{
|
|
|
|
this->VectorFieldName = name;
|
|
|
|
this->VectorFieldAssociation = association;
|
|
|
|
}
|
|
|
|
|
|
|
|
VTKM_CONT const std::string& GetVectorFieldName() const { return this->VectorFieldName; }
|
|
|
|
|
|
|
|
VTKM_CONT vtkm::cont::Field::Association GetVectorFieldAssociation() const
|
|
|
|
{
|
|
|
|
return this->VectorFieldAssociation;
|
|
|
|
}
|
|
|
|
//@}
|
|
|
|
|
2018-08-30 15:53:18 +00:00
|
|
|
template <typename T, typename StorageType, typename DerivedPolicy>
|
2018-06-01 15:36:32 +00:00
|
|
|
VTKM_CONT vtkm::cont::DataSet DoExecute(
|
|
|
|
const vtkm::cont::DataSet& input,
|
|
|
|
const vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>& field,
|
|
|
|
const vtkm::filter::FieldMetadata& fieldMeta,
|
2018-08-30 15:53:18 +00:00
|
|
|
vtkm::filter::PolicyBase<DerivedPolicy> policy);
|
2018-06-01 15:36:32 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
vtkm::worklet::WarpVector Worklet;
|
|
|
|
std::string VectorFieldName;
|
|
|
|
vtkm::cont::Field::Association VectorFieldAssociation;
|
|
|
|
vtkm::FloatDefault Scale;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <vtkm/filter/WarpVector.hxx>
|
|
|
|
|
|
|
|
#endif // vtk_m_filter_WarpVector_h
|