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

Re: [IMP-dev] deactivating particles



Daniel Russel wrote:
To make my previous email more concrete (and revise things slightly), deactivating particles would involve: - telling the Model to delete the particle. That removes the pointer in the model and frees the index up to be recycled - the ParticleIterators in the model skip delete particles (skip null pointers) - the particle is marked as invalid and any accesses to it throw exceptions - all pointers to the particle are reference counted and the particle object is deleted when all of them go away

This sounds reasonable to me. I agree that the most sensible way to do this properly is to have a reference counted Particle-pointer attribute for Particles. But don't worry too much about the reference counting in Python - I can look at that. However, I suggest rather than a single pointer attribute we use a vector<Particle pointer> attribute. This would certainly make things like hierarchies much easier to implement (plus, much faster, since you could just cache a 'child' ParticleVectorKey rather than having to do a lot of lookups for child1, child2, child3 etc.) Pointers to single particles are probably sufficiently unusual that the overhead of a single-element list is negligible.

	Ben
--
                      http://salilab.org/~ben/
"It is a capital mistake to theorize before one has data."
	- Sir Arthur Conan Doyle