Skip to content

Commit

Permalink
Working! With C++ API
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Aug 8, 2018
1 parent 6f9a72e commit 767eda4
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/analysis/raster/slope.cl
@@ -1,7 +1,7 @@
#pragma OPENCL EXTENSION cl_khr_fp64 : enable

float calcFirstDer( float x11, float x21, float x31, float x12, float x22, float x32, float x13, float x23, float x33,
float mInputNodataValue, float mOutputNodataValue, double mZFactor, double mCellSize )
double mInputNodataValue, double mOutputNodataValue, double mZFactor, double mCellSize )
{
//the basic formula would be simple, but we need to test for nodata values...
//X: return (( (x31 - x11) + 2 * (x32 - x12) + (x33 - x13) ) / (8 * mCellSizeX));
Expand Down Expand Up @@ -72,14 +72,10 @@ float calcFirstDer( float x11, float x21, float x31, float x12, float x22, float


__kernel void processNineCellWindow( __global float *scanLine1,
__global float *scanLine2,
__global float *scanLine3,
__global float *resultLine,
__global float *mInputNodataValue,
__global float *mOutputNodataValue,
__global double *mZFactor,
__global double *mCellSizeX,
__global double *mCellSizeY
__global float *scanLine2,
__global float *scanLine3,
__global float *resultLine,
__global double *rasterParams
) {

// Get the index of the current element
Expand All @@ -90,17 +86,19 @@ __kernel void processNineCellWindow( __global float *scanLine1,
float derX = calcFirstDer( scanLine1[i], scanLine2[i], scanLine3[i],
scanLine1[i+1], scanLine2[i+1], scanLine3[i+1],
scanLine1[i+2], scanLine2[i+2], scanLine3[i+2],
*mInputNodataValue, *mOutputNodataValue, *mZFactor, *mCellSizeX
rasterParams[0], rasterParams[1], rasterParams[2], rasterParams[3]
);
//return (((x11 - x13) + 2 * (x21 - x23) + (x31 - x33)) / ( 8 * mCellSizeY));
float derY = calcFirstDer( scanLine1[i+2], scanLine1[i+1], scanLine1[i],
scanLine2[i+2], scanLine2[i+1], scanLine2[i],
scanLine3[i+2], scanLine3[i+1], scanLine3[i],
*mInputNodataValue, *mOutputNodataValue, *mZFactor, *mCellSizeY
rasterParams[0], rasterParams[1], rasterParams[2], rasterParams[4]
);
if ( derX == *mOutputNodataValue || derY == *mOutputNodataValue )


if ( derX == rasterParams[1] || derY == rasterParams[1] )
{
resultLine[i] = *mOutputNodataValue;
resultLine[i] = rasterParams[1];
}
else
{
Expand Down

0 comments on commit 767eda4

Please sign in to comment.