-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Is your feature request related to a problem? Please describe.
This came from a PR's discussion: #841 (review). Rather than relying on self._problem.cells for a cell to update the number cache in cells we should make a self._collection. This has the benefit of being clear, and more reliable. There is no feasible situation where an object is not attached to a collection, but needs to update a collection's number cache.
Describe the solution you'd like
a weakref ala self._problem is created. Whenever an object is appended (via __internal_append?) this weakref is attached.
There is one case where we can't rely on the number cache: secondary collections, e.g., Cell.surfaces. In jit_parsing I am contemplating reworking this. Perhaps making these "shallow" pointers that just know which objects it owns, and relies on the primary collection for numbered look-ups, or just does an
Describe alternatives you've considered
- Status quo with the
$\mathcal{O}(N^2)$ penalty in edge cases.