Skip to content

Finding and reducing function calls that pass in entire structs #139

@jhalpern30

Description

@jhalpern30

While we have removed global variables and replaced them with dedicated data structures throughout the code, as @logan-nc has pointed out, we often just pass in many of these structs into functions that modify data in-place, giving the same issue as the globals in the Fortran - it is not clear to a new user what is getting modified and where! I think there are a lot of improvements that can be done for this (and will probably get delegated to AI).

Some thoughts:

  1. Replace function calls that include the full data structures but only use one entry of it with just that entry. This should especially be done if its an update in place function and is only modifying one entry in the function.
  2. If functions are modifying more than one entry in a data struct, think through if it can be separated into multiple functions, such that 1. can be achieved
  3. We have the main data structures of ctrl, intr, equil, ffit, odet. During the hackathon, we made them all @kwdef mutable struct types. However, I think we don't need them all to be mutable. For example, I think ctrl should be instantiated from the input toml and then left alone completely - any modifications that are needed can be stored as copied within the mutable intr struct (e.g. psiedge, nn_low...). This way, users will know that ctrl will never appear as the first entry of a ! function. This could also be done with ffit

Open to other suggestions

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions