Skip to content

Conversation

@ChristopherBignamini
Copy link
Contributor

No description provided.

@ChristopherBignamini ChristopherBignamini changed the title cool1d_cloudy_g grackle::impl::fortran_wrapper wrapper creation [newchem-cpp] transcribe of cool1d_cloudy_g Nov 18, 2025
@ChristopherBignamini
Copy link
Contributor Author

pre-commit.ci autofix

@ChristopherBignamini ChristopherBignamini marked this pull request as ready for review November 20, 2025 00:02
@ChristopherBignamini
Copy link
Contributor Author

pre-commit.ci autofix

@ChristopherBignamini
Copy link
Contributor Author

pre-commit.ci autofix

Comment on lines 27 to 32
const double* rhoH, const double* metallicity, const double* logtem,
double* edot, double comp2, double dom, double zr, int icmbTfloor,
int iClHeat, int iZscale, long long clGridRank, long long* clGridDim,
double* clPar1, double* clPar2, double* clPar3, long long* clDataSize,
double* clCooling, double* clHeating, const gr_mask_type* itmask,
grackle_field_data* my_fields, IndexRange idx_range) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you mind making a few simplifications to the signature.

Namely:

  • could you replace long long clGridRank, long long* clGridDim, double* clPar1, double* clPar2, double* clPar3, long long* clDataSize, double* clCooling, double* clHeating with a single argument of type cloudy_data?
    • importantly, cloudy_data already exists, and you are currently loading arguments from it right now
  • could you cut grackle_field_data* my_fields from the argument list?
    • AFAICT, we only use grackle_fields->grid_dimension[0] in this function and I'm pretty confident that in those places we can use idx_range->i_stop

Comment on lines 111 to 113
FORTRAN_NAME(interpolate_1d_g)(&log10tem[i], clGridDim, clPar1,
dclPar.data(), clDataSize, clCooling,
&log_cool[i]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind replacing all occurrences of FORTRAN_NAME(interpolate_...) with the C++ wrappers?

It's worth mentioning that the C++ function signature is slightly different. The most notable change is that the C++ wrapper directly returns the result (rather than modifying a pointer argument)

@ChristopherBignamini
Copy link
Contributor Author

pre-commit.ci autofix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants