VTK-m  2.1
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
vtkm::filter::field_transform::Warp Class Reference

Modify points by moving points along scaled direction vectors. More...

#include <Warp.h>

Inheritance diagram for vtkm::filter::field_transform::Warp:
vtkm::filter::Filter vtkm::filter::field_transform::WarpScalar vtkm::filter::field_transform::WarpVector

Public Member Functions

 Warp ()
 
void SetDirectionField (const std::string &name)
 Specify a field to use as the directions. More...
 
std::string GetDirectionFieldName () const
 Specify a field to use as the directions. More...
 
void SetConstantDirection (const vtkm::Vec3f &direction)
 Specify a constant value to use as the directions. More...
 
const vtkm::Vec3fGetConstantDirection () const
 Specify a constant value to use as the directions. More...
 
void SetUseConstantDirection (bool flag)
 Specifies whether a direction field or a constant direction direction is used. More...
 
bool GetUseConstantDirection () const
 Specifies whether a direction field or a constant direction direction is used. More...
 
void SetScaleField (const std::string &name)
 Specify a field to use to scale the directions. More...
 
std::string GetScaleFieldName () const
 Specify a field to use to scale the directions. More...
 
void SetUseScaleField (bool flag)
 Specifies whether a scale factor field is used. More...
 
bool GetUseScaleField () const
 Specifies whether a scale factor field is used. More...
 
void SetScaleFactor (vtkm::FloatDefault scale)
 Specifies an additional scale factor to scale the displacements. More...
 
vtkm::FloatDefault GetScaleFactor () const
 Specifies an additional scale factor to scale the displacements. More...
 
void SetChangeCoordinateSystem (bool flag)
 Specify whether the result should become the coordinate system of the output. More...
 
bool GetChangeCoordinateSystem () const
 Specify whether the result should become the coordinate system of the output. More...
 
- Public Member Functions inherited from vtkm::filter::Filter
 Filter ()
 
virtual ~Filter ()
 
vtkm::cont::DataSet Execute (const vtkm::cont::DataSet &input)
 Executes the filter on the input and produces a result dataset. More...
 
vtkm::cont::PartitionedDataSet Execute (const vtkm::cont::PartitionedDataSet &input)
 Executes the filter on the input PartitionedDataSet and produces a result PartitionedDataSet. More...
 
void SetFieldsToPass (const vtkm::filter::FieldSelection &fieldsToPass)
 Specify which fields get passed from input to output. More...
 
void SetFieldsToPass (vtkm::filter::FieldSelection &&fieldsToPass)
 Specify which fields get passed from input to output. More...
 
void SetFieldsToPass (const vtkm::filter::FieldSelection &fieldsToPass, vtkm::filter::FieldSelection::Mode mode)
 
void SetFieldsToPass (std::initializer_list< std::string > fields, vtkm::filter::FieldSelection::Mode mode=vtkm::filter::FieldSelection::Mode::Select)
 Specify which fields get passed from input to output. More...
 
void SetFieldsToPass (std::initializer_list< std::pair< std::string, vtkm::cont::Field::Association >> fields, vtkm::filter::FieldSelection::Mode mode=vtkm::filter::FieldSelection::Mode::Select)
 Specify which fields get passed from input to output. More...
 
void SetFieldsToPass (const std::string &fieldname, vtkm::cont::Field::Association association, vtkm::filter::FieldSelection::Mode mode=vtkm::filter::FieldSelection::Mode::Select)
 Specify which fields get passed from input to output. More...
 
void SetFieldsToPass (const std::string &fieldname, vtkm::filter::FieldSelection::Mode mode)
 Specify which fields get passed from input to output. More...
 
const vtkm::filter::FieldSelectionGetFieldsToPass () const
 Specify which fields get passed from input to output. More...
 
vtkm::filter::FieldSelectionGetFieldsToPass ()
 Specify which fields get passed from input to output. More...
 
void SetPassCoordinateSystems (bool flag)
 Specify whether to always pass coordinate systems. More...
 
bool GetPassCoordinateSystems () const
 Specify whether to always pass coordinate systems. More...
 
void SetOutputFieldName (const std::string &name)
 Specifies the name of the output field generated. More...
 
const std::string & GetOutputFieldName () const
 Specifies the name of the output field generated. More...
 
void SetActiveField (const std::string &name, vtkm::cont::Field::Association association=vtkm::cont::Field::Association::Any)
 Specifies a field to operate on. More...
 
void SetActiveField (vtkm::IdComponent index, const std::string &name, vtkm::cont::Field::Association association=vtkm::cont::Field::Association::Any)
 Specifies a field to operate on. More...
 
const std::string & GetActiveFieldName (vtkm::IdComponent index=0) const
 Specifies a field to operate on. More...
 
vtkm::cont::Field::Association GetActiveFieldAssociation (vtkm::IdComponent index=0) const
 Specifies a field to operate on. More...
 
void SetActiveCoordinateSystem (vtkm::Id coord_idx)
 Specifies the coordinate system index to make active to use when processing the input vtkm::cont::DataSet. More...
 
void SetActiveCoordinateSystem (vtkm::IdComponent index, vtkm::Id coord_idx)
 Specifies the coordinate system index to make active to use when processing the input vtkm::cont::DataSet. More...
 
vtkm::Id GetActiveCoordinateSystemIndex (vtkm::IdComponent index=0) const
 Specifies the coordinate system index to make active to use when processing the input vtkm::cont::DataSet. More...
 
void SetUseCoordinateSystemAsField (bool val)
 Specifies whether to use point coordinates as the input field. More...
 
void SetUseCoordinateSystemAsField (vtkm::IdComponent index, bool val)
 Specifies whether to use point coordinates as the input field. More...
 
bool GetUseCoordinateSystemAsField (vtkm::IdComponent index=0) const
 Specifies whether to use point coordinates as the input field. More...
 
vtkm::IdComponent GetNumberOfActiveFields () const
 Return the number of active fields currently set. More...
 
virtual bool CanThread () const
 Returns whether the filter can execute on partitions in concurrent threads. More...
 
void SetThreadsPerCPU (vtkm::Id numThreads)
 
void SetThreadsPerGPU (vtkm::Id numThreads)
 
vtkm::Id GetThreadsPerCPU () const
 
vtkm::Id GetThreadsPerGPU () const
 
bool GetRunMultiThreadedFilter () const
 
void SetRunMultiThreadedFilter (bool val)
 
void SetInvoker (vtkm::cont::Invoker inv)
 Specify the vtkm::cont::Invoker to be used to execute worklets by this filter instance. More...
 

Protected Member Functions

vtkm::cont::DataSet DoExecute (const vtkm::cont::DataSet &input) override
 
- Protected Member Functions inherited from vtkm::filter::Filter
vtkm::cont::DataSet CreateResult (const vtkm::cont::DataSet &inDataSet) const
 Create the output data set for DoExecute. More...
 
vtkm::cont::DataSet CreateResultField (const vtkm::cont::DataSet &inDataSet, const vtkm::cont::Field &resultField) const
 Create the output data set for DoExecute More...
 
vtkm::cont::DataSet CreateResultField (const vtkm::cont::DataSet &inDataSet, const std::string &resultFieldName, vtkm::cont::Field::Association resultFieldAssociation, const vtkm::cont::UnknownArrayHandle &resultFieldArray) const
 Create the output data set for DoExecute More...
 
vtkm::cont::DataSet CreateResultFieldPoint (const vtkm::cont::DataSet &inDataSet, const std::string &resultFieldName, const vtkm::cont::UnknownArrayHandle &resultFieldArray) const
 Create the output data set for DoExecute More...
 
vtkm::cont::DataSet CreateResultFieldCell (const vtkm::cont::DataSet &inDataSet, const std::string &resultFieldName, const vtkm::cont::UnknownArrayHandle &resultFieldArray) const
 Create the output data set for DoExecute More...
 
vtkm::cont::PartitionedDataSet CreateResult (const vtkm::cont::PartitionedDataSet &input, const vtkm::cont::PartitionedDataSet &resultPartitions) const
 Create the output data set for DoExecute. More...
 
template<typename FieldMapper >
vtkm::cont::PartitionedDataSet CreateResult (const vtkm::cont::PartitionedDataSet &input, const vtkm::cont::PartitionedDataSet &resultPartitions, FieldMapper &&fieldMapper) const
 Create the output data set for DoExecute. More...
 
template<typename FieldMapper >
vtkm::cont::DataSet CreateResult (const vtkm::cont::DataSet &inDataSet, const vtkm::cont::UnknownCellSet &resultCellSet, FieldMapper &&fieldMapper) const
 Create the output data set for DoExecute. More...
 
template<typename FieldMapper >
vtkm::cont::DataSet CreateResultCoordinateSystem (const vtkm::cont::DataSet &inDataSet, const vtkm::cont::UnknownCellSet &resultCellSet, const vtkm::cont::CoordinateSystem &resultCoordSystem, FieldMapper &&fieldMapper) const
 Create the output data set for DoExecute. More...
 
