I am trying to write code for simulating n-body problem using the Barnes-Hut tree algorithm. I plan on using CUDA in the future and thus want my quadtree data structure to not be composed of heap objects.
From the paper "An Efficient CUDA Implementation of the Tree-Based Barnes Hut n-Body Algorithm" by Martin Burtscher and Keshav Pingali (sorry couldn't find link) the authors state:
Dynamic data structures such as trees are typically built from heap objects, where each heap object contains multiple fields, e.g., child-pointer and data fields, and is allocated dynamically. Because dynamic allocation of and accesses to heap objects tend to be slow, we use an array-based data structure. Accesses to arrays cannot be coalesced if the array elements are objects with multiple fields, so we use several aligned scalar arrays, one per field, as outlined in Figure 6.6. As a consequence, our code uses array indexes instead of pointers to tree nodes.
I understand the part about aligned scalar arrays (i.e. SOA vs AOS idiom in parallel computing), but unfortunately the authors do not explain how one constructs the quadtree using arrays.
My question is how does one implement a quadtree data structure (with methods for inserting spacial points) using arrays? I know how to implement a quadtree in the traditional way using node structs and pointers for children etc. Can someone provide a reference that details how to do this using arrays. Even information on how to implement a binary tree (or any tree really) using arrays might be useful here.