VTK-m  2.3
Warp.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 
11 #ifndef vtk_m_filter_field_transform_Warp_h
12 #define vtk_m_filter_field_transform_Warp_h
13 
14 #include <vtkm/filter/Filter.h>
16 
17 namespace vtkm
18 {
19 namespace filter
20 {
21 namespace field_transform
22 {
23 
54 {
55 public:
56  VTKM_CONT Warp();
57 
61  VTKM_CONT void SetDirectionField(const std::string& name)
62  {
63  this->UseConstantDirection = false;
64  this->SetActiveField(1, name, vtkm::cont::Field::Association::Points);
65  }
67  VTKM_CONT std::string GetDirectionFieldName() const { return this->GetActiveFieldName(1); }
68 
74  {
75  this->UseConstantDirection = true;
76  this->ConstantDirection = direction;
77  }
79  VTKM_CONT const vtkm::Vec3f& GetConstantDirection() const { return this->ConstantDirection; }
80 
85  VTKM_CONT void SetUseConstantDirection(bool flag) { this->UseConstantDirection = flag; }
87  VTKM_CONT bool GetUseConstantDirection() const { return this->UseConstantDirection; }
88 
93  VTKM_CONT void SetScaleField(const std::string& name)
94  {
95  this->UseScaleField = true;
96  this->SetActiveField(2, name, vtkm::cont::Field::Association::Points);
97  }
99  VTKM_CONT std::string GetScaleFieldName() const { return this->GetActiveFieldName(2); }
100 
105  VTKM_CONT void SetUseScaleField(bool flag) { this->UseScaleField = flag; }
107  VTKM_CONT bool GetUseScaleField() const { return this->UseScaleField; }
108 
114  VTKM_CONT void SetScaleFactor(vtkm::FloatDefault scale) { this->ScaleFactor = scale; }
116  VTKM_CONT vtkm::FloatDefault GetScaleFactor() const { return this->ScaleFactor; }
117 
122  void SetChangeCoordinateSystem(bool flag) { this->ChangeCoordinateSystem = flag; }
124  bool GetChangeCoordinateSystem() const { return this->ChangeCoordinateSystem; }
125 
126 protected:
127  VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
128 
129 private:
130  vtkm::Vec3f ConstantDirection = { 0, 0, 1 };
131  vtkm::FloatDefault ScaleFactor = 1;
132  bool UseConstantDirection = true;
133  bool UseScaleField = false;
134  bool ChangeCoordinateSystem = true;
135 };
136 
137 } // namespace field_transform
138 } // namespace filter
139 } // namespace vtkm
140 
141 #endif // vtk_m_filter_field_transform_Warp_h
vtkm::filter::field_transform::Warp::GetScaleFieldName
std::string GetScaleFieldName() const
Specify a field to use to scale the directions.
Definition: Warp.h:99
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::filter::field_transform::Warp::GetConstantDirection
const vtkm::Vec3f & GetConstantDirection() const
Specify a constant value to use as the directions.
Definition: Warp.h:79
vtkm::filter::field_transform::Warp::SetUseConstantDirection
void SetUseConstantDirection(bool flag)
Specifies whether a direction field or a constant direction direction is used.
Definition: Warp.h:85
vtkm::cont::DataSet
Contains and manages the geometric data structures that VTK-m operates on.
Definition: DataSet.h:57
vtkm::filter::field_transform::Warp::GetUseScaleField
bool GetUseScaleField() const
Specifies whether a scale factor field is used.
Definition: Warp.h:107
vtkm::filter::field_transform::Warp
Modify points by moving points along scaled direction vectors.
Definition: Warp.h:53
vtkm_filter_field_transform_export.h
vtkm::filter::field_transform::Warp::SetConstantDirection
void SetConstantDirection(const vtkm::Vec3f &direction)
Specify a constant value to use as the directions.
Definition: Warp.h:73
vtkm::filter::field_transform::Warp::GetDirectionFieldName
std::string GetDirectionFieldName() const
Specify a field to use as the directions.
Definition: Warp.h:67
vtkm::filter::field_transform::Warp::GetUseConstantDirection
bool GetUseConstantDirection() const
Specifies whether a direction field or a constant direction direction is used.
Definition: Warp.h:87
vtkm::filter::field_transform::Warp::SetScaleFactor
void SetScaleFactor(vtkm::FloatDefault scale)
Specifies an additional scale factor to scale the displacements.
Definition: Warp.h:114
vtkm::filter::field_transform::Warp::GetScaleFactor
vtkm::FloatDefault GetScaleFactor() const
Specifies an additional scale factor to scale the displacements.
Definition: Warp.h:116
vtkm::filter::field_transform::Warp::SetScaleField
void SetScaleField(const std::string &name)
Specify a field to use to scale the directions.
Definition: Warp.h:93
vtkm::filter::Filter
Base class for all filters.
Definition: Filter.h:163
vtkm::cont::Field::Association::Points
@ Points
A field that applies to points.
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Vec< vtkm::FloatDefault, 3 >
vtkm::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:236
vtkm::filter::field_transform::Warp::SetDirectionField
void SetDirectionField(const std::string &name)
Specify a field to use as the directions.
Definition: Warp.h:61
vtkm::filter::field_transform::Warp::SetUseScaleField
void SetUseScaleField(bool flag)
Specifies whether a scale factor field is used.
Definition: Warp.h:105
vtkm::filter::field_transform::Warp::GetChangeCoordinateSystem
bool GetChangeCoordinateSystem() const
Specify whether the result should become the coordinate system of the output.
Definition: Warp.h:124
vtkm::filter::field_transform::Warp::SetChangeCoordinateSystem
void SetChangeCoordinateSystem(bool flag)
Specify whether the result should become the coordinate system of the output.
Definition: Warp.h:122
VTKM_FILTER_FIELD_TRANSFORM_EXPORT
#define VTKM_FILTER_FIELD_TRANSFORM_EXPORT
Definition: vtkm_filter_field_transform_export.h:44
Filter.h