summaryrefslogtreecommitdiff
path: root/src/spheres_poly/heap.h
blob: 91180e32f6ff3d6de8768be47e6309bc19c13c97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//---------------------------------------------------------------------------
// Event heap maker
//---------------------------------------------------------------------------

#ifndef  HEAP_H
#define  HEAP_H

#include "event.h"
#include "sphere.h"

class heap {

 public:

  // constructor and destructor
  heap(int maxsize);
  heap(const heap &h);
  ~heap();

  // variables
  int maxsize;   // max allowed number of events
  int N;         // current number of events
  int *a;
  sphere *s;
  int *index;     // array of indices for each sphere
  //event minevent;


  // functions which operate on a binary heap
  
  void upheap(int k);
  void downheap(int k);
  void insert(int i);
  void replace(int i);
  int search(int j);
  void change(int i); 
  int extractmax();
  void print();
  void checkindex();
  
};
#endif