[newchem-cpp] Transcribe interpolate routines
#384
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was previously proposed as brittonsmith#38
This should be reviewed after #383 is merged
This PR introduces C++ transcriptions of the
interpolatesubroutines and a series of rigorous tests for each routine (the tests show that the transcribed routines produce bitwise identical results to the original versions)This PR is a little unique among transcription PRs. Specifically, it has 2 properties that I would ordinarily consider to be grounds for rejecting a "transcription PR." However, this PR is somewhat special and we have strong justifications for both cases:
interpolators_g.Ffrom Fortran to C #160 and Modern Version Of: Transcribe contents of interpolators_g.F from Fortran to C #251 PRs. Those PRs manually introduced the transcribed versions of the logic in a very logical commit-by-commit manner. It would be a significant amount of work to retain that detailed commit-history (given how much the rest of the code has changed), so I decided to not to worry about (but it is available if it makes the review process easier)In any case, we also have the option of simply waiting to merge this PR until most Grackle is transcribed (this is why the C++ wrapper for the fortran routines has been split off into a separate PR).
Footnotes
In my experience, when I use my (transcription tool)[https://github.com/mabruzzo/grackle_transcribe], there aren't bugs in the original transcription from Fortran. Bugs occur when I manually transform the code (i.e. modify it look a little more like idiomatic C/C++) ↩
We could theoretically implement the C++ versions as functions with C-linkage and declare interfaces the allow the Fortran routines call the transcribed functions. This was proposed in the Transcribe contents of
interpolators_g.Ffrom Fortran to C #160 and Modern Version Of: Transcribe contents of interpolators_g.F from Fortran to C #251 PRs. But, doing this would require significant modification to the transcription tools. I just don't think it's worth doing. ↩Compared to other routines, there is much less urgency to reducing the size of the arglists (since they are relatively short). But more importantly, the pervasiveness of these routines is the main reason I don't think we should refactor until we have a full picture of all the contexts where they are used. I also think that there could be relevant performance considerations (e.g. see Tabulated-mode T Optimization ideas #212). In the short term, it could be helpful to write nice wrappers that reduce arg-lists. ↩