1 ///////////////////////////////////
3 // This tiny version of Barnes-Hut
4 // might have enough of the elements
5 // to exhibit the same reachability state
6 // bug as the full benchmark, but wackily
7 // it either analyzes longer than I'm
8 // willing to wait (over an hour!) or
9 // it exhausts the memory on dc-11.
11 ///////////////////////////////////
14 public class ArrayIndexedNode {
15 public ArrayIndexedNode[] neighbors;
16 public OctTreeNodeData data;
19 public class OctTreeNodeData {
23 public class OctTreeLeafNodeData extends OctTreeNodeData {
24 public ArrayIndexedNode root;
28 public class ArrayIndexedGraph {
29 public ArrayIndexedNode createNode( OctTreeNodeData d ) {
30 ArrayIndexedNode node = disjoint AIN new ArrayIndexedNode();
32 node.neighbors = new ArrayIndexedNode[1];
40 static public void main( String args[] ) {
41 innerMain( args.length );
45 static int numBodies = 3;
48 static public void innerMain( int x ) {
51 OctTreeLeafNodeData bodies[] = new OctTreeLeafNodeData[numBodies];
52 for( int i = 0; i < numBodies; ++i ) {
53 bodies[i] = disjoint BODY new OctTreeLeafNodeData();
60 for( int step = 0; step < 1; ++step ) {
64 ArrayIndexedGraph octree = new ArrayIndexedGraph();
66 ArrayIndexedNode root = octree.createNode( new OctTreeNodeData() );
70 for( int i = 0; i < numBodies; ++i ) {
71 insert( octree, root, bodies[i] );
72 bodies[i].root = root;
82 static public void insert( ArrayIndexedGraph octree,
83 ArrayIndexedNode root,
86 ArrayIndexedNode newNode = octree.createNode( b );
87 root.neighbors[0] = newNode;
89 insert( octree, newNode, b );