Re: variable particle number

From: Eugene P. Kurbatov <kurbatov_at_inasan.ru>
Date: Tue, 17 May 2005 16:42:16 +0400

>> You mean the `nextnode[]' array in Gadget1 ?
> .. i was assuming that you're using gadget2. it isn't?

I experimenting on gadget1 meanwhile. I think it doesn't matter.

> keeping the assumption: also in gadget2 there is a Nextnode[] array
> which describes the complete tree-walk.

> basically you have two moments to make a particle "visible" or
> "invisible" to the tree construction/evaluation.
> the first one is when the tree is built; so that, in
> force_treebuild_single() you simply "mask" the particle i in the for(;;)
> cycle. this way, all (side-length of tree nodes, multipole moments, hmax
> etc) is being consistently computed (it is up to you to decide what
> error will arise when multipoles are not updated).

Yes, this is done.

> a second moment is when the tree is updated (basically in
> force_update_node_len_local() ). Then you have to take care about
> multipole moments, bitflags etc, if i'm not misunderstanding what you're
> doing. Moreover, you have to modify the Nextnode[] so that when the tree
> is evaluated the particle i will not be included..

Ok, I think I found relatively elegant way to modify the Nextnode list.
Refuse the mapping of Nextnode[] directly to Nodes[]. Make two arrays
and two integer variables instead of Nextnode[]:
        int NodeByInd[BIG_NUMBER_OF_NODES]; // Indexes in Nodes[]
        int NextlinkInd[BIG_NUMBER_OF_NODES]; // Points to next link in chain
        int OccupInd; // Index of first "occupied" link
        int FreeInd; // Index of first "free" link

NextlinkInd[] contains two chains, chain of occupied links which
corresponds to real nodes and a chain of free links. FreeInd and
OccupInd points to first free and occupied links accordingly.

Inserting link in chain of occupied links:
        newfreeind = NextlinkInd[FreeInd];
        NextlinkInd[FreeInd] = OccupInd;
        OccupInd = FreeInd;
        FreeInd = newfreeind;

So the next node pointer gives like
        noind = NextlinkInd[noind];
        no = NodeByInd[noind];
        nop = &Nodes[no];

> something like the
> opposite than the force_add_star_to_tree() does.

This routine is absent in public version of gadget2 (in two weeks old
version).

> of course you know all that, this was just (1) to make the readers that
> don't have the knowledge to gain it and (2) to make discussion more
> focused so that the readers that have the knowledge can quickly correct me.
Received on 2005-05-17 14:42:42

This archive was generated by hypermail 2.3.0 : 2023-01-10 10:01:30 CET