Parallel Plane Sweep  0.1
Shared memory multithreaded version of the plane sweep algorithm
Classes | Macros | Functions
parPlaneSweep.h File Reference
#include <omp.h>
#include <vector>
#include <algorithm>
#include <limits>
#include <iostream>
#include <cstdlib>
#include "avl.h"

Go to the source code of this file.

Classes

class  halfsegment
 holds a single halfsegment, along with labeling information and information indicating if the opposing region's interior lies above and/or below the halfsegment. More...
 

Macros

#define PARSESWEEP_H
 

Functions

bool leftHandturn (double p1x, double p1y, double p2x, double p2y, double p3x, double p3y)
 
void parallelOverlay (vector< halfsegment > &r1, vector< halfsegment > &r2, vector< halfsegment > &result, int numSplits=-1, int numWorkerThreads=-1)
 
void overlayPlaneSweep (const halfsegment r1[], int r1Size, const halfsegment r2[], int r2Size, vector< halfsegment > &result)
 

Detailed Description

Header file containing the necessary function prototypes for the parallel plane sweep and the serial plane sweep algorithms.

Also contains some helper functions.

Definition in file parPlaneSweep.h.

Macro Definition Documentation

#define PARSESWEEP_H

Definition at line 23 of file parPlaneSweep.h.

Function Documentation

bool leftHandturn ( double  p1x,
double  p1y,
double  p2x,
double  p2y,
double  p3x,
double  p3y 
)
inline

Left hand turn test

returns true if when you start at p1, and walk towards p2, you have to make a left turn at p2 in order to continue walking to p3.

Takes 3 points. The parameters are the x and y values for point p1, the x and y values for point p2, and the x and y values for point p3.

Definition at line 50 of file parPlaneSweep.h.

void overlayPlaneSweep ( const halfsegment  r1[],
int  r1Size,
const halfsegment  r2[],
int  r2Size,
vector< halfsegment > &  result 
)

Compute the overlay of halfsegments given in two input vectors. Uses the plane sweep algorithm. This is the serial plane sweep algorithm, it is called by parallelOverlay(). parallelOverlay() sets up the strips, then calls this over each strip. The implementation of this function can be switched with any plane sweep style algorithm.

Parameters
r1a vector of halfsegments
r2a vector of halfsegments
r1Sizethe length of the r1 vector
r2Sizethe length of the r2 vector
result[in/out] the result of overlaying r1 and r2

See the prototype in parPlaneSweep.h

Definition at line 347 of file parPlaneSweep.cpp.

void parallelOverlay ( vector< halfsegment > &  r1,
vector< halfsegment > &  r2,
vector< halfsegment > &  result,
int  numStrips,
int  numWorkerThreads 
)

Compute the overlay of two regions in parallel. This is a wrapper function that divides a pair of input regions into strips, assigns halfsegments to the appropriate strips, then calls a plane sweep algorithm on each strip.

Parameters
r1[in/out] input region 1
r2[in/out] input region 2
numSplitshow many strips should be created over the input. If no value is given, the number of strips defaults to the number of processor cores.
numWorkerThreadsThe number of worker threads for openMP to use. If no value is given, openMP's default value is used.

See the prototype in parPlaneSweep.h

Definition at line 247 of file parPlaneSweep.cpp.