Open ebknudsen opened 3 years ago
subissue of #948
Working proposal (A):
Working proposal B: we make _particle->mcMagnet a **magnetic_field_info. When a particle encounters a field_push an alloc would occur and a new stack item would get put in line. when Popped, this would be removed again. Care would have to be taken for adding/removing the first field such that pointers get updated correctly. Downside is that this would generate lots of alloc's.
The construction with a global mcMagnet which is toggled by MAGNET_ON/OFF macros does not work anymore. Instead the magnet functions need to deal with the particle mcMagnet directly instead of through the MAGNET_ON/OFF macros.
In general it can't work with a global stack since field push and pop are thread functions (obviously) as they follow the particle.