template<typename FieldMapper >
vtkm::cont::DataSet CreateResultCoordinateSystem (const vtkm::cont::DataSet &inDataSet, const vtkm::cont::UnknownCellSet &resultCellSet, const std::string &coordsName, const vtkm::cont::UnknownArrayHandle &coordsData, FieldMapper &&fieldMapper) const
 Create the output data set for DoExecute. More...
 
const vtkm::cont::FieldGetFieldFromDataSet (const vtkm::cont::DataSet &input) const
 Retrieve an input field from a vtkm::cont::DataSet object. More...
 
const vtkm::cont::FieldGetFieldFromDataSet (vtkm::IdComponent index, const vtkm::cont::DataSet &input) const
 Retrieve an input field from a vtkm::cont::DataSet object. More...
 
virtual vtkm::cont::PartitionedDataSet DoExecutePartitions (const vtkm::cont::PartitionedDataSet &inData)
 
template<typename Functor , typename... Args>
void CastAndCallScalarField (const vtkm::cont::UnknownArrayHandle &fieldArray, Functor &&functor, Args &&... args) const
 Convenience method to get the array from a filter's input scalar field. More...
 
template<typename Functor , typename... Args>
void CastAndCallScalarField (const vtkm::cont::Field &field, Functor &&functor, Args &&... args) const
 Convenience method to get the array from a filter's input scalar field. More...
 
template<vtkm::IdComponent VecSize, typename Functor , typename... Args>
void CastAndCallVecField (const vtkm::cont::UnknownArrayHandle &fieldArray, Functor &&functor, Args &&... args) const
 Convenience method to get the array from a filter's input vector field. More...
 
template<vtkm::IdComponent VecSize, typename Functor , typename... Args>
void CastAndCallVecField (const vtkm::cont::Field &field, Functor &&functor, Args &&... args) const
 Convenience method to get the array from a filter's input vector field. More...
 
template<typename Functor , typename... Args>
void CastAndCallVariableVecField (const vtkm::cont::UnknownArrayHandle &fieldArray, Functor &&functor, Args &&... args) const
 This method is like CastAndCallVecField except that it can be used for a field of unknown vector size (or scalars). More...
 
template<typename Functor , typename... Args>
void CastAndCallVariableVecField (const vtkm::cont::Field &field, Functor &&functor, Args &&... args) const
 This method is like CastAndCallVecField except that it can be used for a field of unknown vector size (or scalars). More...
 

Private Attributes

vtkm::Vec3f ConstantDirection = { 0, 0, 1 }
 
vtkm::FloatDefault ScaleFactor = 1
 
bool UseConstantDirection = true
 
bool UseScaleField = false
 
bool ChangeCoordinateSystem = true
 

Additional Inherited Members

- Protected Attributes inherited from vtkm::filter::Filter
vtkm::cont::Invoker Invoke
 

Detailed Description

Modify points by moving points along scaled direction vectors.

This filter displaces the point coordinates of a dataset either in the direction of a direction vector field or in a constant direction.

The filter starts with a set of point coordinates or other vectors. By default these vectors are the coordinate system, but they can be changed by modifying active field 0. These vectors are then displaced by a set of vectors. This is done by selecting a field of directions, a field of scales, and an additional scale factor. The directions are multiplied by the scale field and the scale factor, and this displacement is added to the vector.

It is common to wish to warp in a constant direction by a scaled amount. To support this so called "WarpScalar", the Warp filter allows you to specify a constant direction direction with the SetConstantDirection() method. When this is set, no direction field is retrieved. By default Warp uses (0, 0, 1) as the direction direction.

It is also common to wish to simply apply a vector direction field (with a possible constant scale). To support this so called "WarpVector", the Warp filter allows you to ignore the scale field with the SetUseScaleField() method. When this is unset, no scale field is retrieved. Calling SetScaleField() turns on the UseScaleField flag. By default, Warp uses will not use the scale field unless specified.

The main use case for Warp is to adjust the spatial location and shape of objects in 3D space. This filter will operate on the vtkm::cont::CoordinateSystem of the input data unless a different active field is specified. Likewise, this filter will save its results as the first coordinate system in the output unless SetChangeCoordinateSystem() is set to say otherwise.

Constructor & Destructor Documentation

◆ Warp()

vtkm::filter::field_transform::Warp::Warp ( )

Member Function Documentation

◆ DoExecute()

vtkm::cont::DataSet vtkm::filter::field_transform::Warp::DoExecute ( const vtkm::cont::DataSet input)
overrideprotectedvirtual

Implements vtkm::filter::Filter.

◆ GetChangeCoordinateSystem()

