25 else if(r>0.5 && r<=1.5)
26 return 1.0/(6*h)*( 5.0 - 3.0*r - sqrt(-3.0*(1-r)*(1-r) + 1.0) );
28 return 1.0/(3*h)*( 1.0 + sqrt(-3.0*r*r + 1.0) );
75 int totalPoints,
real *xB,
real *yB,
int *I,
int *J)
77 int bodyIdx = threadIdx.x + blockIdx.x*blockDim.x;
79 if(bodyIdx < totalPoints)
93 for(j=Jb-1; j<=Jb+1; j++)
95 for(i=Ib-2; i<=Ib+1; i++)
97 ERows[EIdx] = bodyIdx;
98 ECols[EIdx] = j*(nx-1) + i;
99 EVals[EIdx] = Dx*
deltaDeviceE(x[i+1]-xB[bodyIdx], 0.5*(y[j]+y[j+1])-yB[bodyIdx], Dx);
105 for(j=Jb-2; j<=Jb+1; j++)
107 for(i=Ib-1; i<=Ib+1; i++)
109 ERows[EIdx+12*totalPoints-12] = bodyIdx + totalPoints;
110 ECols[EIdx+12*totalPoints-12] = j*nx + i + (nx-1)*ny;
111 EVals[EIdx+12*totalPoints-12] = Dx*
deltaDeviceE(0.5*(x[i]+x[i+1])-xB[bodyIdx], y[j+1]-yB[bodyIdx], Dx);
double real
Is a float or a double depending on the machine precision.
__device__ real deltaDeviceE(real x, real y, real h)
Two-dimension discrete delta function.
Contains all the custom-written CUDA kernels.
__device__ real dhRomaDeviceE(real x, real h)
Discrete delta function defined by Roma et al. (1999).
Declaration of the kernels to generate the interpolation matrix.
__global__ void generateE(int *ERows, int *ECols, real *EVals, int nx, int ny, real *x, real *y, real *dx, int totalPoints, real *xB, real *yB, int *I, int *J)
Computes elements of the interpolation matrix.