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

Cache calls to calc_energy_electric and calc_energy_magnetic #124

Open
nikosavola opened this issue Jul 15, 2022 · 1 comment
Open

Cache calls to calc_energy_electric and calc_energy_magnetic #124

nikosavola opened this issue Jul 15, 2022 · 1 comment

Comments

@nikosavola
Copy link
Contributor

calc_energy_electric (and calc_energy_magnetic) are called in many places in DistributedAnalysis and currently you are supposed to transfer the result of these as a parameter like U_E and U_H to for example get_Qdielectric_all and get_Qseam_sweep.

It would make sense to instead just cache the values, as the inputs consist of simple strings, bools and ints. A simple lru_cache from the standard library almost works. I think this would fail only if the Ansys simulation is changed in a way that does not invalidate the simulation solution but would change the values of the computed fields. This might be a rare case, but still unwanted behaviour.

@nikosavola
Copy link
Contributor Author

If someone knows of a way to hash current state of Ansys or somehow check if the simulations were edited, this should be easy.

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