← Back to team overview

yade-users team mailing list archive

[Question #660861]: Length of O.bodies after erasing a body

 

New question #660861 on Yade:
https://answers.launchpad.net/yade/+question/660861

Hi,

I am learning Yade and I have an issue with erase function. This erases the body and the corresponding interactions, as discussed here https://answers.launchpad.net/yade/+question/216109 

However, the length of bodies remain the same. Sample example below:

O.bodies.append([sphere((0.0,0,0.0),1)])
O.bodies.append([sphere((0.0,0,2.0),1)])
len(O.bodies)

This gives 2 as answer.

But next I want to erase one of them: 

O.bodies.erase(1)
len(O.bodies)

This again gives two and counts the  non-existent bodies, but should give 1, no? 

A way to solve this was described here: https://answers.launchpad.net/yade/+question/258987
But, I am interested in applying a constant strain field to some bodies and looping over len(O.bodies) would create problems. 

Would be nice if experts shed some light.
Thanks,

Nishant





-- 
You received this question notification because your team yade-users is
an answer contact for Yade.