VTK-m  2.1
Public Member Functions | Public Attributes | List of all members
vtkm::RangeId Struct Reference

Represent a range of vtkm::Id values. More...

#include <RangeId.h>

Public Member Functions

 RangeId ()
 Construct a range with no indices. More...
 
 RangeId (vtkm::Id min, vtkm::Id max)
 Construct a range with the given minimum (inclusive) and maximum (exclusive) indices. More...
 
bool IsNonEmpty () const
 Determine if the range is valid. More...
 
bool Contains (vtkm::Id value) const
 Determines if a value is within the range. More...
 
vtkm::Id Length () const
 Returns the length of the range. More...
 
vtkm::Id Center () const
 Returns the center of the range. More...
 
void Include (vtkm::Id value)
 Expand range to include a value. More...
 
void Include (const vtkm::RangeId &range)
 Expand range to include other range. More...
 
vtkm::RangeId Union (const vtkm::RangeId &other) const
 Return the union of this and another range. More...
 
vtkm::RangeId operator+ (const vtkm::RangeId &other) const
 Operator for union More...
 
bool operator== (const vtkm::RangeId &other) const
 
bool operator!= (const vtkm::RangeId &other) const
 

Public Attributes

vtkm::Id Min
 The minimum index of the range (inclusive). More...
 
vtkm::Id Max
 The maximum index of the range (exclusive). More...
 

Detailed Description

Represent a range of vtkm::Id values.

vtkm::RangeId is a helper class for representing a range of vtkm::Id values. This is specified simply with a Min and Max value, where Max is exclusive.

RangeId also contains several helper functions for computing and maintaining the range.

Constructor & Destructor Documentation

◆ RangeId() [1/2]

vtkm::RangeId::RangeId ( )
inline

Construct a range with no indices.

◆ RangeId() [2/2]

vtkm::RangeId::RangeId ( vtkm::Id  min,
vtkm::Id  max 
)
inline

Construct a range with the given minimum (inclusive) and maximum (exclusive) indices.

Member Function Documentation

◆ Center()

vtkm::Id vtkm::RangeId::Center ( ) const
inline

Returns the center of the range.

Center computes the middle value of the range.

◆ Contains()

bool vtkm::RangeId::Contains ( vtkm::Id  value) const
inline

Determines if a value is within the range.

Contains returns true if the give value is within the range, false otherwise.

◆ Include() [1/2]

void vtkm::RangeId::Include ( const vtkm::RangeId range)
inline

Expand range to include other range.

This version of Include expands this range just enough to include that of another range. Essentially it is the union of the two ranges.

◆ Include() [2/2]

void vtkm::RangeId::Include ( vtkm::Id  value)
inline

Expand range to include a value.

This version of Include expands the range just enough to include the given value. If the range already includes this value, then nothing is done.

◆ IsNonEmpty()

bool vtkm::RangeId::IsNonEmpty ( ) const
inline

Determine if the range is valid.

IsNonEmpty return true if the range contains some valid values between Min and Max. If Max <= Min, then no values satisfy the range and IsNonEmpty returns false. Otherwise, return true.

◆ Length()

vtkm::Id vtkm::RangeId::Length ( ) const
inline

Returns the length of the range.

Length computes the distance between the min and max. If the range is empty, 0 is returned.

◆ operator!=()

bool vtkm::RangeId::operator!= ( const vtkm::RangeId other) const
inline

◆ operator+()

vtkm::RangeId vtkm::RangeId::operator+ ( const vtkm::RangeId other) const
inline

Operator for union

◆ operator==()

bool vtkm::RangeId::operator== ( const vtkm::RangeId other) const
inline

◆ Union()

vtkm::RangeId vtkm::RangeId::Union ( const vtkm::RangeId other) const
inline

Return the union of this and another range.

This is a nondestructive form of Include.

Member Data Documentation

◆ Max

vtkm::Id vtkm::RangeId::Max

The maximum index of the range (exclusive).

◆ Min

vtkm::Id vtkm::RangeId::Min

The minimum index of the range (inclusive).


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