How do we write the Force operator as separate operations?
code.Paint()
for d in range(3):
code.MeshForce(d)
code.ReadOut(d, acc='acc')
The problem is acc is modified in place, and we need to save three copies on the tape, each of which 2/3 is not useful.
code.Paint()
for d in range(3):
code.MeshForce(d)
code.ReadOut(d, acc='acc-%d' % d)
code.Concatenate(src=['acc-%d' for d in range(3)], out='acc')
This is cleaner on the tape, but require us to be able to handle list of arguments, and require us to be aware of types of arguments.