VMTK
Loading...
Searching...
No Matches
vtkvmtkMinHeap.h
Go to the documentation of this file.
1/*=========================================================================
2
3Program: VMTK
4
5 Copyright (c) Luca Antiga, David Steinman. All rights reserved.
6 See LICENSE file for details.
7
8 Portions of this code are covered under the VTK copyright.
9 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm
10 for details.
11
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
15
16=========================================================================*/
34
35#ifndef __vtkvmtkMinHeap_h
36#define __vtkvmtkMinHeap_h
37
38#include "vtkObject.h"
39#include "vtkDoubleArray.h"
40//#include "vtkvmtkComputationalGeometryWin32Header.h"
41#include "vtkvmtkWin32Header.h"
42
43class VTK_VMTK_COMPUTATIONAL_GEOMETRY_EXPORT vtkvmtkMinHeap : public vtkObject
44{
45 public:
46 vtkTypeMacro(vtkvmtkMinHeap,vtkObject);
47 void PrintSelf(std::ostream& os, vtkIndent indent) override;
48
50
55 void Initialize();
56
58
61 vtkSetObjectMacro(MinHeapScalars,vtkDoubleArray);
62 vtkGetObjectMacro(MinHeapScalars,vtkDoubleArray);
64
68 int GetSize();
69
73 void InsertNextId(vtkIdType id);
74
78 void UpdateId(vtkIdType id);
79
83 vtkIdType GetMin();
84
88 vtkIdType RemoveMin();
89
90 protected:
93
94 void Swap(vtkIdType loc0, vtkIdType loc1);
95 int IsLeaf(vtkIdType loc);
96 vtkIdType GetLeftChild(vtkIdType loc);
97 vtkIdType GetRightChild(vtkIdType loc);
98 vtkIdType GetParent(vtkIdType loc);
99 void SiftUp(vtkIdType loc);
100 void SiftDown(vtkIdType loc);
101 vtkIdType RemoveAt(vtkIdType loc);
102
103 vtkIdList* Heap;
104 vtkIdList* BackPointers;
105
106 vtkDoubleArray* MinHeapScalars;
107
108 private:
109 vtkvmtkMinHeap(const vtkvmtkMinHeap&); // Not implemented.
110 void operator=(const vtkvmtkMinHeap&); // Not implemented.
111};
112
113#endif
void Swap(vtkIdType loc0, vtkIdType loc1)
vtkIdList * BackPointers
static vtkvmtkMinHeap * New()
void SiftDown(vtkIdType loc)
void PrintSelf(std::ostream &os, vtkIndent indent) override
vtkIdType RemoveMin()
int IsLeaf(vtkIdType loc)
vtkDoubleArray * MinHeapScalars
vtkIdType GetRightChild(vtkIdType loc)
vtkIdType GetLeftChild(vtkIdType loc)
vtkIdType RemoveAt(vtkIdType loc)
vtkIdList * Heap
void SiftUp(vtkIdType loc)
vtkIdType GetParent(vtkIdType loc)
void UpdateId(vtkIdType id)
void InsertNextId(vtkIdType id)