Refactor logT precalculation#535
Open
mabruzzo wants to merge 71 commits into
Open
Conversation
This switches to using GRIMPL_NAMESPACE_DECL and puts all the helper function into the namespace
The result is definitely not bitwise identical, but that's not going to make tests fail (since the logic is not tested)
5ff8543 to
320c01a
Compare
…e pointers to consts
This commit makes my_chemistry, primordial_cloudy_data, my_fields into pointers to const values (rather than raw pointers)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
To be reviewed after #543 has been merged.
This PR refactors the calculations of
ln(T). It factors out all of the logic so that it is now performed by the newly createdLnTPreparerclass1. I don't actually think that it's an ideal abstraction, but I think it's a huge improvement over what we had. Before we try to come up with a better abstraction, I think we need to decide how to resolve a bunch of inconsistencies that are described in the docstring ofLnTPreparer(maybe that discussion should be moved to an issue?).Hoisting logic out of
cool1d_multi_gandlookup_cool_rates1dAs part of this PR, I pulled the logic pertaining to
LnTPreparerclass out ofcool1d_multi_gandlookup_cool_rates1d. This does 2 things: (i) we can stop passing iteration count tocool1d_multi_gand (ii) it paves the way for us to directly reuse the computed ln(T) values for bothcool1d_multi_gandlookup_cool_rates1d(note the values are still recomputed in this PR -- we start reusing values in PR #537).At a glance, the logic might look a little more complex. However, this complexity has always been present; I've just made it more explicit. I think this is definitely a step in the right direction.
Gold Standard
In any case, I tried to take a lot of care to avoid breaking the gold-standard. At the end something changed, and I don't totally understand why. It's a small enough change that I'm content to probably just update the gold-standard.
I have deferred a small handful of (related) changes to PR #537, where there will be a significant change in the gold-standard.
Footnotes
This was made as a slightly more traditional C++ class with a true constructor and attached methods to gauge how people feel about moving towards this sort of approach. I'm happy convert it to the more classic C-style logic on request. ↩