bool vtkm::filter::field_transform::Warp::GetChangeCoordinateSystem ( ) const
inline

Specify whether the result should become the coordinate system of the output.

When this flag is on (the default) the first coordinate system in the output vtkm::cont::DataSet is set to the transformed point coordinates.

◆ GetConstantDirection()

const vtkm::Vec3f& vtkm::filter::field_transform::Warp::GetConstantDirection ( ) const
inline

Specify a constant value to use as the directions.

This will provide a (constant) direction of the direction, and the direction field will be ignored.

◆ GetDirectionFieldName()

std::string vtkm::filter::field_transform::Warp::GetDirectionFieldName ( ) const
inline

Specify a field to use as the directions.

The directions, when not set to use constant directions, are set as active field index 1.

◆ GetScaleFactor()

vtkm::FloatDefault vtkm::filter::field_transform::Warp::GetScaleFactor ( ) const
inline

Specifies an additional scale factor to scale the displacements.

When using a non-constant scale field, it is possible that the scale field is of the wrong units and needs to be rescaled. This scale factor is multiplied to the direction and scale to re-adjust the overall scale.

◆ GetScaleFieldName()

std::string vtkm::filter::field_transform::Warp::GetScaleFieldName ( ) const
inline

Specify a field to use to scale the directions.

The scale factor field scales the size of the direction. The scale factor, when not set to use a constant factor, is set as active field index 2.

◆ GetUseConstantDirection()

bool vtkm::filter::field_transform::Warp::GetUseConstantDirection ( ) const
inline

Specifies whether a direction field or a constant direction direction is used.

When true, the constant direction direction is used. When false, the direction field (active field index 1) is used.

◆ GetUseScaleField()

bool vtkm::filter::field_transform::Warp::GetUseScaleField ( ) const
inline

Specifies whether a scale factor field is used.

When true, a scale factor field the constant scale factor is used. When false, the scale factor field (active field index 2) is used.

◆ SetChangeCoordinateSystem()

void vtkm::filter::field_transform::Warp::SetChangeCoordinateSystem ( bool  flag)
inline

Specify whether the result should become the coordinate system of the output.

When this flag is on (the default) the first coordinate system in the output vtkm::cont::DataSet is set to the transformed point coordinates.

◆ SetConstantDirection()

void vtkm::filter::field_transform::Warp::SetConstantDirection ( const vtkm::Vec3f direction)
inline

Specify a constant value to use as the directions.

This will provide a (constant) direction of the direction, and the direction field will be ignored.

◆ SetDirectionField()

void vtkm::filter::field_transform::Warp::SetDirectionField ( const std::string &  name)
inline

Specify a field to use as the directions.

The directions, when not set to use constant directions, are set as active field index 1.

◆ SetScaleFactor()

void vtkm::filter::field_transform::Warp::SetScaleFactor ( vtkm::FloatDefault  scale)
inline

Specifies an additional scale factor to scale the displacements.

When using a non-constant scale field, it is possible that the scale field is of the wrong units and needs to be rescaled. This scale factor is multiplied to the direction and scale to re-adjust the overall scale.

◆ SetScaleField()

void vtkm::filter::field_transform::Warp::SetScaleField ( const std::string &  name)
inline

Specify a field to use to scale the directions.

The scale factor field scales the size of the direction. The scale factor, when not set to use a constant factor, is set as active field index 2.

◆ SetUseConstantDirection()

void vtkm::filter::field_transform::Warp::SetUseConstantDirection ( bool  flag)
inline

Specifies whether a direction field or a constant direction direction is used.

When true, the constant direction direction is used. When false, the direction field (active field index 1) is used.

◆ SetUseScaleField()

void vtkm::filter::field_transform::Warp::SetUseScaleField ( bool  flag)
inline

Specifies whether a scale factor field is used.

When true, a scale factor field the constant scale factor is used. When false, the scale factor field (active field index 2) is used.

Member Data Documentation

◆ ChangeCoordinateSystem

bool vtkm::filter::field_transform::Warp::ChangeCoordinateSystem = true
private

◆ ConstantDirection

vtkm::Vec3f vtkm::filter::field_transform::Warp::ConstantDirection = { 0, 0, 1 }
private

◆ ScaleFactor

vtkm::FloatDefault vtkm::filter::field_transform::Warp::ScaleFactor = 1
private

◆ UseConstantDirection

bool vtkm::filter::field_transform::Warp::UseConstantDirection = true
private

◆ UseScaleField

bool vtkm::filter::field_transform::Warp::UseScaleField = false
private

The documentation for this class was generated from the following file: