Viskores  1.0
Wavelet.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 
19 #ifndef viskores_source_Wavelet_h
20 #define viskores_source_Wavelet_h
21 
22 #include <viskores/source/Source.h>
23 
24 #include <viskores/Math.h>
25 
26 namespace viskores
27 {
28 namespace source
29 {
69 class VISKORES_SOURCE_EXPORT Wavelet final : public viskores::source::Source
70 {
71 public:
72  VISKORES_CONT Wavelet() = default;
73  VISKORES_CONT ~Wavelet() = default;
74 
75  VISKORES_DEPRECATED(2.0, "Use SetExtent.")
76  VISKORES_CONT Wavelet(viskores::Id3 minExtent, viskores::Id3 maxExtent = { 10 });
77 
84  VISKORES_CONT void SetCenter(const viskores::Vec3f& center) { this->Center = center; }
85  VISKORES_CONT viskores::Vec3f GetCenter() const { return this->Center; }
87 
93  VISKORES_CONT void SetOrigin(const viskores::Vec3f& origin) { this->Origin = origin; }
95  {
96  if (!viskores::IsNan(this->Origin[0]))
97  {
98  return this->Origin;
99  }
100  else
101  {
102  return this->MinimumExtent * this->Spacing;
103  }
104  }
105 
106  VISKORES_CONT void SetSpacing(const viskores::Vec3f& spacing) { this->Spacing = spacing; }
107  VISKORES_CONT viskores::Vec3f GetSpacing() const { return this->Spacing; }
108 
109  VISKORES_CONT void SetFrequency(const viskores::Vec3f& frequency) { this->Frequency = frequency; }
110  VISKORES_CONT viskores::Vec3f GetFrequency() const { return this->Frequency; }
111 
112  VISKORES_CONT void SetMagnitude(const viskores::Vec3f& magnitude) { this->Magnitude = magnitude; }
114 
116  {
117  this->MinimumExtent = minExtent;
118  }
119  VISKORES_CONT viskores::Id3 GetMinimumExtent() const { return this->MinimumExtent; }
120 
122  {
123  this->MaximumExtent = maxExtent;
124  }
125  VISKORES_CONT viskores::Id3 GetMaximumExtent() const { return this->MaximumExtent; }
126 
127  VISKORES_CONT void SetExtent(const viskores::Id3& minExtent, const viskores::Id3& maxExtent)
128  {
129  this->MinimumExtent = minExtent;
130  this->MaximumExtent = maxExtent;
131  }
132 
134  {
135  this->MaximumValue = maxVal;
136  }
137  VISKORES_CONT viskores::FloatDefault GetMaximumValue() const { return this->MaximumValue; }
138 
140  {
141  this->StandardDeviation = stdev;
142  }
144  {
145  return this->StandardDeviation;
146  }
147 
148 private:
149  viskores::cont::DataSet DoExecute() const override;
150 
151  template <viskores::IdComponent Dim>
152  viskores::cont::Field GeneratePointField(const viskores::cont::CellSetStructured<Dim>& cellset,
153  const std::string& name) const;
154 
155  template <viskores::IdComponent Dim>
156  viskores::cont::DataSet GenerateDataSet(viskores::cont::CoordinateSystem coords) const;
157 
158  viskores::Vec3f Center = { 0, 0, 0 };
159  viskores::Vec3f Origin = { viskores::Nan<viskores::FloatDefault>() };
160  viskores::Vec3f Spacing = { 1, 1, 1 };
161  viskores::Vec3f Frequency = { 60.0f, 30.0f, 40.0f };
162  viskores::Vec3f Magnitude = { 10.0f, 18.0f, 5.0f };
163  viskores::Id3 MinimumExtent = { -10, -10, -10 };
164  viskores::Id3 MaximumExtent = { 10, 10, 10 };
165  viskores::FloatDefault MaximumValue = 255.0f;
166  viskores::FloatDefault StandardDeviation = 0.5f;
167 };
168 } //namespace source
169 } //namespace viskores
170 
171 #endif //viskores_source_Wavelet_h
viskores::source::Wavelet::GetStandardDeviation
viskores::FloatDefault GetStandardDeviation() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:143
viskores::source::Wavelet::GetOrigin
viskores::Vec3f GetOrigin() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:94
viskores::cont::DataSet
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::source::Wavelet::GetSpacing
viskores::Vec3f GetSpacing() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:107
viskores::source::Wavelet::SetSpacing
void SetSpacing(const viskores::Vec3f &spacing)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:106
viskores::source::Wavelet::GetMagnitude
viskores::Vec3f GetMagnitude() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:113
viskores::source::Wavelet::GetMaximumValue
viskores::FloatDefault GetMaximumValue() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:137
viskores::source::Wavelet
The Wavelet source creates a dataset similar to VTK's vtkRTAnalyticSource.
Definition: Wavelet.h:69
viskores::source::Wavelet::SetMaximumValue
void SetMaximumValue(const viskores::FloatDefault &maxVal)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:133
viskores::cont::CoordinateSystem
Manages a coordinate system for a DataSet.
Definition: CoordinateSystem.h:38
Source.h
viskores::source::Wavelet::SetExtent
void SetExtent(const viskores::Id3 &minExtent, const viskores::Id3 &maxExtent)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:127
viskores::source::Source
Definition: Source.h:31
viskores::source::Wavelet::GetCenter
viskores::Vec3f GetCenter() const
Specifies the center of the wavelet function.
Definition: Wavelet.h:85
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores::source::Wavelet::SetMaximumExtent
void SetMaximumExtent(const viskores::Id3 &maxExtent)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:121
viskores::source::Wavelet::GetMinimumExtent
viskores::Id3 GetMinimumExtent() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:119
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
Math.h
viskores::source::Wavelet::GetMaximumExtent
viskores::Id3 GetMaximumExtent() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:125
VISKORES_DEPRECATED
#define VISKORES_DEPRECATED(...)
Definition: Deprecated.h:156
viskores::source::Wavelet::SetFrequency
void SetFrequency(const viskores::Vec3f &frequency)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:109
viskores::source::Wavelet::SetOrigin
void SetOrigin(const viskores::Vec3f &origin)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:93
viskores::cont::CellSetStructured
Defines a 1-, 2-, or 3-dimensional structured grid of points.
Definition: CastAndCall.h:40
viskores::source::Wavelet::GetFrequency
viskores::Vec3f GetFrequency() const
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:110
viskores::source::Wavelet::SetStandardDeviation
void SetStandardDeviation(const viskores::FloatDefault &stdev)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:139
viskores::FloatDefault
viskores::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:244
viskores::Magnitude
detail::FloatingPointReturnType< T >::Type Magnitude(const T &x)
Returns the magnitude of a vector.
Definition: VectorAnalysis.h:108
viskores::source::Wavelet::SetMagnitude
void SetMagnitude(const viskores::Vec3f &magnitude)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:112
viskores::source::Wavelet::SetCenter
void SetCenter(const viskores::Vec3f &center)
Specifies the center of the wavelet function.
Definition: Wavelet.h:84
viskores::cont::Field
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: Field.h:39
viskores::Vec< viskores::Id, 3 >
viskores::source::Wavelet::SetMinimumExtent
void SetMinimumExtent(const viskores::Id3 &minExtent)
Specifies the origin (lower left corner) of the dataset created.
Definition: Wavelet.h:115