Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
693c7ef
Remove duplicated declarations from initialize_chemistry_data.c
mabruzzo Aug 22, 2025
a7d20df
introduce initialize_UVbackground_data.h
mabruzzo Aug 22, 2025
3b3beb1
introduce initialize_rates.h
mabruzzo Aug 22, 2025
34e5a22
introduce initialize_cloudy_data.h
mabruzzo Aug 22, 2025
7037d3a
rename _free_cloudy_data -> free_cloudy_data
mabruzzo Aug 26, 2025
f1b18cd
introduce auto_general.h
mabruzzo Aug 26, 2025
1922d96
formatting other headers
mabruzzo Aug 26, 2025
22ae9db
make initialize_*.h headers compatible with C++
mabruzzo Aug 27, 2025
d9a58be
introduce initialize_(metal_chemistry_rates|dust_yields).h
mabruzzo Aug 27, 2025
b9d4e62
Make src/clib/Makefile compatible with .cpp files
mabruzzo Aug 28, 2025
c97f94a
Make src/clib/Makefile compatible with .cpp files
mabruzzo Aug 28, 2025
0f6ab18
rename src/clib/{cool_multi_time_g-cpp.C -> cool_multi_time_g.cpp}
mabruzzo Aug 28, 2025
9a59a40
start formatting src/clib/cool_multi_time_g.h
mabruzzo Aug 28, 2025
f507c46
rename internal_types.C -> internal_types.cpp
mabruzzo Aug 28, 2025
c600186
rename src/clib/{solve_rate_cool_g-cpp.C -> solve_rate_cool_g-cpp.cpp}
mabruzzo Aug 28, 2025
b41731b
start formatting src/clib/solve_rate_cool_g-cpp.h
mabruzzo Aug 28, 2025
6dbbe2b
rename src/clib/{utils-cpp.C -> utils-cpp.cpp}
mabruzzo Aug 28, 2025
69cd375
Convert initialize_chemistry_data.c to C++
mabruzzo Aug 28, 2025
1fdd121
convert initialize_rates.c to C++
mabruzzo Aug 28, 2025
f8fbc1f
Move initialize_rates function into `grackle::impl` namespace
mabruzzo Aug 28, 2025
9c99bf9
convert initialize_metal_chemistry_rates.c to C++
mabruzzo Aug 28, 2025
c2c1a5d
convert initialize_dust_yields.c to C++
mabruzzo Aug 29, 2025
ce09d23
introduce internalu and delete local co_length_units & co_density_units
mabruzzo Aug 29, 2025
7413415
eliminate uxyz and urho local variables (and start using internalu.a_…
mabruzzo Aug 29, 2025
fdbe05e
Replace utim, dbase1, xbase1, tbase1 with internalu
mabruzzo Aug 29, 2025
6e930d3
cleanup usage of dlogtem, temstart, and temend
mabruzzo Aug 29, 2025
aa69e2a
remove the temstart, temend, and nratec local variables (we now read …
mabruzzo Aug 29, 2025
6b2b5c7
remove the remaining forward declarations of local variables in grack…
mabruzzo Aug 29, 2025
7359182
mv and reformat comment listing all collisional rxn rates
mabruzzo Aug 29, 2025
4f1218d
make a few tweaks so we can make better use of InternalGrUnits within…
mabruzzo Aug 29, 2025
43cd8dc
add internalu_calc_kunit_ and update InternalGrUnits docstrings
mabruzzo Aug 30, 2025
91b9584
get kunit & coolunit from internalu in initialize_metal_chemistry_rates
mabruzzo Aug 30, 2025
04abba4
factor out add_cieY06_cool_rate
mabruzzo Aug 30, 2025
2f46685
convert rate_utils.c to C++
mabruzzo Aug 30, 2025
a0aff26
adjust boilerplate in rate_utils.cpp to support doxygen
mabruzzo Aug 30, 2025
ccb54f2
fix a minor oversight identified by CI
mabruzzo Aug 30, 2025
15ebedf
Merge branch 'ncc-rate_utils_cpp' into ncc-opaque-storage
mabruzzo Aug 30, 2025
655f32d
introduce opaque_storage
mabruzzo Aug 30, 2025
4a53fe4
lay more foundations for using gr_opaque_storage
mabruzzo Aug 30, 2025
93ec064
Factor out part of `add_reaction_rate`
mabruzzo Aug 31, 2025
c644c87
laying additional foundations (still haven't changed any behavior)
mabruzzo Aug 31, 2025
67aaeec
kcol_rate_tables now fully manages allocations of standard collision …
mabruzzo Aug 31, 2025
4d42409
remove now redundant code setting some initial rate values to tiny
mabruzzo Aug 31, 2025
d752275
Replace my_rates->kz?d+ in initialize_metal_chemistry_rates.cpp
mabruzzo Aug 31, 2025
5efadb8
a little cleanup of initialize_metal_chemistry_rates
mabruzzo Aug 31, 2025
eb95b7a
replace `CollisionalRxnRateKind_` with `CollisionalRxnLUT`
mabruzzo Aug 31, 2025
19adcf6
use kcol_rate_tables in rate_utils.cpp
mabruzzo Aug 31, 2025
715e246
use kcol_rate_tables in fortran_func_wrappers
mabruzzo Aug 31, 2025
6d392aa
Cull lots of references to my_rates->kz?\d+
mabruzzo Aug 31, 2025
539e9c4
Merge branch 'gen2024transcribe/lookup_cool_rates0d' into ncc-opaque-…
mabruzzo Sep 2, 2025
7c8c7b8
replace my_rates->(k13|k22) refs in calc_Heq_div_dHeqdt_
mabruzzo Sep 2, 2025
49af96a
remove kz\?\d+ members from grackle_chemistry_data
mabruzzo Sep 2, 2025
dfd9203
Create `init_extra_collisional_rates`
mabruzzo Sep 6, 2025
046e49e
initialize_metal_chemistry_rates -> init_misc_species_cool_rates
mabruzzo Sep 6, 2025
2a5a994
rename init_extra_collisional_rate_props -> init_extra_collisional_ra…
mabruzzo Sep 8, 2025
a29774e
tweak rate_fn declarations in collisional_rate_props.cpp
mabruzzo Sep 8, 2025
5429d1c
prepare init_kcol_rate_tables
mabruzzo Sep 9, 2025
5ef3ba6
nominally start using init_kcol_rate_tables
mabruzzo Sep 9, 2025
79e1052
some miscellaneous cleanup
mabruzzo Sep 9, 2025
ef7c659
apply clang-format
mabruzzo Sep 9, 2025
2b861a5
some final cleanup
mabruzzo Sep 9, 2025
aadb993
Merge branch 'newchem-cpp' into ncc-opaque-storage
mabruzzo Sep 11, 2025
420786d
Merge branch 'ncc-opaque-storage' into cleanup-kcol_rate_tables_init
mabruzzo Sep 11, 2025
afddf12
Merge branch 'newchem-cpp' into ncc-change-suffixes
mabruzzo Sep 12, 2025
60b2e2d
rename calc_temp_cloudy_g-cpp.(C|h) -> calc_temp_cloudy_g.(cpp|h)
mabruzzo Sep 12, 2025
4a4ef71
Merge branch 'ncc-change-suffixes' into ncc-rate_utils_cpp
mabruzzo Sep 12, 2025
644bfef
Merge branch 'ncc-rate_utils_cpp' into ncc-opaque-storage
mabruzzo Sep 12, 2025
c8374bb
Merge branch 'ncc-opaque-storage' into cleanup-kcol_rate_tables_init
mabruzzo Sep 12, 2025
4ecbc00
Merge branch 'newchem-cpp' into ncc-change-suffixes
mabruzzo Sep 12, 2025
c41a113
rename calc_tdust_3d.{C->cpp} and tweak boilerplate
mabruzzo Sep 12, 2025
2188195
Merge branch 'ncc-change-suffixes' into ncc-rate_utils_cpp
mabruzzo Sep 12, 2025
a3e2716
Merge branch 'ncc-rate_utils_cpp' into ncc-opaque-storage
mabruzzo Sep 12, 2025
dca00d5
Merge branch 'ncc-opaque-storage' into cleanup-kcol_rate_tables_init
mabruzzo Sep 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# - No new files should be added to this list

src/clib/c_wrappers/wrap_interpolators_g.c
src/clib/calc_tdust_3d.C
src/clib/calc_tdust_3d.cpp
src/clib/calculate_cooling_time.c
src/clib/calculate_dust_temperature.c
src/clib/calculate_gamma.c
Expand All @@ -20,8 +20,7 @@ src/clib/chemistry_solver_funcs.hpp
src/clib/cie_thin_cooling_rate_tables.h
src/clib/cool1d_multi_g-cpp.C
src/clib/cool1d_multi_g-cpp.h
src/clib/cool_multi_time_g-cpp.C
src/clib/cool_multi_time_g-cpp.h
src/clib/cool_multi_time_g.cpp
src/clib/dust_props.hpp
src/clib/dynamic_api.c
src/clib/fortran_func_decls.h
Expand All @@ -30,12 +29,12 @@ src/clib/grackle_macros.h
src/clib/grackle_units.c
src/clib/index_helper.c
src/clib/index_helper.h
src/clib/init_misc_species_cool_rates.cpp
src/clib/initialize_UVbackground_data.c
src/clib/initialize_chemistry_data.c
src/clib/initialize_chemistry_data.cpp
src/clib/initialize_cloudy_data.c
src/clib/initialize_dust_yields.c
src/clib/initialize_metal_chemistry_rates.c
src/clib/initialize_rates.c
src/clib/initialize_dust_yields.cpp
src/clib/initialize_rates.cpp
src/clib/internal_types.hpp
src/clib/internal_units.h
src/clib/interp_table_utils.h
Expand All @@ -44,14 +43,13 @@ src/clib/phys_constants.h
src/clib/rate_functions.c
src/clib/set_default_chemistry_parameters.c
src/clib/solve_chemistry.c
src/clib/solve_rate_cool_g-cpp.C
src/clib/solve_rate_cool_g-cpp.h
src/clib/solve_rate_cool_g-cpp.cpp
src/clib/status_reporting.c
src/clib/status_reporting.h
src/clib/step_rate_newton_raphson.hpp
src/clib/time_deriv_0d.hpp
src/clib/update_UVbackground_rates.c
src/clib/utils-cpp.C
src/clib/utils-cpp.cpp
src/clib/utils-cpp.hpp
src/clib/utils.c
src/clib/utils.h
Expand Down
30 changes: 17 additions & 13 deletions src/clib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,34 +90,38 @@ add_library(Grackle_Grackle
dynamic_api.c
grackle_units.c
index_helper.c
initialize_chemistry_data.c
initialize_cloudy_data.c
initialize_rates.c
initialize_UVbackground_data.c
initialize_cloudy_data.c initialize_cloudy_data.h
initialize_UVbackground_data.c initialize_UVbackground_data.h
rate_functions.c
set_default_chemistry_parameters.c
solve_chemistry.c
status_reporting.c status_reporting.h
update_UVbackground_rates.c
initialize_dust_yields.c
initialize_metal_chemistry_rates.c
rate_utils.c
utils.c

# auto-generated C source files
${CMAKE_CURRENT_BINARY_DIR}/auto_general.c
# here is the companion header file (not generated)
auto_general.h

# C++ Source (and Private Header Files)
calc_temp_cloudy_g-cpp.C calc_temp_cloudy_g-cpp.h
calc_tdust_3d.C calc_tdust_3d.h
cool_multi_time_g-cpp.C cool_multi_time_g-cpp.h
calc_tdust_3d.cpp calc_tdust_3d.h
calc_temp_cloudy_g.cpp calc_temp_cloudy_g.h
collisional_rate_props.cpp collisional_rate_props.hpp
cool_multi_time_g.cpp cool_multi_time_g.h
dust_props.hpp
internal_types.C internal_types.hpp
init_misc_species_cool_rates.cpp init_misc_species_cool_rates.hpp
initialize_chemistry_data.cpp
initialize_dust_yields.cpp initialize_dust_yields.hpp
initialize_rates.cpp initialize_rates.hpp
internal_types.cpp internal_types.hpp
opaque_storage.hpp
rate_utils.cpp
scale_fields.hpp
solve_rate_cool_g-cpp.C solve_rate_cool_g-cpp.h
solve_rate_cool_g-cpp.cpp solve_rate_cool_g-cpp.h
step_rate_newton_raphson.hpp
time_deriv_0d.hpp
utils-cpp.C utils-cpp.hpp
utils-cpp.cpp utils-cpp.hpp
utils-field.hpp
fortran_func_wrappers.hpp
visitor/common.hpp
Expand Down
5 changes: 5 additions & 0 deletions src/clib/LUT.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ struct OnlyGrainSpLUT {
}; // struct OnlyGrainSpLUT

/// Defines the LUT for Standard Collisional reaction rates
///
/// @note
/// If we ever make changes, we should consider how the changes will affect
/// `get_CollisionalRxn_rateprop_`. If necessary, we could always refactor
/// `get_CollisionalRxn_rateprop_` to not use this enum
struct CollisionalRxnLUT {
enum {
#define ENTRY(NAME) NAME,
Expand Down
7 changes: 4 additions & 3 deletions src/clib/Make.config.objects
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@ OBJS_CONFIG_LIB = \
calculate_pressure.lo \
calculate_temperature.lo \
calc_temp1d_cloudy_g.lo \
calc_temp_cloudy_g-cpp.lo \
calc_temp_cloudy_g.lo \
collisional_rate_props.lo \
cool1d_cloudy_g.lo \
cool1d_cloudy_old_tables_g.lo \
cool1d_multi_g.lo \
cool_multi_time_g-cpp.lo \
cool_multi_time_g.lo \
dynamic_api.lo \
grackle_units.lo \
index_helper.lo \
initialize_chemistry_data.lo \
initialize_cloudy_data.lo \
initialize_dust_yields.lo \
initialize_metal_chemistry_rates.lo \
init_misc_species_cool_rates.lo \
initialize_rates.lo \
initialize_UVbackground_data.lo \
interpolators_g.lo \
Expand Down
37 changes: 34 additions & 3 deletions src/clib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ verbose: VERBOSE = 1
# Implicit rules
#-----------------------------------------------------------------------

.SUFFIXES: .c .C .F .lo .o
.SUFFIXES: .c .cpp .C .F .lo .o

# Inhibit removing any *.o files after compiling

.PRECIOUS: %.o %.lo %.c %.C %.F
.PRECIOUS: %.o %.lo %.c %.cpp %.C %.F

.F.lo:
@rm -f $@
Expand All @@ -163,6 +163,37 @@ verbose: VERBOSE = 1
fi ; \
fi)

# Keep this synchronized with the .C.lo implicit rule
# -> the historic convention in the Grackle project was to use .C as the suffix
# for C++ source files. Thus, when we began transcribing files, we used the
# .C suffix (even though it is a less common choice than .cpp)
# -> however, it turns out that converting a file named `<prefix>.c` to
# `<prefix>.C` causes lots of issues performing Git operations when your
# machine has a case-insensitive file-system (common on macOS).
# -> consequently, we will be transitioning to the .cpp suffix
.cpp.lo:
@rm -f $@
@(if [ $(VERBOSE) -eq 0 ]; then \
echo "Compiling $<" ; \
$(LIBTOOL) --mode=compile --tag=CXX $(CXX) -c $(DEFINES) $(CXXFLAGS) $(INCLUDES) $*.cpp -o $@ \
>& $(OUTPUT) ; \
if [ ! -e $@ ]; then \
echo; \
echo "Compiling $< failed!"; \
echo "See $(OUTPUT) for error messages."; \
echo; \
exit 1; \
fi ; \
else \
$(LIBTOOL) --mode=compile --tag=CXX $(CXX) -c $(DEFINES) $(CXXFLAGS) $(INCLUDES) $*.cpp -o $@; \
if [ ! -e $@ ]; then \
exit 1; \
fi ; \
fi)

# Keep this synchronized with the .cpp.lo implicit rule. This is mostly for
# legacy purposes. We'll be transitioning to "just" .cpp.lo in the future.
# Justification for why we have both .cpp.lo AND .C.lo is provided up above
.C.lo:
@rm -f $@
@(if [ $(VERBOSE) -eq 0 ]; then \
Expand Down Expand Up @@ -251,7 +282,7 @@ clean_autogen:
.PHONY: dep
dep:
@echo "Updating DEPEND"
-@(makedepend $(DEFINES) $(INCLUDES) -a -fDEPEND -o.o -m -- -- *.C) >> out.make.DEPEND 2>&1
-@(makedepend $(DEFINES) $(INCLUDES) -a -fDEPEND -o.o -m -- -- *.cpp *.C) >> out.make.DEPEND 2>&1
-@(makedepend $(DEFINES) $(INCLUDES) -a -fDEPEND -o.o -m -- -- *.c) >> out.make.DEPEND 2>&1
-@(makedepend $(DEFINES) $(INCLUDES) -a -fDEPEND -o.o -m -- -- *.F) >> out.make.DEPEND 2>&1
-@(makedepend $(DEFINES) $(INCLUDES) -a -fDEPEND -o.o -m -- -- *.h) >> out.make.DEPEND 2>&1
Expand Down
1 change: 1 addition & 0 deletions src/clib/auto_general.c.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <stdio.h>
#include "grackle.h"
#include "auto_general.h"

grackle_version get_grackle_version(void) {
grackle_version out;
Expand Down
33 changes: 33 additions & 0 deletions src/clib/auto_general.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//===----------------------------------------------------------------------===//
//
// See the LICENSE file for license and copyright information
// SPDX-License-Identifier: NCSA AND BSD-3-Clause
//
//===----------------------------------------------------------------------===//
///
/// @file
/// Declares the general auto-generated functions
///
//===----------------------------------------------------------------------===//

#ifndef AUTO_GENERAL_H
#define AUTO_GENERAL_H

#include <stdio.h> // <- declares FILE
#include "grackle.h" // <- declares get_grackle_version

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/// writes compilation flags to `fp`
void auto_show_flags(FILE* fp);

/// writes configuration information to `fp`
void auto_show_config(FILE* fp);

#ifdef __cplusplus
} // extern "C"
#endif /* __cplusplus */

#endif /* AUTO_GENERAL_H */
15 changes: 11 additions & 4 deletions src/clib/calc_tdust_3d.C → src/clib/calc_tdust_3d.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
// See LICENSE file for license and copyright information

/// @file calc_tdust_3d.C
/// @brief Declares signature of calc_tdust_3d_g
//===----------------------------------------------------------------------===//
//
// See the LICENSE file for license and copyright information
// SPDX-License-Identifier: NCSA AND BSD-3-Clause
//
//===----------------------------------------------------------------------===//
///
/// @file
/// Implements the calc_tdust_3d_g function
///
//===----------------------------------------------------------------------===//

// This file was initially generated automatically during conversion of the
// calc_tdust_3d_g function from FORTRAN to C++
Expand Down
21 changes: 14 additions & 7 deletions src/clib/calc_tdust_3d.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
// See LICENSE file for license and copyright information

/// @file calc_tdust_3d.h
/// @brief Declares signature of calc_tdust_3d_g
//===----------------------------------------------------------------------===//
//
// See the LICENSE file for license and copyright information
// SPDX-License-Identifier: NCSA AND BSD-3-Clause
//
//===----------------------------------------------------------------------===//
///
/// @file
/// Declares signature of calc_tdust_3d_g
///
//===----------------------------------------------------------------------===//

// This file was initially generated automatically during conversion of the
// calc_tdust_3d_g function from FORTRAN to C++

#ifndef MY_FILE_CPP_H
#define MY_FILE_CPP_H
#ifndef CALC_TDUST_3D_H
#define CALC_TDUST_3D_H

#include "grackle.h" // gr_float
#include "internal_units.h"
Expand All @@ -30,4 +37,4 @@ void calc_tdust_3d_g(gr_float* gas_temp_data_, gr_float* dust_temp_data_,
} // extern "C"
#endif /* __cplusplus */

#endif /* MY_FILE_CPP_H */
#endif /* CALC_TDUST_3D_H */
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
// See LICENSE file for license and copyright information

/// @file calc_temp_cloudy_g-cpp.C
/// @brief Declares signature of calc_temp_cloudy_g
//===----------------------------------------------------------------------===//
//
// See the LICENSE file for license and copyright information
// SPDX-License-Identifier: NCSA AND BSD-3-Clause
//
//===----------------------------------------------------------------------===//
///
/// @file
/// Implements the calc_temp_cloudy_g function
///
//===----------------------------------------------------------------------===//

// This file was initially generated automatically during conversion of the
// calc_temp_cloudy_g function from FORTRAN to C++
Expand All @@ -16,7 +23,7 @@
#include "scale_fields.hpp"
#include "utils-cpp.hpp"

#include "calc_temp_cloudy_g-cpp.h"
#include "calc_temp_cloudy_g.h"

#ifdef __cplusplus
extern "C" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
// See LICENSE file for license and copyright information
//===----------------------------------------------------------------------===//
//
// See the LICENSE file for license and copyright information
// SPDX-License-Identifier: NCSA AND BSD-3-Clause
//
//===----------------------------------------------------------------------===//
///
/// @file
/// Declares the calc_temp_cloudy_g function
///
//===----------------------------------------------------------------------===//

/// @file calc_temp_cloudy_g-cpp.h
/// @brief Declares signature of calc_temp_cloudy_g

// This file was initially generated automatically during conversion of the
// calc_temp_cloudy_g function from FORTRAN to C++

#ifndef MY_FILE_CPP_H
#define MY_FILE_CPP_H
#ifndef CALC_TEMP_CLOUDY_G_H
#define CALC_TEMP_CLOUDY_G_H

#include "grackle.h" // gr_float
#include "internal_units.h"
Expand Down Expand Up @@ -42,4 +52,4 @@ void calc_temp_cloudy_g(gr_float* temperature_data_, int imetal,
} // extern "C"
#endif /* __cplusplus */

#endif /* MY_FILE_CPP_H */
#endif /* CALC_TEMP_CLOUDY_G_H */
2 changes: 1 addition & 1 deletion src/clib/calculate_cooling_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <math.h>
#include "grackle.h"
#include "grackle_macros.h"
#include "cool_multi_time_g-cpp.h"
#include "cool_multi_time_g.h"
#include "grackle_types.h"
#include "internal_units.h"
#include "phys_constants.h"
Expand Down
2 changes: 1 addition & 1 deletion src/clib/calculate_temperature.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "calc_temp_cloudy_g-cpp.h"
#include "calc_temp_cloudy_g.h"
#include "grackle.h"
#include "index_helper.h"
#include "internal_units.h"
Expand Down
Loading