Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct design for producer/consumer in StateItemExtension #3264

Open
tclune opened this issue Dec 22, 2024 · 0 comments
Open

Correct design for producer/consumer in StateItemExtension #3264

tclune opened this issue Dec 22, 2024 · 0 comments
Assignees
Labels
0 Diff The changes in this pull request have verified to be zero-diff with the target branch. 📈 MAPL3 MAPL 3 Related 🛠️ Refactor This is code refactoring

Comments

@tclune
Copy link
Collaborator

tclune commented Dec 22, 2024

Currently extensions have an allocatable "producer" and a Map of pointers to "consumers". This is convenient because it allows the procedure that creates a new spec and a producer to immediately bind them into a new extension, but ultimately the ownership is wrong.

The main problem is that it import specs need to share the producer with the "ultimate" extension, and as an ALLOCATABLE they cannot share. But if we reverse the design, to have an extension have a map of (allocatable) consumers and only a pointer to the producer, this problem is fixed.

The fix will also allow a cleaner implementation for the loops that identify all import and export couplers for a given component:

  • import couplers are any producer components in the owned items
  • export couplers are any consumer components in the owned items.
@tclune tclune added 0 Diff The changes in this pull request have verified to be zero-diff with the target branch. 🛠️ Refactor This is code refactoring 📈 MAPL3 MAPL 3 Related labels Dec 22, 2024
@tclune tclune self-assigned this Dec 22, 2024
tclune added a commit that referenced this issue Dec 23, 2024
StateItemExtensions now own the consumers rather than the producers.
This change was motivated by the fact that imports and "final"
extensions need to share the producer, whereas consumers always
associated with a unique item - the one that generates the extension.

Various other interfaces needed to be updated. Primarily many
references to GriddedComponentDriver now need to be refrences to the
abstract parent: ComponentDriver, which is actually a good thing in
and of itself.
tclune added a commit that referenced this issue Dec 23, 2024
…consumer-swap

Feature/tclune/#3264 producer consumer swap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 Diff The changes in this pull request have verified to be zero-diff with the target branch. 📈 MAPL3 MAPL 3 Related 🛠️ Refactor This is code refactoring
Projects
None yet
Development

No branches or pull requests

1 participant