Skip to content

Link objects to their NumberedObjectCollection Parent #849

@MicahGale

Description

@MicahGale

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 $\mathcal{O}(N)$ search.

Describe alternatives you've considered

  1. Status quo with the $\mathcal{O}(N^2)$ penalty in edge cases.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestAn issue that improves the user interface.performance 🐌Issues related to speed and memory

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions