Tue Jan 29 20:13:05 CET 2013

Grid index computation

It might be better to define offset variables at the beginning of each
loop such that loop indexing is just:

   offset = offset_super + y * x_max;
   arr[offset + x];

it doesn't make sense to use things like:

   arr[... + y * x_max + x]

Id' say to use stride increments in the for loops, hower there needs
to be a way to recover the proper linear increasing coordinates
because the loop body might need them to compute stuff.

Let's leave it open, and insert something that works.

Anyways, I've abstracted the grid traversal code a bit.  This can be
simplified a bit more even.

It's probably best to convert all type info to grid dimensions,
strides and offsets as soon as possible.

Indexing the arrays requires offsets of particular input parameter or
state structure in the bulk array + a stride structure for indexing.

EDIT: fixed