212
edits
Changes
BetaT
,→Optimizing Problems
== Optimizing Problems ==
__global__ void Initalize(float* u, float* un, int nx, int nt, float dx)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
int j = blockIdx.y * blockDim.y + threadIdx.y;
if (i < nx && j < nx)
{
if (i*dx >= 0.5 && i*dx <= 1)
{
u[i * nx] = 2;
}
else
{
u[i * nx] = 1;
}
}
}
__global__ void Calculate (float* u, float* un,int nx, int c, float dx, float dt)