lnls-fac / trackcpp

Particle tracking code
GNU General Public License v3.0
3 stars 3 forks source link

Fix kickmap pointer problem #39

Closed xresende closed 3 years ago

xresende commented 3 years ago

fixed a lurking bug with how kickmaps were used. This bug showed up only when distinct kickmaps were used, depending on the c++ compile version/implementation.

previously each Element object had a Kicktable pointer to the corresponding kicktable object. These kicktable objects are added to a Kicktable vector when a new one is defined. It turned out that, depending on the version of the C++ compiler, when a new kicktable object is added to the vector, previous ones could have their objects moved in memory, thus receiving a new object pointer and thus invalidating pointers registered in Element objects.

Instead of using a Kicktable pointer now the index into the vector is registered instead.