yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #16271
Re: [Question #660861]: Length of O.bodies after erasing a body
Question #660861 on Yade changed:
https://answers.launchpad.net/yade/+question/660861
Jan Stránský posted a new comment:
Hi Nishant,
> Is there a particular reason that the simulation continues with empty
body fields?
There are several reasons, e.g.:
1) performacne. O.bodies is internally std::vector, which is "cheap" for access by index, looping and appending to the end. It is "expensive" for "hard deleting" items from the middle, therefore the deleted item is just set to None/nullptr.
2) as a consequence of current behavior, O.bodies[b.id] is always b, which some YADE internals depends on and which would not be true with "renumbering"
cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.