Ejemplo n.º 1
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);
    }
Ejemplo n.º 2
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);
    }