Exemple #1
0
 /**
  * Recursively walk the tree to do hackwalk calculation
  */
 public override HG walkSubTree(double dsq, HG hg)
 {
     if (this != hg.pskip)
     {
         hg = gravSub(hg);
     }
     return(hg);
 }
Exemple #2
0
        /**
         * Decide if the cell is too close to accept as a single term.
         *
         * @return true if the cell is too close.
         */
        public bool subdivp(double dsq, HG hg)
        {
            MathVector dr = MathVector.makeMathVector();

            dr.subtraction2(pos, hg.pos0);
            double drsq = dr.dotProduct();

            // in the original olden version drsp is multiplied by 1.0
            return(drsq < dsq);
        }
Exemple #3
0
        /**
         * Evaluate gravitational field on the body.
         * The original olden version calls a routine named "walkscan",
         * but we use the same name that is in the Barnes code.
         */
        public void hackGravity(double rsize, Node root)
        {
            MathVector pos0 = pos.cloneMathVector();

            HG hg = HG.makeHG(this, pos);

            hg     = root.walkSubTree(rsize * rsize, hg);
            phi    = hg.phi0;
            newAcc = hg.acc0;
        }
Exemple #4
0
		/**
	 * Compute a single body-body or body-cell interaction
	 */
		public HG gravSub (HG hg)
		{
			MathVector dr = MathVector.makeMathVector ();
			dr.subtraction2 (pos, hg.pos0);

			double drsq = dr.dotProduct () + (EPS * EPS);
			double drabs = Math.Sqrt (drsq);

			double phii = mass / drabs;
			hg.phi0 -= phii;
			double mor3 = phii / drsq;
			dr.multScalar1 (mor3);
			hg.acc0.addition (dr);
			return hg;
		}
Exemple #5
0
        /**
         * Compute a single body-body or body-cell interaction
         */
        public HG gravSub(HG hg)
        {
            MathVector dr = MathVector.makeMathVector();

            dr.subtraction2(pos, hg.pos0);

            double drsq  = dr.dotProduct() + (EPS * EPS);
            double drabs = Math.Sqrt(drsq);

            double phii = mass / drabs;

            hg.phi0 -= phii;
            double mor3 = phii / drsq;

            dr.multScalar1(mor3);
            hg.acc0.addition(dr);
            return(hg);
        }
Exemple #6
0
        /**
         * Recursively walk the tree to do hackwalk calculation
         */
        public override HG walkSubTree(double dsq, HG hg)
        {
            if (subdivp(dsq, hg))
            {
                for (int k = 0; k < Cell.NSUB; k++)
                {
                    Node r = this.subp [k];
                    if (r != null)
                    {
                        hg = r.walkSubTree(dsq / 4.0, hg);
                    }
                }
            }
            else
            {
                hg = gravSub(hg);
            }

            return(hg);
        }
Exemple #7
0
 public abstract HG walkSubTree(double dsq, HG hg);
Exemple #8
0
		/**
	 * Recursively walk the tree to do hackwalk calculation
	 */
		public override HG walkSubTree (double dsq, HG hg)
		{
			if (subdivp (dsq, hg)) {
				for (int k = 0; k < Cell.NSUB; k++) {
					Node r = this.subp [k];
					if (r != null)
						hg = r.walkSubTree (dsq / 4.0, hg);
				}
			} else
				hg = gravSub (hg);

			return hg;
		}
Exemple #9
0
		/**
	 * Decide if the cell is too close to accept as a single term.
	 *
	 * @return true if the cell is too close.
	 */
		public bool subdivp (double dsq, HG hg)
		{
			MathVector dr = MathVector.makeMathVector ();
			dr.subtraction2 (pos, hg.pos0);
			double drsq = dr.dotProduct ();

			// in the original olden version drsp is multiplied by 1.0
			return (drsq < dsq);
		}
Exemple #10
0
		/**
	 * Recursively walk the tree to do hackwalk calculation
	 */
		public override HG walkSubTree (double dsq, HG hg)
		{
			if (this != hg.pskip)
				hg = gravSub (hg);
			return hg;
		}
Exemple #11
0
		public abstract HG walkSubTree (double dsq, HG hg);