X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/book_gpu.git/blobdiff_plain/1a01129f963257afbf1ca4effbb4e6e1f378cefa..bdec1b5087c2ea922fcf62ad0591b8d784ddf3b7:/BookGPU/Chapters/chapter11/code1.cu diff --git a/BookGPU/Chapters/chapter11/code1.cu b/BookGPU/Chapters/chapter11/code1.cu index 4f2316e..5598fcc 100644 --- a/BookGPU/Chapters/chapter11/code1.cu +++ b/BookGPU/Chapters/chapter11/code1.cu @@ -24,12 +24,13 @@ __global__ void CalculateCoefficientsKnots( Tx *u, Ty *v, double *b, double *c, else h[s+1]=0.5*(u[tid+1] + u[tid]); //calculate coefficients - double dtemp = (2*b[tid] - c[tid+1])+((c[tid+1] - c[tid])*(h[s+1] - u[tid]))/fmax(1e-10,(u[tid+1] - u[tid])); + double dtemp = (2*b[tid] - c[tid+1])+((c[tid+1] - c[tid])* + (h[s+1] - u[tid]))/ fmax(1e-10,(u[tid+1] - u[tid])); alpha[s]=v[tid]; beta[s]=c[tid]; gamma[s]=(dtemp - c[tid])/(2*fmax(1e-10,(h[s+1] - u[tid]))); alpha[s+1]=v[tid] + c[tid]*(h[s+1] - u[tid]) + (dtemp - c[tid])*(h[s+1] - u[tid])/2; - gamma[s+1]=(c[tid+1] - dtemp)/(2*fmax(1e-10,(u[tid+1] - h[s+1]))); + gamma[s+1]=(c[tid+1]-dtemp)/(2*fmax(1e-10,(u[tid+1]-h[s+1]))); beta[s+1]=dtemp; } tid += blockDim.x * gridDim.x; s = tid*2;