-
Notifications
You must be signed in to change notification settings - Fork 105
Description
In #1432, I'm adding unit tests that require reading a parameter file. Initially I made this happen at the beginning of each unit test in my test file, but that failed after the first test with "already allocated" errors on parameter-related arrays. Parameters registered with fates_parameters_type have no such problem because of its Destroy() method, but other parameters fail.
The first offending array was hydr_htftype_node in EDParamsMod (why isn't this on fates_parameters_type?), so I added a subroutine there to deallocate it.
Next I ran into a bigger problem: prt_param_type has a ton of arrays but no Destroy() method—or indeed, any method. Here are some ways I thought to resolve this:
- Add a
Destroy()method toprt_param_typewith adeallocate()for every parameter array. This is a bad idea because it means the unit tests would break every time a parameter array is added or removed. - Add a
Destroy()method toprt_param_typemodeled after that infates_parameters_type, which would require adding a bunch of other analogous methods. I don't love all the duplication in this solution. - Delete
prt_param_type; move all parameters inprt_param_typeto thefates_paramsobject (typefates_parameters_type). There may be a good reason to keep the PARTEH parameters on a separate object, though; I see that @rgknox did it as part of PR Nutrient Enabled Aquisition (parteh pt 3) #598 but I don't know why. - Delete
prt_param_type; make theprt_paramsobject just another instance offates_parameters_type.
I like 4 since it avoids duplicating the infrastructure code while still allowing PARTEH parameters to remain separate from the other FATES parameters.
For now, I'm working around this by just reading the parameter file once. However, I can imagine eventual unit tests that would want to perform multiple reads in the same test file—thus this issue.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status