This is the stencil generated for test_diffusion.py:
extern "C" int Operator(float *u_vec)
{
float (*u)[100][100] = (float (*)[100][100]) u_vec;
{
int t0;
int t1;
for (int i3 = 0; i3<19; i3+=1)
{
{
t0 = (i3)%(2);
t1 = (t0 + 1)%(2);
}
{
for (int i1 = 1; i1<99; i1++)
{
#pragma GCC ivdep
for (int i2 = 1; i2<99; i2++)
{
u[t1][i1][i2] = 1.11022302462516e-16F*u[t0][i1][i2] + 2.5e-1F*u[t0][i1][i2 - 1] + 2.5e-1F*u[t0][i1][i2 + 1] + 2.5e-1F*u[t0][i1 - 1][i2] + 2.5e-1F*u[t0][i1 + 1][i2];
}
}
}
}
}
return 0;
}
The values of t0 and t1 alternate, so it's not clearly defined what index contains the final timestep. If the number of timesteps was even, the final result would be at index 1, while in this code the final result is at index 0
This is the stencil generated for test_diffusion.py:
The values of t0 and t1 alternate, so it's not clearly defined what index contains the final timestep. If the number of timesteps was even, the final result would be at index 1, while in this code the final result is at index 0