Go to the documentation of this file.
19 #ifndef viskores_Range_h
20 #define viskores_Range_h
58 template <
typename T1,
typename T2>
103 return (this->Max - this->Min);
121 return 0.5 * (this->Max + this->
Min);
125 return viskores::Nan64();
135 template <
typename T>
152 this->Min = viskores::Min(this->Min, range.
Min);
153 this->Max = viskores::Max(this->Max, range.
Max);
165 unionRange.
Include(otherRange);
175 viskores::Min(this->Max, otherRange.
Max));
183 return this->
Union(otherRange);
189 return ((this->Min == otherRange.
Min) && (this->Max == otherRange.
Max));
195 return ((this->Min != otherRange.
Min) || (this->Max != otherRange.
Max));
203 return stream <<
"[" << range.
Min <<
".." << range.
Max <<
"]";
215 return NUM_COMPONENTS;
225 return (component == 0) ? range.
Min : range.
Max;
231 return (component == 0) ? range.
Min : range.
Max;
250 template <
typename NewComponentType>
252 template <
typename NewComponentType>
255 template <viskores::IdComponent destSize>
260 (destSize < NUM_COMPONENTS) ? destSize : NUM_COMPONENTS;
263 dest[component] = GetComponent(src, component);
271 #endif //viskores_Range_h
viskores::Range Intersection(const viskores::Range &otherRange) const
Return the intersection of this and another range.
Definition: Range.h:172
viskores::Float64 Length() const
Returns the length of the range.
Definition: Range.h:99
viskores::Float64 Center() const
Returns the center of the range.
Definition: Range.h:117
viskores::Float64 Min
The minumum value of the range (inclusive).
Definition: Range.h:42
viskores::Range Union(const viskores::Range &otherRange) const
Return the union of this and another range.
Definition: Range.h:162
static void CopyInto(const viskores::Range &src, viskores::Vec< ComponentType, destSize > &dest)
Definition: Range.h:256
Range()
Construct a range with a given minimum and maximum.
Definition: Range.h:49
A tag for vectors that are "true" vectors (i.e.
Definition: VecTraits.h:31
bool IsNonEmpty() const
Determine if the range is valid (i.e.
Definition: Range.h:78
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
Range(const T1 &min, const T2 &max)
Definition: Range.h:59
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
viskores::Float64 Max
Tha maximum value of the range (inclusive).
Definition: Range.h:44
bool operator!=(const viskores::Range &otherRange) const
Definition: Range.h:193
#define VISKORES_CONT
Definition: ExportMacros.h:65
std::ostream & operator<<(std::ostream &stream, const viskores::Bounds &bounds)
Helper function for printing bounds during testing.
Definition: Bounds.h:268
Groups connected points that have the same field value.
Definition: Atomic.h:27
Traits that can be queried to treat any type as a Vec.
Definition: VecTraits.h:69
static void SetComponent(viskores::Range &range, viskores::IdComponent component, ComponentType value)
Definition: Range.h:235
#define VISKORES_ASSERT(condition)
Definition: Assert.h:51
void Include(const viskores::Range &range)
Expand range to include other range.
Definition: Range.h:148
viskores::Range & operator=(const viskores::Range &src)=default
Represent a continuous scalar range of values.
Definition: Range.h:39
viskores::Float64 BaseComponentType
Definition: Range.h:210
viskores::Range operator+(const viskores::Range &otherRange) const
Operator for union
Definition: Range.h:181
viskores::Float64 ComponentType
Definition: Range.h:209
void Include(const T &value)
Expand range to include a value.
Definition: Range.h:136
static constexpr viskores::IdComponent GetNumberOfComponents(const viskores::Range &)
Definition: Range.h:213
bool Contains(const T &value) const
Determines if a value is within the range.
Definition: Range.h:87
static const ComponentType & GetComponent(const viskores::Range &range, viskores::IdComponent component)
Definition: Range.h:221
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:169
A short fixed-length array.
Definition: Types.h:365
static ComponentType & GetComponent(viskores::Range &range, viskores::IdComponent component)
Definition: Range.h:228
bool operator==(const viskores::Range &otherRange) const
Definition: Range.h:187