Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Kernel

By: a guest on Oct 25th, 2011  |  syntax: C  |  size: 0.61 KB  |  views: 44  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #pragma OPENCL EXTENSION cl_khr_fp64 : enable
  2.  
  3. __kernel void afstand(__global const Coord *OP, __global const Coord *Segment, __global const Coord* Afstanden, __global const int flightAltitude)
  4. {
  5.     int i = get_global_id(0);
  6.     int segment, opNr;
  7.     double xDelta, yDelta;
  8.     double afstand;
  9.    
  10.     segment = i % maxSegmenten;
  11.     OP = (i - segment) / maxSegmenten;
  12.    
  13.     xDelta = Segment[segment].x - OP[opNr].x;
  14.     yDelta = Segment[segment].y - OP[opNr].y;
  15.    
  16.     distance = hypot((xDelta*xDelta),(yDelta*yDelta),(double)(flightAltitude*flightAltitude));
  17.    
  18.     Afstanden[i] = distance;
  19. }
  20.