|
VMTK
|
Implements 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 (std::ostream &os, vtkIndent indent) 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 |
Implements 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 the 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 43 of file vtkvmtkMinHeap.h.
| typedef vtkObject vtkvmtkMinHeap::Superclass |
Definition at line 46 of file vtkvmtkMinHeap.h.
|
protected |
Definition at line 31 of file vtkvmtkMinHeap.cxx.
|
protected |
Definition at line 38 of file vtkvmtkMinHeap.cxx.
|
static |
|
virtual |
|
static |
|
protectedvirtual |
| vtkvmtkMinHeap * vtkvmtkMinHeap::NewInstance | ( | ) | const |
|
override |
Definition at line 342 of file vtkvmtkMinHeap.cxx.
|
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.
Definition at line 50 of file vtkvmtkMinHeap.cxx.
|
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.
Definition at line 106 of file vtkvmtkMinHeap.cxx.
| void vtkvmtkMinHeap::InsertNextId | ( | vtkIdType | id | ) |
Insert an index to a value in HeapScalars in the min heap.
Definition at line 71 of file vtkvmtkMinHeap.cxx.
| void vtkvmtkMinHeap::UpdateId | ( | vtkIdType | id | ) |
Tells the min heap that the value indexed by id has changed in MinHeapScalars array.
Definition at line 111 of file vtkvmtkMinHeap.cxx.
| vtkIdType vtkvmtkMinHeap::GetMin | ( | ) |
Gets the id of the minimum value in the min heap.
Definition at line 287 of file vtkvmtkMinHeap.cxx.
| vtkIdType vtkvmtkMinHeap::RemoveMin | ( | ) |
Gets the id of the minimum value in the min heap and removes it from the min heap.
Definition at line 269 of file vtkvmtkMinHeap.cxx.
|
protected |
Definition at line 321 of file vtkvmtkMinHeap.cxx.
|
protected |
Definition at line 129 of file vtkvmtkMinHeap.cxx.
|
protected |
Definition at line 146 of file vtkvmtkMinHeap.cxx.
|
protected |
Definition at line 163 of file vtkvmtkMinHeap.cxx.
|
protected |
Definition at line 180 of file vtkvmtkMinHeap.cxx.
|
protected |
Definition at line 194 of file vtkvmtkMinHeap.cxx.
|
protected |
Definition at line 227 of file vtkvmtkMinHeap.cxx.
|
protected |
Definition at line 296 of file vtkvmtkMinHeap.cxx.
|
protected |
Definition at line 103 of file vtkvmtkMinHeap.h.
|
protected |
Definition at line 104 of file vtkvmtkMinHeap.h.
|
protected |
Definition at line 106 of file vtkvmtkMinHeap.h.