]> AND Private Git Repository - book_gpu.git/blobdiff - BookGPU/Chapters/chapter11/code1.cu
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
ch1
[book_gpu.git] / BookGPU / Chapters / chapter11 / code1.cu
index 3b77cc266f695061311c90a1543ccba5b5c09d14..5598fcc42e1e2d571e72e09ca31fda5e54133e47 100644 (file)
@@ -1,7 +1,6 @@
 
 template<typename Tx, typename Ty>
 
 template<typename Tx, typename Ty>
-__global__ void CalculateCoefficientsKnots( Tx *u, Ty *v, double *b, double *c,
-  double *t, double *alpha, double *beta, double *gamma, int N )
+__global__ void CalculateCoefficientsKnots( Tx *u, Ty *v, double *b, double *c, double *t, double *alpha, double *beta, double *gamma, int N )
 {
   int tid = threadIdx.x + blockIdx.x * blockDim.x;
   int s = tid*2;
 {
   int tid = threadIdx.x + blockIdx.x * blockDim.x;
   int s = tid*2;
@@ -25,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
       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;
       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;
       beta[s+1]=dtemp;
     }
     tid += blockDim.x * gridDim.x;   s = tid*2;