mabarnes / moment_kinetics

Other
2 stars 4 forks source link

Stop @loop_* ranges being altered from inside loop #172

Closed johnomotani closed 9 months ago

johnomotani commented 9 months ago

Read the ranges out of the looping.loop_ranges variable into macro-local variables at the point where @loop_* is called. This means that if the region type is changed (changing looping.loop_ranges) inside the loop, the outer @loop_* does not change. This behaviour is a bit at odds with how Julia behaves with nested loops, but seems more natural if you think of an @loop_* statement as a single thing which should not change after you enter the block.