3 * A class that represents the common fields of a cell or body
13 * Position of the node
15 public MathVector pos;
17 // highest bit of int coord
18 public final int IMAX;
20 // potential softening parameter
21 public final double EPS;
24 * Construct an empty node
31 pos = new MathVector();
34 /*abstract Node loadTree(Body p, MathVector xpic, int l, Tree root);
35 abstract double hackcofm();
36 abstract HG walkSubTree(double dsq, HG hg);*/
38 public final int oldSubindex(MathVector ic, int l)
41 for (int k = 0; k < 3/*MathVector.NDIM*/; k++) {
42 if (((int)ic.value(k) & l) != 0)
43 i += 8/*Cell.NSUB*/ >> (k + 1);
49 * Return a string representation of a node.
50 * @return a string representation of a node.
52 /*public String toString()
54 return mass + " : " + pos;
58 * Compute a single body-body or body-cell interaction
60 public final HG gravSub(HG hg)
62 MathVector dr = new MathVector();
63 dr.subtraction(pos, hg.pos0);
65 double drsq = dr.dotProduct() + EPS * EPS;
66 double drabs = Math.sqrt(drsq);
68 double phii = mass / drabs;
70 double mor3 = phii / drsq;
78 * A class which is used to compute and save information during the
79 * gravity computation phse.
84 * Body to skip in force evaluation
88 * Point at which to evaluate field
90 public MathVector pos0;
92 * Computed potential at pos0
96 * computed acceleration at pos0
98 public MathVector acc0;
101 * Create a HG object.
102 * @param b the body object
103 * @param p a vector that represents the body
105 public HG(Body b, MathVector p)
108 pos0 = (MathVector)p.clone();
110 acc0 = new MathVector();