Jacobi iteration with a 2D Array.
Demonstrates 2d dense chare array creation and use. This code computes
the steady state heat distribution of a 2d plate using the jacobi
iteration:
while new_temp != temp
//next temperature is average of surrounding temperatures
new_temp(x,y) = (temp(x-1,y)+temp(x+1,y)+temp(x,y-1)+temp(x,y+1))/4
temp(x,y) = new_temp(x,y)
end
Every temp(x,y) is a chare in this sample application. The main chare
sends a notice to all the nodes in our simulation telling them to
exchange information. After each node is done updating its
temperature, it sends a message back the error as the difference
between temp and new_temp. Main quits driving the iterations when the
error has been minimized below some threshold.