freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [pooma-dev] RE: an attempt at your particle BC


From: James Crotinger
Subject: RE: [pooma-dev] RE: an attempt at your particle BC
Date: Tue, 3 Apr 2001 13:42:30 -0700

How important is it to avoid making a copy of the "kill list"?
If we can ascertain (through specializations) that the iterators are equivalent to pointers into contiguous memory, we can probably construct an IndirectionList on the fly without copying the data (first construct a BrickEngine using the address of the first element and the length, then construct an Array, and then an IndirectionList). If these iterators were from something like an std::list, though, then this would not be possible. If this is the case, the easy way to write the code would be to copy the data, but that is almost certainly undesirable. The other way is to specialize the entire flow for a pair of iterators (in which case, doing something special for pointer-like ones probably buys you nothing). The problem with this is that DynamicEventType and DestroyEvent are templated on a domain. Possibly the easiest way to fix these would be to specialize them for std::pair<Iter,Iter>.

At any rate, I'm not going to get this done today.

        Jim

---------------------------------------------------
James A. Crotinger
Software Research Scientist
Proximation, LLC

 -----Original Message-----
From:   address@hidden [mailto:address@hidden]
Sent:   Tuesday, April 03, 2001 11:27 AM
To:     James Crotinger
Cc:     'Steve Nolen'; 'Pooma'
Subject:        Re: [pooma-dev] RE: an attempt at your particle BC

Gentlemen:

There's a problem here.  The interface that Jim cited,
describing a destroy list with a pair of iterators into
some list of indices, exists for DynamicEngine, but
*not* for DynamicArray (or Particles).  We need to
add this before Steve would be able to use this method.

I can take a crack at this late in the day today, unless
someone else has time to deal with it sooner.

-- Julian C.


James Crotinger wrote:

> Don't send vector<int> - it will think you're sending a "domain", which has a
> size() method.
> Instead, send a.begin() and a.end() where a is your vector<int>.
>
> Jim
>
> ---------------------------------------------------
>
> James A. Crotinger
>
> Software Research Scientist
>
> Proximation, LLC
>
> -----Original Message-----
> From: Steve Nolen [mailto:address@hidden]
> Sent: Tuesday, April 03, 2001 11:05 AM
> To: James Crotinger; address@hidden
> Cc: 'Pooma'
> Subject: RE: [pooma-dev] RE: an attempt at your particle BC
>
> i tried sending a vector<int> object but it (le compiler) complained about not
> having "domain[0].size()".
> -----Original Message-----
>
>
> From: James Crotinger [mailto:address@hidden]
> Sent: Tuesday, April 03, 2001 10:54 AM
> To: 'Steve Nolen'; 'address@hidden'
> Cc: 'Pooma'
> Subject: RE: [pooma-dev] RE: an attempt at your particle BC
>
> 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
> >
> >
>
--
Dr. Julian C. Cummings                       E-mail: address@hidden
California Institute of Technology           Phone:  626-395-2543
1200 E. California Blvd., Mail Code 158-79   Fax:    626-584-5917
Pasadena, CA 91125



reply via email to

[Prev in Thread] Current Thread [Next in Thread]