Parallel Plane Sweep  0.1
Shared memory multithreaded version of the plane sweep algorithm
Public Member Functions | List of all members
eventQueue Class Reference

A vector-based implementation of a plane sweep event queue. More...

#include <vectorAlEq.h>

Public Member Functions

void insert (const halfsegment &h1)
 
bool peek (halfsegment &h1)
 
bool pop ()
 
int size ()
 
void print ()
 

Detailed Description

A vector-based implementation of a plane sweep event queue.

This is an event queue implemented on top of an STL vector

It is pretty basic. It simply pops from the front of the vector, and does an insertion sort-style insert.

This implementation was used to compare the cache behavior of a vector based plane sweep implementation with an avl tree based implementation.

As expected, the vector based has very good cache behavior (low miss rate), but has quadratic time complexity. The AVL tree implementation has a bad cache miss rate (often upwards of 20 percent miss rate on L2 cache), but a good time complexity

Definition at line 42 of file vectorAlEq.h.

Member Function Documentation

void eventQueue::insert ( const halfsegment h1)
inline

insert into the event queue

uses an insertion sort-style insert. The queue is more like a priority queue, it is always sorted.

Definition at line 55 of file vectorAlEq.h.

bool eventQueue::peek ( halfsegment h1)
inline

Peek at the head of queue. return the halfsegment at the head of the queue, but do not remove it

Parameters
h1[in/out] pass by reference. Will be set to the values of the halfsegment at the head of the queue.
Returns
False if the queue is empty, True otherwise

Definition at line 77 of file vectorAlEq.h.

bool eventQueue::pop ( )
inline

Pop the element from the head of the queue.

Returns
True if an element was popped, False if the queue is empty

Definition at line 89 of file vectorAlEq.h.

void eventQueue::print ( )
inline

Print all elements in the queue (for debugging)

Definition at line 106 of file vectorAlEq.h.

int eventQueue::size ( )
inline

Get the number of halfsegments in the queue

Definition at line 99 of file vectorAlEq.h.


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