HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_Defragment Class Reference

Defragmentation of IndexMaps. More...

#include <GA_Defragment.h>

Classes

class  const_iterator
 
class  swapInfo
 

Public Types

enum  STRATEGY { DEFRAG_TO_ORDER, DEFRAG_DEFAULT = DEFRAG_TO_ORDER }
 
enum  OPERATION { MOVE_A_TO_B, SWAP_AB }
 

Public Member Functions

 GA_Defragment ()
 
 ~GA_Defragment ()
 
const GA_IndexMapgetIndexMap () const
 
GA_AttributeOwner getOwner () const
 
void clear ()
 Clear all information. More...
 
void create (const GA_IndexMap &map, STRATEGY strategy=DEFRAG_DEFAULT, const UT_Options *options=NULL)
 
bool isEmpty () const
 Check if there are any swaps to perform. More...
 
SYS_FORCE_INLINE bool hasOffsetChanged (GA_Offset old_offset) const
 Test to see if an offset will move during the swapping. More...
 
SYS_FORCE_INLINE GA_Offset mapOffset (GA_Offset old_offset) const
 Given the old offset, return the new offset. More...
 
GA_Offset getOffsetMapEntries () const
 Return number of offsets stored in the map. More...
 
GA_Offset getMaxOccupiedOffset () const
 Return the maximum offset after the defragmentation is complete. More...
 
const_iterator begin () const
 
const_iterator end () const
 

Static Public Member Functions

static bool shouldIndexMapBeDefragmented (const GA_IndexMap &map, const UT_Options *options)
 

Detailed Description

Defragmentation of IndexMaps.

Defragmentation consists of two stages

  • Analyzing the index map and computing the swaps/exchanges
  • Application of the swaps When applying the swaps, there are two operations which need to be done
  • When an offset is swapped, all attributes need to have their data swapped.
  • When an offset is swapped, any reference to the old offset needs to be updated to the new offset. For example, primitive store offsets into the vertex index map. When these offsets get moved, primitives need to update their reference. The detail's topology management automatically updates references.

NOTE: Ranges being moved can only overlap if the move is from a higher address to a lower address!

Definition at line 45 of file GA_Defragment.h.

Member Enumeration Documentation

Enumerator
MOVE_A_TO_B 
SWAP_AB 

Definition at line 61 of file GA_Defragment.h.

Enumerator
DEFRAG_TO_ORDER 

Defragment so that the offsets will match the ordered index This will also remove any holes in the index map.

DEFRAG_DEFAULT 

Default strategy.

Definition at line 51 of file GA_Defragment.h.

Constructor & Destructor Documentation

GA_Defragment::GA_Defragment ( )
GA_Defragment::~GA_Defragment ( )

Member Function Documentation

const_iterator GA_Defragment::begin ( void  ) const
inline

Definition at line 273 of file GA_Defragment.h.

void GA_Defragment::clear ( )

Clear all information.

void GA_Defragment::create ( const GA_IndexMap map,
STRATEGY  strategy = DEFRAG_DEFAULT,
const UT_Options options = NULL 
)

Create a defragmentation operation using various strategies Options include

  • bool force [off]
    Force defragmenting to occur.
  • occupancy [0.75]
    Defragment when the ratio of occupied indices to index capacity is beyond this threshold.
  • bool sortvertex [off]
    When defragmenting vertices, sort the vertices by primitive reference order. This will optimize primitive vertex traversal, but add cost to defragmenting.
const_iterator GA_Defragment::end ( void  ) const
inline

Definition at line 274 of file GA_Defragment.h.

const GA_IndexMap& GA_Defragment::getIndexMap ( ) const
inline

Definition at line 67 of file GA_Defragment.h.

GA_Offset GA_Defragment::getMaxOccupiedOffset ( ) const
inline

Return the maximum offset after the defragmentation is complete.

Definition at line 106 of file GA_Defragment.h.

GA_Offset GA_Defragment::getOffsetMapEntries ( ) const
inline

Return number of offsets stored in the map.

Definition at line 103 of file GA_Defragment.h.

GA_AttributeOwner GA_Defragment::getOwner ( ) const
inline

Definition at line 68 of file GA_Defragment.h.

SYS_FORCE_INLINE bool GA_Defragment::hasOffsetChanged ( GA_Offset  old_offset) const
inline

Test to see if an offset will move during the swapping.

Definition at line 94 of file GA_Defragment.h.

bool GA_Defragment::isEmpty ( ) const
inline

Check if there are any swaps to perform.

Definition at line 89 of file GA_Defragment.h.

SYS_FORCE_INLINE GA_Offset GA_Defragment::mapOffset ( GA_Offset  old_offset) const
inline

Given the old offset, return the new offset.

Definition at line 99 of file GA_Defragment.h.

static bool GA_Defragment::shouldIndexMapBeDefragmented ( const GA_IndexMap map,
const UT_Options options 
)
static

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