Skip to content

Conversation

@timothy-nunn
Copy link
Contributor

@timothy-nunn timothy-nunn commented Sep 16, 2025

Extracts important information from the Jtor_universal class into a seperate dataclass for use as ._profiles. This removes the need to deepcopy the profile.

@timothy-nunn timothy-nunn marked this pull request as draft September 16, 2025 10:50
@nicamo
Copy link
Contributor

nicamo commented Sep 18, 2025

This is great @timothy-nunn! And you're right, limiter_handler is static and does not need to be updated. (I'll correct myself here if needed, but) I believe it's only the 'direct' attributes of profiles that actually need to be copied (e.g. the critical points .opt and .xpt, the plasma currents distribution .jtor, the defining parameters alpha beta etc -- the latter ones in case of evolutive solves only). It should be possible to just 'manually copy these across'

@timothy-nunn
Copy link
Contributor Author

timothy-nunn commented Sep 18, 2025

Hey @nicamo

I have updated this PR to an alternative idea where instead of deepcopying (and having to make deepcopy implementations) we have a data class of ProfileData (there is probably a better name) that stores the data needed in the _profiles attribute. This does not depend on dubious deepcopy implementations and is more explicit about what is being copied. It also has the added benefit that we significantly reduce the amount of stuff copied to only what is needed*.

*what is needed within the main code. There may be scripts I do not know of that this breaks.

@timothy-nunn timothy-nunn changed the title Implement __deepcopy__ for ConstrainPaxisIp Copy necessary data from Jtor_universal to avoid deepcopying the whole object Sep 19, 2025
@timothy-nunn
Copy link
Contributor Author

Closing because #43 implements this same fix in a better way, plus removes more deepcopies

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

Successfully merging this pull request may close these issues.

2 participants