6.1 Spatial Binning and Particle Storage

The issue of representing space is an important concern for any simulation. For our particular implementation, we chose a spatial binning with variable-length arrays. The space is partitioned with a user-selected refinement factor, effectively allowing the user to trade a smaller memory footprint for faster code execution (i.e. larger bins use less memory, but run slower).

The choice of using a variable-length array for the bins, rather than a linked list allows for particle insertions and deletions to be done in constant amortized time. With a linked list, one of those operations would have to have linear cost -- without a chance to amortize that cost over other less expensive operations. But the variable-length array allows us to say that over a sufficiently large number of insertions and deletions, the cost would ``average out'' to a constant cost per operation.



Chris Siefert and Molly Moore 2002