VTK-m  2.0
Wavelet.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_source_Wavelet_h
12 #define vtk_m_source_Wavelet_h
13 
14 #include <vtkm/source/Source.h>
15 
16 #include <vtkm/Math.h>
17 
18 namespace vtkm
19 {
20 namespace source
21 {
61 class VTKM_SOURCE_EXPORT Wavelet final : public vtkm::source::Source
62 {
63 public:
64  VTKM_CONT Wavelet() = default;
65  VTKM_CONT ~Wavelet() = default;
66 
67  VTKM_DEPRECATED(2.0, "Use SetExtent.")
68  VTKM_CONT Wavelet(vtkm::Id3 minExtent, vtkm::Id3 maxExtent = { 10 });
69 
76  VTKM_CONT void SetCenter(const vtkm::Vec3f& center) { this->Center = center; }
77  VTKM_CONT vtkm::Vec3f GetCenter() const { return this->Center; }
79 
85  VTKM_CONT void SetOrigin(const vtkm::Vec3f& origin) { this->Origin = origin; }
87  {
88  if (!vtkm::IsNan(this->Origin[0]))
89  {
90  return this->Origin;
91  }
92  else
93  {
94  return this->MinimumExtent * this->Spacing;
95  }
96  }
97 
98  VTKM_CONT void SetSpacing(const vtkm::Vec3f& spacing) { this->Spacing = spacing; }
99  VTKM_CONT vtkm::Vec3f GetSpacing() const { return this->Spacing; }
100 
101  VTKM_CONT void SetFrequency(const vtkm::Vec3f& frequency) { this->Frequency = frequency; }
102  VTKM_CONT vtkm::Vec3f GetFrequency() const { return this->Frequency; }
103 
104  VTKM_CONT void SetMagnitude(const vtkm::Vec3f& magnitude) { this->Magnitude = magnitude; }
105  VTKM_CONT vtkm::Vec3f GetMagnitude() const { return this->Magnitude; }
106 
107  VTKM_CONT void SetMinimumExtent(const vtkm::Id3& minExtent) { this->MinimumExtent = minExtent; }
108  VTKM_CONT vtkm::Id3 GetMinimumExtent() const { return this->MinimumExtent; }
109 
110  VTKM_CONT void SetMaximumExtent(const vtkm::Id3& maxExtent) { this->MaximumExtent = maxExtent; }
111  VTKM_CONT vtkm::Id3 GetMaximumExtent() const { return this->MaximumExtent; }
112 
113  VTKM_CONT void SetExtent(const vtkm::Id3& minExtent, const vtkm::Id3& maxExtent)
114  {
115  this->MinimumExtent = minExtent;
116  this->MaximumExtent = maxExtent;
117  }
118 
119  VTKM_CONT void SetMaximumValue(const vtkm::FloatDefault& maxVal) { this->MaximumValue = maxVal; }
120  VTKM_CONT vtkm::FloatDefault GetMaximumValue() const { return this->MaximumValue; }
121 
123  {
124  this->StandardDeviation = stdev;
125  }
126  VTKM_CONT vtkm::FloatDefault GetStandardDeviation() const { return this->StandardDeviation; }
127 
128 private:
129  vtkm::cont::DataSet DoExecute() const override;
130 
131  template <vtkm::IdComponent Dim>
132  vtkm::cont::Field GeneratePointField(const vtkm::cont::CellSetStructured<Dim>& cellset,
133  const std::string& name) const;
134 
135  template <vtkm::IdComponent Dim>
136  vtkm::cont::DataSet GenerateDataSet(vtkm::cont::CoordinateSystem coords) const;
137 
138  vtkm::Vec3f Center = { 0, 0, 0 };
139  vtkm::Vec3f Origin = { vtkm::Nan<vtkm::FloatDefault>() };
140  vtkm::Vec3f Spacing = { 1, 1, 1 };
141  vtkm::Vec3f Frequency = { 60.0f, 30.0f, 40.0f };
142  vtkm::Vec3f Magnitude = { 10.0f, 18.0f, 5.0f };
143  vtkm::Id3 MinimumExtent = { -10, -10, -10 };
144  vtkm::Id3 MaximumExtent = { 10, 10, 10 };
145  vtkm::FloatDefault MaximumValue = 255.0f;
146  vtkm::FloatDefault StandardDeviation = 0.5f;
147 };
148 } //namespace source
149 } //namespace vtkm
150 
151 #endif //vtk_m_source_Wavelet_h
vtkm::source::Wavelet::SetMaximumExtent
VTKM_CONT void SetMaximumExtent(const vtkm::Id3 &maxExtent)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:110
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::source::Wavelet::GetMaximumValue
VTKM_CONT vtkm::FloatDefault GetMaximumValue() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:120
vtkm::cont::CellSetStructured
Definition: CastAndCall.h:32
vtkm::source::Wavelet::GetMaximumExtent
VTKM_CONT vtkm::Id3 GetMaximumExtent() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:111
vtkm::Magnitude
VTKM_EXEC_CONT detail::FloatingPointReturnType< T >::Type Magnitude(const T &x)
Returns the magnitude of a vector.
Definition: VectorAnalysis.h:100
vtkm::source::Source
Definition: Source.h:23
vtkm::cont::DataSet
Definition: DataSet.h:34
vtkm::source::Wavelet::SetExtent
VTKM_CONT void SetExtent(const vtkm::Id3 &minExtent, const vtkm::Id3 &maxExtent)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:113
Source.h
vtkm::source::Wavelet::SetMinimumExtent
VTKM_CONT void SetMinimumExtent(const vtkm::Id3 &minExtent)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:107
vtkm::source::Wavelet::GetSpacing
VTKM_CONT vtkm::Vec3f GetSpacing() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:99
vtkm::source::Wavelet::SetMagnitude
VTKM_CONT void SetMagnitude(const vtkm::Vec3f &magnitude)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:104
vtkm::source::Wavelet::GetMinimumExtent
VTKM_CONT vtkm::Id3 GetMinimumExtent() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:108
vtkm::cont::CoordinateSystem
Definition: CoordinateSystem.h:25
vtkm::source::Wavelet::SetCenter
VTKM_CONT void SetCenter(const vtkm::Vec3f &center)
Specifies the center of the wavelet function.
Definition: Wavelet.h:76
vtkm::source::Wavelet::SetOrigin
VTKM_CONT void SetOrigin(const vtkm::Vec3f &origin)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:85
Math.h
vtkm::cont::Field
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: cont/Field.h:31
vtkm::source::Wavelet::GetCenter
VTKM_CONT vtkm::Vec3f GetCenter() const
Specifies the center of the wavelet function.
Definition: Wavelet.h:77
vtkm::source::Wavelet::GetMagnitude
VTKM_CONT vtkm::Vec3f GetMagnitude() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:105
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Vec< vtkm::Id, 3 >
vtkm::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:198
vtkm::source::Wavelet::SetSpacing
VTKM_CONT void SetSpacing(const vtkm::Vec3f &spacing)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:98
vtkm::source::Wavelet::SetFrequency
VTKM_CONT void SetFrequency(const vtkm::Vec3f &frequency)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:101
vtkm::source::Wavelet::SetMaximumValue
VTKM_CONT void SetMaximumValue(const vtkm::FloatDefault &maxVal)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:119
vtkm::source::Wavelet
The Wavelet source creates a dataset similar to VTK's vtkRTAnalyticSource.
Definition: Wavelet.h:61
vtkm::source::Wavelet::GetStandardDeviation
VTKM_CONT vtkm::FloatDefault GetStandardDeviation() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:126
vtkm::source::Wavelet::SetStandardDeviation
VTKM_CONT void SetStandardDeviation(const vtkm::FloatDefault &stdev)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:122
vtkm::source::Wavelet::GetOrigin
VTKM_CONT vtkm::Vec3f GetOrigin() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:86
VTKM_DEPRECATED
#define VTKM_DEPRECATED(...)
Definition: Deprecated.h:145
vtkm::source::Wavelet::GetFrequency
VTKM_CONT vtkm::Vec3f GetFrequency() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:102