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

Saving of state in 2nd screen is inefficient and overly complicated #103

Open
jbphet opened this issue Feb 9, 2021 · 1 comment
Open

Comments

@jbphet
Copy link
Contributor

jbphet commented Feb 9, 2021

While working on #101, I found that that process of saving and restoring the state for the various atom configurations on the 2nd screen has some big problems. I unfortunately missed this when doing the code review on this portion of the sim. The problem is that when state has been stored for a given element and is later restored, the code in MixIsotopesModel.setState() first creates the buckets and adds an initial set of particles to them, and then removes all of the particles and buckets and restores the saved state using MixIsotopesModel.setState().

In its current form, the code functions correctly, but it is inefficient and confusing because it creates a bunch of things only to destroy them immediately and create other things instead. Also, I imagine that this would be quite problematic for phet-io when this sim is instrumented.

@jbphet
Copy link
Contributor Author

jbphet commented Feb 9, 2021

I tried a couple of quick fixes but didn't have much luck, so I think this will take a little time to hammer out. I'm going to leave it unassigned and it will act as a note to anyone who comes here to implement phet-io, essentially saying, "You'd better take care of this first.".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant