GA_IndexMap Class Reference

A class to manage an ordered array which has fixed offset handles. More...

#include <GA_IndexMap.h>

List of all members.

Classes

class  AttributeCompare
class  IndexCompare

Public Member Functions

 GA_IndexMap (GA_Detail &detail, GA_AttributeOwner type)
 ~GA_IndexMap ()
GA_DetailgetDetail () const
 Access the detail this index map belongs to.
GA_AttributeOwner getOwner () const
 What type of element is stored in the index.
int64 getMemoryUsage () const
 Report the memory used.
GA_Size getOffsetCapacity () const
GA_Size getOffsetSize () const
GA_Size indexSize () const
GA_Offset offsetFromIndex (GA_Index ordered_index) const
GA_Index indexFromOffset (GA_Offset data_offset) const
GA_Offset lastOffset () const
 Obtain offset of the last element. Returns GA_INVALID_OFFSET if empty.
GA_Offset findOffsetInIndices (GA_Index ordered_index) const
GA_Offset findNextOffsetInIndices (GA_Offset data_offset, GA_Size step) const
GA_Index findIndexInOffsets (GA_Offset data_offset) const
GA_Index reorder (GA_Offset data_offset, GA_Index new_order)
bool isTrivialMap () const
bool isMonotonicMap () const
bool sortIndices (IndexCompare &compare, bool stable=true)
 Sort the index order using a comparator.
bool sortIndices (IndexCompare &compare, const GA_Range &range, bool stable=true)
 Sort a selection of elements.
bool sortOffsetArray (GA_OffsetArray &offsets, IndexCompare &compare, bool stable=true) const
 Sort an array of GA_Offset data according to a comparator.
GA_Offset addElement ()
void destroyIndex (GA_Index where)
 Delete an element from the list by specifying the order.
void destroyOffset (GA_Offset where)
 Delete an element from the list by the data offset.
bool isOffsetInRange (GA_Offset offset) const
bool isOffsetVacant (GA_Offset offset) const
 Returns true if the specified offset is not in use (i.e. vacant).
bool isOffsetActiveFast (GA_Offset offset) const
GA_Offset findVacantOffset (GA_Offset start, GA_Offset end) const
GA_Offset findActiveOffset (GA_Offset start, GA_Offset end) const
bool isOffsetActive (GA_Offset offset) const
 Returns true if the specified offset is referenced by an ordered element.
bool isOffsetTransient (GA_Offset offset) const
int getChangeCount () const
 Return the change count on the index map.
bool swapOrderByOffset (GA_Offset offset1, GA_Offset offset2)
bool swapOrderByIndex (GA_Index order1, GA_Index order2)
bool cycleIndices (GA_Size offset)
bool cycleIndices (GA_Size offset, const GA_Range &range)
bool reverseIndices ()
bool reverseIndices (const GA_Range &range)


Detailed Description

A class to manage an ordered array which has fixed offset handles.

The GA_Detail keeps an ordered list of elements (points, vertices etc.) maintained by this class. Each ordered element (named "index") also has a fixed offset. The offset remains constant as elements are added/removed from the detail. The offset is used for indexing into The attribute arrays Groups Primitive lists etc. Since the offset is not mutable, as elements are added and deleted, vacancies become available in the attribute arrays. These vacancies may then be filled as new elements get allocated.

This class (GA_IndexMap) keeps track of the vacancies and the order of elements.

During some operations, temporary elements are also created. This class maintains temporary elements too.

Examples:

tetprim/GEO_PrimTetra.C.

Definition at line 58 of file GA_IndexMap.h.


Constructor & Destructor Documentation

GA_IndexMap::GA_IndexMap ( GA_Detail detail,
GA_AttributeOwner  type 
)

GA_IndexMap::~GA_IndexMap (  ) 


Member Function Documentation

GA_Offset GA_IndexMap::addElement (  )  [inline]

Add a new element to the list, returning the data offset of the new element.

Definition at line 313 of file GA_IndexMap.h.

bool GA_IndexMap::cycleIndices ( GA_Size  offset,
const GA_Range range 
)

Shift/cycle elements in the list.

bool GA_IndexMap::cycleIndices ( GA_Size  offset  ) 

Shift/cycle elements in the list.

void GA_IndexMap::destroyIndex ( GA_Index  where  ) 

Delete an element from the list by specifying the order.

void GA_IndexMap::destroyOffset ( GA_Offset  where  ) 

Delete an element from the list by the data offset.

GA_Offset GA_IndexMap::findActiveOffset ( GA_Offset  start,
GA_Offset  end 
) const [inline]

Returns the first offset in [start, end) which is active If none are vacant, return end. No bounds checking is done.

Definition at line 341 of file GA_IndexMap.h.

GA_Index GA_IndexMap::findIndexInOffsets ( GA_Offset  data_offset  )  const

Non-compacting method to find the true order of the given data_offset. This method may need to search the non-compact mapping for holes, and so sequential calls can easily result in O(n^2) behaviour.

GA_Offset GA_IndexMap::findNextOffsetInIndices ( GA_Offset  data_offset,
GA_Size  step 
) const

Given an offset, this skips the step ordered index and returns the next fixed offset. This method may do an O(N) search for the result, but is guaranteed to be const. It's primarily designed for use in GA_RTIIndex.

GA_Offset GA_IndexMap::findOffsetInIndices ( GA_Index  ordered_index  )  const

Given an ordered index, this returns the fixed offset associated with the index. This method may do an O(N) search for the result, but is guaranteed to be const. It's primarily designed for use in GA_RTIIndex.

GA_Offset GA_IndexMap::findVacantOffset ( GA_Offset  start,
GA_Offset  end 
) const [inline]

Returns the first offset in [start, end) which is vacant. If none are vacant, return end. No bounds checking is done.

Definition at line 336 of file GA_IndexMap.h.

int GA_IndexMap::getChangeCount (  )  const [inline]

Return the change count on the index map.

Definition at line 400 of file GA_IndexMap.h.

GA_Detail& GA_IndexMap::getDetail (  )  const [inline]

Access the detail this index map belongs to.

Definition at line 65 of file GA_IndexMap.h.

int64 GA_IndexMap::getMemoryUsage (  )  const

Report the memory used.

GA_Size GA_IndexMap::getOffsetCapacity (  )  const [inline]

The capacity for offsets. Attribute arrays must be able to store at least this much storage.

Definition at line 74 of file GA_IndexMap.h.

GA_Size GA_IndexMap::getOffsetSize (  )  const [inline]

Return maximum occupied index of the offset array. This will be an upper bound when iterating over offsets. The getOffsetSize() is always <= to the getOffsetCapacity().

Definition at line 79 of file GA_IndexMap.h.

GA_AttributeOwner GA_IndexMap::getOwner (  )  const [inline]

What type of element is stored in the index.

Definition at line 67 of file GA_IndexMap.h.

GA_Index GA_IndexMap::indexFromOffset ( GA_Offset  data_offset  )  const [inline]

Given an element offset, this returns the ordered index. NOTE: Calling the indexFromOffset() function may invoke internal data modifications (i.e. these operations may be mutable). These operations are potentially expensive and should be avoided if possible.

See also:
findIndexInOffsets()
Examples:
tetprim/GEO_PrimTetra.C.

Definition at line 117 of file GA_IndexMap.h.

GA_Size GA_IndexMap::indexSize (  )  const [inline]

Return number of elements in the list. This indexSize() is always <= the getOffsetSize()

Examples:
SOP/SOP_HDKObject.C, and SOP/SOP_SParticle.C.

Definition at line 86 of file GA_IndexMap.h.

bool GA_IndexMap::isMonotonicMap (  )  const [inline]

Definition at line 178 of file GA_IndexMap.h.

bool GA_IndexMap::isOffsetActive ( GA_Offset  offset  )  const [inline]

Returns true if the specified offset is referenced by an ordered element.

Definition at line 345 of file GA_IndexMap.h.

bool GA_IndexMap::isOffsetActiveFast ( GA_Offset  offset  )  const [inline]

Returns true if the specified offset is referenced by an ordered element No bounds checking is done.

Definition at line 329 of file GA_IndexMap.h.

bool GA_IndexMap::isOffsetInRange ( GA_Offset  offset  )  const [inline]

Returns whether the offset is in the valid range of offsets for this index map.

Definition at line 321 of file GA_IndexMap.h.

bool GA_IndexMap::isOffsetTransient ( GA_Offset  offset  )  const

Returns true if the specified offset is being used for a temporary element.

See also:
GA_WorkVertexBuffer

bool GA_IndexMap::isOffsetVacant ( GA_Offset  offset  )  const

Returns true if the specified offset is not in use (i.e. vacant).

bool GA_IndexMap::isTrivialMap (  )  const [inline]

A trivial map is one where offsetFromIndex(i) == i for all elements. That is, the offsets are in order and there are no vacancies.

Definition at line 170 of file GA_IndexMap.h.

GA_Offset GA_IndexMap::lastOffset (  )  const [inline]

Obtain offset of the last element. Returns GA_INVALID_OFFSET if empty.

Definition at line 126 of file GA_IndexMap.h.

GA_Offset GA_IndexMap::offsetFromIndex ( GA_Index  ordered_index  )  const [inline]

When accessing the map functions (i.e. mapping from order to data offsets), the map may be compacted. This is a potentially expensive operation and should be avoided if possible. Given an ordered index, this returns the fixed offset associated with the index. NOTE: Calling the offsetFromIndex() function may invoke internal data modifications (i.e. these operations may be mutable). These operations are potentially expensive and should be avoided if possible.

See also:
findOffsetInIndices(), findNextOffsetInIndices()
Examples:
tetprim/GEO_PrimTetra.C.

Definition at line 102 of file GA_IndexMap.h.

GA_Index GA_IndexMap::reorder ( GA_Offset  data_offset,
GA_Index  new_order 
)

Reorder an element. The index of the element at the given data offset will be changed to the new order (provided that the ordered position is in a valid range).

Returns:
The new index of the element, or -1 if there was an error

bool GA_IndexMap::reverseIndices ( const GA_Range range  ) 

Reverse a selection of elements

bool GA_IndexMap::reverseIndices (  ) 

Reverse a selection of elements

bool GA_IndexMap::sortIndices ( IndexCompare compare,
const GA_Range range,
bool  stable = true 
)

Sort a selection of elements.

bool GA_IndexMap::sortIndices ( IndexCompare compare,
bool  stable = true 
)

Sort the index order using a comparator.

bool GA_IndexMap::sortOffsetArray ( GA_OffsetArray offsets,
IndexCompare compare,
bool  stable = true 
) const

Sort an array of GA_Offset data according to a comparator.

bool GA_IndexMap::swapOrderByIndex ( GA_Index  order1,
GA_Index  order2 
)

Swap the order of the two specified (ordered, not transient) data offsets.

Warning:
You must force defragmentation after swapping the index order to maintain monotonicity of the index map.
Returns:
True on success, false on failure.

bool GA_IndexMap::swapOrderByOffset ( GA_Offset  offset1,
GA_Offset  offset2 
)

Swap the order of the two specified (ordered, not transient) data offsets.

Warning:
You must force defragmentation after swapping the index order to maintain monotonicity of the index map.
Returns:
True on success, false on failure.


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

Generated on Thu Jan 31 00:30:49 2013 for HDK by  doxygen 1.5.9