#include "bt.h"

__kernel void z_solve2(__global double *g_lhs,
                       int gp0,
                       int gp1,
                       int gp2)
{
  int i, j, k, n, m;

  j = get_global_id(2) + 1;
  i = get_global_id(1) + 1;
  if (j > (gp1-2) || i > (gp0-2)) return;

  k = get_global_id(0);
  if (k == 1) k = gp2-1;

  int my_id = (j-1)*(gp0-2) + (i-1);
  int my_offset = my_id * (PROBLEM_SIZE+1) * 3 * 5 * 5;
  __global double (*lhs)[3][5][5] =
    (__global double (*)[3][5][5])&g_lhs[my_offset];

  for (n = 0; n < 5; n++) {
    for (m = 0; m < 5; m++) {
      lhs[k][0][n][m] = 0.0;
      lhs[k][1][n][m] = 0.0;
      lhs[k][2][n][m] = 0.0;
    }
    lhs[k][1][n][n] = 1.0;
  }
}

