[newchem-cpp] lightly refactor calculate_temperature.c#382
Merged
brittonsmith merged 4 commits intoSep 12, 2025
Merged
Conversation
This slightly reorganizes a little logic (for reasons that will become clear in the next patch). I also replaced a bunch of uses of SUCCESS and FAIL with GR_SUCCESS and GR_FAIL
Manually inline ``local_calculate_temperature_table`` within ``local_calculate_temperature``. Thanks to recent work, this doesn't increase the size of the ``local_calculate_temperature`` function
Change occurences of max to fmax so we could eliminate the `include "grackle_macros.h"` directive
…cribe/calculate_temperature_tweaks
brittonsmith
approved these changes
Sep 12, 2025
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.
This was originally proposed as brittonsmith#36
This must be reviewed after #380 is merged.
This PR does some (largely superficial) refactoring of the
calculate_temperature.cfile.There were 3 commits:
SUCCESSandFAILwithGR_SUCCESSandGR_FAIL. I also slightly rearranged a little logic withinlocal_calculate_temperature(in preparation for the next commit)local_calculate_temperature_tablehelper function directly inside oflocal_calculate_temperature(this allowed me to deletelocal_calculate_temperature_table). For additional context:calc_temp_cloudy_gin PR Update linux-gnu make file for apt-get paths. #34, the definition oflocal_calculate_temperature_tablegot a lot shorter. With those changes,local_calculate_temperature_tableperformed an error-check thatprimordial_chemistry==0and simply called `calc_temp_cloudy_glocal_calculate_temperatureonly calledlocal_calculate_temperature_tablewhenprimordial_chemistry==0, inlining the definition oflocal_calculate_temperature_tablewithinlocal_calculate_temperaturelet us eliminate all associated error-handling logiclocal_calculate_temperature(or make the logic any harder to follow). At the same time, it allowed us to remove all of the lines of code where we had previously declared/definedlocal_calculate_temperature_tablemaxmacro with C'sfmaxfunction. At this point, I was able to remove theinclude "grackle_macros.h"line