Open main menu

CDOT Wiki β

Changes

BetaT

187 bytes removed, 17:48, 29 March 2017
Original Problems when converting a program to use the GPU
'''
for (int i = 0; i <= nt - 1; i++)  {  for (int k =0; k <= nx - 1; k++)  if (ik*dx >= 0.5 && ik*dx <= 1) 
{
  u[i k * nt + 0] = 2;
}
else
{
u[i k * nt + 0] = 1;
}
}
for (int it = 1; it <= nx - 1; it++)
{
for (int k = 0; k <= nx - 1; k++)
{
for (int k = 0; k <= nx - 1; k++) { int h = it * nx + k; un[k * nx + it - 1] = u[k * nx + it - 1]; } for (int m = 1; m <= nx - 1; m++) { u[0 * nx + it] = un[1 * nx + it - 1]; u[m * nx + it] = un[m * nx + it - 1] - c*dt / dx*(un[m * nx + it - 1] - un[(m - 1) * nx + it - 1]); // u[m * nx + it] = un[m * nx + it - 1] - c*dt / dx*(un[m * nx + it - 1] - un[(m - 1) * nx + it - 1]); }
}'''
212
edits