Exemple #1
0
    /**
     * Enlarge cubical "box", salvaging existing tree structure.
     *
     * @param tree   the root of the tree.
     * @param nsteps the current time step
     */
    public void expandBox(BTree tree, int nsteps)
    {
        MathVector rmid = MathVector.makeMathVector();

        int  k;
        bool inbox = icTest(tree);

        while (!inbox)
        {
            double rsize = tree.rsize;
            rmid.addScalar(tree.rmin, 0.5 * rsize);

            for (k = 0; k < MathVector.NDIM; k++)
            {
                if (pos.value(k) < rmid.value(k))
                {
                    double rmin = tree.rmin.value(k);
                    tree.rmin.setValue(k, rmin - rsize);
                }
            }
            tree.rsize = 2.0 * rsize;
            if (tree.root != null)
            {
                MathVector ic = tree.intcoord(rmid);
                k = Node.oldSubindex(ic, Node.IMAX >> 1);
                Cell newt = Cell.makeCell();
                newt.subp[k] = tree.root;
                tree.root    = newt;
                inbox        = icTest(tree);
            }
        }
    }