|
From: | James Crotinger |
Subject: | RE: [pooma-dev] RE: an attempt at your particle BC |
Date: | Tue, 3 Apr 2001 09:54:19 -0700 |
Actually, I think destroy will take quite a variety of domain representations. For example, it will take a pair of iterators into a list:
(from Engine/tests/dynamic_test2.cpp)
int kill_array[8] = {0, 1, 5, 6, 7, 14, 18, 19};
C.destroy(kill_array, kill_array+8, BackFill());
It will also take our regular domain objects. IndirectionList is used internally (for its shallow copy semantics, I think), but I do not recommend that users use it - it really wasn't designed to be an all-purpose user-friendly class. (It is easy to get bitten by its shallow copy semantics, IMHO). I guess I'd tend to use a std::vector for these things, but I'd have to see the real application to understand if that is correct.
Jim
---------------------------------------------------
James A. Crotinger
Software Research Scientist
Proximation, LLC
-----Original Message-----
From: Steve Nolen [mailto:address@hidden]
Sent: Tuesday, April 03, 2001 10:41 AM
To: address@hidden
Cc: Pooma
Subject: [pooma-dev] RE: an attempt at your particle BC
it would be nice if one of the destroy or sync functions accepted a list or
vector of integers denoting which particles to destroy. the conversion to
an IndirectionList (or even a DynamicArray for this matter) is just a little
too much pooma for the casual user.
> -----Original Message-----
> From: Julian C. Cummings [mailto:address@hidden]
> Sent: Monday, April 02, 2001 6:26 PM
> To: Steve Nolen
> Subject: RE: an attempt at your particle BC
>
<snip>
>
> To assign a particle to the destroy list, use the
> deferredDestroy() method. The first argument is a
> Domain describing the particle(s) to be added to
> the list, and the second is a local patch id number
> (if this is a local particle destroy). For a single
> particle, the Domain will be an int or a Loc<1>
> containing the local index number of the particle,
> and the patchID says which local patch has this
> particle. Particles on the destroy list are not
> destroyed until you call performDestroy() (or it gets
> called by the sync() method).
>
> If you are going to do this repeatedly, you might want
> to create your own temporary destroy list. Create a
> DynamicArray of ints to store the indices of local
> particles to be destroyed on a particular local patch.
> Call the create() method to add a new element for each
> particle to be destroyed. Then assign the local index
> number of the particle to that element in your destroy
> list. Once your destroy list is complete, you must
> convert it into an IndirectionList<int>. The destroy
> functions only accept domain types as descriptors of
> the set of particles to be destroyed, so you must use
> the IndirectionList here. IndirectionList has a
> constructor which takes a 1D Array as its argument.
> Now you can call either deferredDestroy (to destroy
> later on) or destroy (to do it now) and pass it the
> IndirectionList and the local patchID.
>
> DynamicArray<int> kill;
> kill.create(1);
> kill(0) = i; // add particle i to list
> IndirectionList<int> klist(kill);
> Neutrons.destroy(klist,patch); // destroy particles in klist on patch
>
>
[Prev in Thread] | Current Thread | [Next in Thread] |