Closed moeyensj closed 1 year ago
We could also use the BWARD argument to replace the while-loop with a for-loop (see https://github.com/matthewholman/assist/blob/main/src/spk.c#L137) but I suspect that will have a negligible impact on performance
Cool! Thank you. I have to admit, I don't understand what's going on with the offset? Was there a bug before?
There wasn't a bug before! I was just trying to test that the direct seek was working and that it had an effect on the test case, so I intentionally set the record number to be incorrect and then reran the test hoping to see different results. To be clear, as far as I can tell this PR correctly reads the development ephemeris and it matches the test case when compared to the code on the main branch.
It's definitely a weird way to do things but I wasn't sure how best to test the changes.
Ok. Got it! Thanks. Well, I think this is safe to merge in then. I don't see any downside. Are you ok with this too, @matthewholman?
This sounds good to me. Many thanks, @moeyensj !
Hi Hanno and Matt,
I don't know if its particularly helpful but DAF files have a specific attribute that indicates where the first summary record starts. This PR removes the while loop in
spk.c
in favor of a direct seek to the location of the first summary record using the FWARD attribute (https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/req/daf.html#The%20File%20Record).I've tested this with the example in
assist/examples/asteroid
and get the same results. An off-by-one error in the interpretation of the location of the first record yields different state vectors and an error.Results of example propagation using code on "main":
Results with this PR:
Results with intentional off-by-one error: