bergwerf / bromium

Engine for simulating reactions using Brownian motion
https://www.hermanbergwerf.com/bromium-deploy/
GNU Affero General Public License v3.0
6 stars 1 forks source link

Migrate to unsigned 32 bit integers for particle positions #3

Closed bergwerf closed 8 years ago

bergwerf commented 8 years ago

Until now there have been two ways to represent the particle position: unsigned 16 bit integers and 32 bit floats. The floats were originally there to allow simulations with more precision, however, they have added a lot of complexity and confusion to the code. The 3 x uint16 positions were originally intended to represent a voxel position so the particle position does not have to be converted to a voxel position every step (note that uint16 is almost the largest type that is suitable for this because the voxel position and type have to be hashed into a 64 bit integer). However, to keep things simple we're going to move to unsigned 32 bit integers. The ability to omit voxel position computation and particle distance computation (by using voxel groups instead of square roots) can still be maintained by setting each voxel to contain only one particle position. Voxels can also contain more particle positions to increase precision.

bergwerf commented 8 years ago

I'm now only using unsigned 16 bit integers for positions and I think this is (currently) sufficient.