VMTK
|
Implementation of the min heap data structure. More...
#include <vtkvmtkMinHeap.h>
Public Types | |
typedef vtkObject | Superclass |
Public Member Functions | |
virtual int | IsA (const char *type) |
vtkvmtkMinHeap * | NewInstance () const |
void | PrintSelf (ostream &os, vtkIndent indent) VTK_OVERRIDE |
void | Initialize () |
int | GetSize () |
void | InsertNextId (vtkIdType id) |
void | UpdateId (vtkIdType id) |
vtkIdType | GetMin () |
vtkIdType | RemoveMin () |
virtual void | SetMinHeapScalars (vtkDoubleArray *) |
virtual vtkDoubleArray * | GetMinHeapScalars () |
Static Public Member Functions | |
static int | IsTypeOf (const char *type) |
static vtkvmtkMinHeap * | SafeDownCast (vtkObjectBase *o) |
static vtkvmtkMinHeap * | New () |
Protected Member Functions | |
virtual vtkObjectBase * | NewInstanceInternal () const |
vtkvmtkMinHeap () | |
~vtkvmtkMinHeap () | |
void | Swap (vtkIdType loc0, vtkIdType loc1) |
int | IsLeaf (vtkIdType loc) |
vtkIdType | GetLeftChild (vtkIdType loc) |
vtkIdType | GetRightChild (vtkIdType loc) |
vtkIdType | GetParent (vtkIdType loc) |
void | SiftUp (vtkIdType loc) |
void | SiftDown (vtkIdType loc) |
vtkIdType | RemoveAt (vtkIdType loc) |
Protected Attributes | |
vtkIdList * | Heap |
vtkIdList * | BackPointers |
vtkDoubleArray * | MinHeapScalars |
Implementation of the min heap data structure.
This class is an implementation of the min heap data structure, used to handle a set of values in such a way that the retrieval of the minimum element takes constant time. A min heap is a complete binary tree where the value at each node is equal or less than the value at its children, and it is represented as an array where the children of a node stored at location k are at location 2k and 2k+1 (so that the parent of k is located at k/2). Keeping the min heap ordered after a value is updated or an id is inserted in teh heap takes O(log N).
In the present implementation, values are provided in a vtkDoubleArray, and element ids are inserted in the heap. Backpointers are used to access the heap by id. This class is optimized for working in conjunction with vtkNonManifoldFastMarching.
For more insight see J.A. Sethian, Level Set Methods and Fast Marching Methods, Cambridge University Press, 2nd Edition, 1999.
Definition at line 44 of file vtkvmtkMinHeap.h.
typedef vtkObject vtkvmtkMinHeap::Superclass |
Definition at line 47 of file vtkvmtkMinHeap.h.
|
protected |
|
protected |
|
static |
|
virtual |
|
static |
|
protectedvirtual |
vtkvmtkMinHeap* vtkvmtkMinHeap::NewInstance | ( | ) | const |
void vtkvmtkMinHeap::PrintSelf | ( | ostream & | os, |
vtkIndent | indent | ||
) |
|
static |
void vtkvmtkMinHeap::Initialize | ( | ) |
Initializes the heap to an empty state and prepares back pointers. Calls this method before using the min heap once MinHeapScalars have been defined.
|
virtual |
Set/Get the array containing the values indexed by the min heap.
|
virtual |
Set/Get the array containing the values indexed by the min heap.
int vtkvmtkMinHeap::GetSize | ( | ) |
Get heap size.
void vtkvmtkMinHeap::InsertNextId | ( | vtkIdType | id | ) |
Insert an index to a value in HeapScalars in the min heap.
void vtkvmtkMinHeap::UpdateId | ( | vtkIdType | id | ) |
Tells the min heap that the value indexed by id has changed in MinHeapScalars array.
vtkIdType vtkvmtkMinHeap::GetMin | ( | ) |
Gets the id of the minimum value in the min heap.
vtkIdType vtkvmtkMinHeap::RemoveMin | ( | ) |
Gets the id of the minimum value in the min heap and removes it from the min heap.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Definition at line 93 of file vtkvmtkMinHeap.h.
|
protected |
Definition at line 94 of file vtkvmtkMinHeap.h.
|
protected |
Definition at line 96 of file vtkvmtkMinHeap.h.