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

Refactor: Remove parent() and root() #997

Open
psakievich opened this issue Jul 13, 2022 · 2 comments
Open

Refactor: Remove parent() and root() #997

psakievich opened this issue Jul 13, 2022 · 2 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@psakievich
Copy link
Contributor

Nalu-Wind propagates a structure where objects contain pointers to their parent() and root() objects. This design makes it very difficult to unit test because it creates a object dependency chain from low level data structures to the highest level.

I propose we work to remove these and instead just add object references to the functions that actually use parent() and root() functions. From my initial review it looks like the number of uses of these functions is dwarfed by the number of objects that have them.

Creating this issue to allow others to weigh in and to track the PR's as I work to remove this design from nalu-wind.

@psakievich psakievich self-assigned this Jul 13, 2022
@psakievich psakievich added the help wanted Extra attention is needed label Jul 13, 2022
@sayerhs
Copy link
Contributor

sayerhs commented Jul 13, 2022

@psakievich this is a good idea. At the very least, we should prevent requiring parent/root at construction stage. To ease transition, may be provide registerParent or setParent method to inject hierarchy where necessary, so that things that depend on parent() root() can still work while code is being updated.

@psakievich
Copy link
Contributor Author

psakievich commented Jul 13, 2022

Thanks @sayerhs! This is an excellent suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants