PlasmaControl / DESC

Stellarator Equilibrium and Optimization Suite
MIT License
97 stars 26 forks source link

Have a single compute function register multiple variables #1171

Open unalmis opened 3 months ago

unalmis commented 3 months ago

Requested by @ddudt

Could be nice to generalize the register_compute_fun decorator for multiple names and multiple descriptions for compute functions that compute multiple stuff. My suggestion would be to check if name and description is a list and then loop through to register them in compute.utils/data_index.py.

Note that this would be a cosmetic change to remove duplicate code. We already ensure computation is not performed when something is already computed.

ddudt commented 3 months ago

This was not really resolved by #1166. We came up with a hack for the two cases that exist in the current code. Is that solution our plan going forward for all similar instances? Or do we still want to add special logic to handle this?