Fix gpart id/pointer
Making a union of the gpart
ID and the part pointer seemed like a good idea at first, but it's just an accident waiting to happen, as the pointers are not guaranteed to be less than 2^63. I therefore suggest the following:
- Store the
gpart
ID as aptrdiff_t
. - If the
gpart
ID is positive, it's just the particle's ID. - If the
gpart
ID is negative, then it is the negative offset in thespace->parts[]
array of itspart
counterpart.
This storage format has the additional advantage that it makes it easier to re-link the particles if we ever do have to send them around between nodes, e.g. by making the offsets relative to whatever array the data is stored/sent in.
This is currently just a proposal. Please let me know what you think and if there is no opposition I will change this as soon as the initial gpart
branch has been merged (!116 (merged)).