Commit e868dfb2 authored by Matthieu Schaller's avatar Matthieu Schaller

Make the QLA and COLIBRE cooling record the table memory usage

parent 0d2f9f4e
...@@ -1275,21 +1275,21 @@ void cooling_clean(struct cooling_function_data *cooling) { ...@@ -1275,21 +1275,21 @@ void cooling_clean(struct cooling_function_data *cooling) {
free(cooling->MassFractions); free(cooling->MassFractions);
/* Free the tables */ /* Free the tables */
free(cooling->table.Tcooling); swift_free("cooling_table.Tcooling", cooling->table.Tcooling);
free(cooling->table.Ucooling); swift_free("cooling_table.Ucooling", cooling->table.Ucooling);
free(cooling->table.Theating); swift_free("cooling_table.Theating", cooling->table.Theating);
free(cooling->table.Uheating); swift_free("cooling_table.Uheating", cooling->table.Uheating);
free(cooling->table.Telectron_fraction); swift_free("cooling_table.Tefrac", cooling->table.Telectron_fraction);
free(cooling->table.Uelectron_fraction); swift_free("cooling_table.Uefrac", cooling->table.Uelectron_fraction);
free(cooling->table.T_from_U); swift_free("cooling_table.TfromU", cooling->table.T_from_U);
free(cooling->table.U_from_T); swift_free("cooling_table.UfromT", cooling->table.U_from_T);
free(cooling->table.Umu); swift_free("cooling_table.Umu", cooling->table.Umu);
free(cooling->table.Tmu); swift_free("cooling_table.Tmu", cooling->table.Tmu);
free(cooling->table.meanpartmass_Teq); swift_free("cooling_table.mueq", cooling->table.meanpartmass_Teq);
free(cooling->table.logHfracs_Teq); swift_free("cooling_table.Hfracs", cooling->table.logHfracs_Teq);
free(cooling->table.logHfracs_all); swift_free("cooling_table.Hfracs", cooling->table.logHfracs_all);
free(cooling->table.logTeq); swift_free("cooling_table.Teq", cooling->table.logTeq);
free(cooling->table.logPeq); swift_free("cooling_table.Peq", cooling->table.logPeq);
} }
/** /**
......
...@@ -249,7 +249,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -249,7 +249,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
/* Allocate and read arrays to store cooling tables. */ /* Allocate and read arrays to store cooling tables. */
/* Mean particle mass (temperature) */ /* Mean particle mass (temperature) */
if (posix_memalign((void **)&cooling->table.Tmu, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.Tmu", (void **)&cooling->table.Tmu,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_redshifts *
colibre_cooling_N_temperature * colibre_cooling_N_temperature *
colibre_cooling_N_metallicity * colibre_cooling_N_metallicity *
...@@ -264,7 +265,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -264,7 +265,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing mean particle mass dataset"); if (status < 0) error("error closing mean particle mass dataset");
/* Mean particle mass (internal energy) */ /* Mean particle mass (internal energy) */
if (posix_memalign((void **)&cooling->table.Umu, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.Umu", (void **)&cooling->table.Umu,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_redshifts *
colibre_cooling_N_internalenergy * colibre_cooling_N_internalenergy *
colibre_cooling_N_metallicity * colibre_cooling_N_metallicity *
...@@ -279,8 +281,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -279,8 +281,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing mean particle mass dataset"); if (status < 0) error("error closing mean particle mass dataset");
/* Cooling (temperature) */ /* Cooling (temperature) */
if (posix_memalign( if (swift_memalign(
(void **)&cooling->table.Tcooling, SWIFT_STRUCT_ALIGNMENT, "cooling_table.Tcooling", (void **)&cooling->table.Tcooling,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_temperature * colibre_cooling_N_redshifts * colibre_cooling_N_temperature *
colibre_cooling_N_metallicity * colibre_cooling_N_density * colibre_cooling_N_metallicity * colibre_cooling_N_density *
colibre_cooling_N_cooltypes * sizeof(float)) != 0) colibre_cooling_N_cooltypes * sizeof(float)) != 0)
...@@ -294,8 +297,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -294,8 +297,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Cooling (internal energy) */ /* Cooling (internal energy) */
if (posix_memalign( if (swift_memalign(
(void **)&cooling->table.Ucooling, SWIFT_STRUCT_ALIGNMENT, "cooling_table.Ucooling", (void **)&cooling->table.Ucooling,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_internalenergy * colibre_cooling_N_redshifts * colibre_cooling_N_internalenergy *
colibre_cooling_N_metallicity * colibre_cooling_N_density * colibre_cooling_N_metallicity * colibre_cooling_N_density *
colibre_cooling_N_cooltypes * sizeof(float)) != 0) colibre_cooling_N_cooltypes * sizeof(float)) != 0)
...@@ -309,8 +313,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -309,8 +313,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Heating (temperature) */ /* Heating (temperature) */
if (posix_memalign( if (swift_memalign(
(void **)&cooling->table.Theating, SWIFT_STRUCT_ALIGNMENT, "cooling_table.Theating", (void **)&cooling->table.Theating,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_temperature * colibre_cooling_N_redshifts * colibre_cooling_N_temperature *
colibre_cooling_N_metallicity * colibre_cooling_N_density * colibre_cooling_N_metallicity * colibre_cooling_N_density *
colibre_cooling_N_heattypes * sizeof(float)) != 0) colibre_cooling_N_heattypes * sizeof(float)) != 0)
...@@ -324,8 +329,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -324,8 +329,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Heating (internal energy) */ /* Heating (internal energy) */
if (posix_memalign( if (swift_memalign(
(void **)&cooling->table.Uheating, SWIFT_STRUCT_ALIGNMENT, "cooling_table.Uheating", (void **)&cooling->table.Uheating,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_internalenergy * colibre_cooling_N_redshifts * colibre_cooling_N_internalenergy *
colibre_cooling_N_metallicity * colibre_cooling_N_density * colibre_cooling_N_metallicity * colibre_cooling_N_density *
colibre_cooling_N_heattypes * sizeof(float)) != 0) colibre_cooling_N_heattypes * sizeof(float)) != 0)
...@@ -339,8 +345,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -339,8 +345,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Electron fraction (temperature) */ /* Electron fraction (temperature) */
if (posix_memalign( if (swift_memalign(
(void **)&cooling->table.Telectron_fraction, SWIFT_STRUCT_ALIGNMENT, "cooling_table.Tefrac", (void **)&cooling->table.Telectron_fraction,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_temperature * colibre_cooling_N_redshifts * colibre_cooling_N_temperature *
colibre_cooling_N_metallicity * colibre_cooling_N_density * colibre_cooling_N_metallicity * colibre_cooling_N_density *
colibre_cooling_N_electrontypes * sizeof(float)) != 0) colibre_cooling_N_electrontypes * sizeof(float)) != 0)
...@@ -354,8 +361,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -354,8 +361,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Electron fraction (internal energy) */ /* Electron fraction (internal energy) */
if (posix_memalign( if (swift_memalign(
(void **)&cooling->table.Uelectron_fraction, SWIFT_STRUCT_ALIGNMENT, "cooling_table.Uefrac", (void **)&cooling->table.Uelectron_fraction,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_internalenergy * colibre_cooling_N_redshifts * colibre_cooling_N_internalenergy *
colibre_cooling_N_metallicity * colibre_cooling_N_density * colibre_cooling_N_metallicity * colibre_cooling_N_density *
colibre_cooling_N_electrontypes * sizeof(float)) != 0) colibre_cooling_N_electrontypes * sizeof(float)) != 0)
...@@ -369,7 +377,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -369,7 +377,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Internal energy from temperature */ /* Internal energy from temperature */
if (posix_memalign((void **)&cooling->table.U_from_T, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.UfromT", (void **)&cooling->table.U_from_T,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_redshifts *
colibre_cooling_N_temperature * colibre_cooling_N_temperature *
colibre_cooling_N_metallicity * colibre_cooling_N_metallicity *
...@@ -384,7 +393,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -384,7 +393,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Temperature from interal energy */ /* Temperature from interal energy */
if (posix_memalign((void **)&cooling->table.T_from_U, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.TfromU", (void **)&cooling->table.T_from_U,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_redshifts *
colibre_cooling_N_internalenergy * colibre_cooling_N_internalenergy *
colibre_cooling_N_metallicity * colibre_cooling_N_metallicity *
...@@ -399,7 +409,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -399,7 +409,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Thermal equilibrium temperature */ /* Thermal equilibrium temperature */
if (posix_memalign((void **)&cooling->table.logTeq, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.Teq", (void **)&cooling->table.logTeq,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_redshifts *
colibre_cooling_N_metallicity * colibre_cooling_N_metallicity *
colibre_cooling_N_density * sizeof(float)) != 0) colibre_cooling_N_density * sizeof(float)) != 0)
...@@ -413,8 +424,10 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -413,8 +424,10 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing logTeq dataset"); if (status < 0) error("error closing logTeq dataset");
/* Mean particle mass at thermal equilibrium temperature */ /* Mean particle mass at thermal equilibrium temperature */
if (posix_memalign( if (swift_memalign(
(void **)&cooling->table.meanpartmass_Teq, SWIFT_STRUCT_ALIGNMENT, "cooling_table.mueq", (void **)&cooling->table.meanpartmass_Teq,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_metallicity * colibre_cooling_N_redshifts * colibre_cooling_N_metallicity *
colibre_cooling_N_density * sizeof(float)) != 0) colibre_cooling_N_density * sizeof(float)) != 0)
error("Failed to allocate mu array\n"); error("Failed to allocate mu array\n");
...@@ -427,8 +440,10 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -427,8 +440,10 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing mu dataset"); if (status < 0) error("error closing mu dataset");
/* Hydrogen fractions at thermal equilibirum temperature */ /* Hydrogen fractions at thermal equilibirum temperature */
if (posix_memalign( /* Hydrogen fractions at thermal equilibirum temperature */
(void **)&cooling->table.logHfracs_Teq, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign(
"cooling_table.Hfracs", (void **)&cooling->table.logHfracs_Teq,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_metallicity * colibre_cooling_N_redshifts * colibre_cooling_N_metallicity *
colibre_cooling_N_density * 3 * sizeof(float)) != 0) colibre_cooling_N_density * 3 * sizeof(float)) != 0)
error("Failed to allocate hydrogen fractions array\n"); error("Failed to allocate hydrogen fractions array\n");
...@@ -441,8 +456,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -441,8 +456,9 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing hydrogen fractions dataset"); if (status < 0) error("error closing hydrogen fractions dataset");
/* All hydrogen fractions */ /* All hydrogen fractions */
if (posix_memalign( if (swift_memalign(
(void **)&cooling->table.logHfracs_all, SWIFT_STRUCT_ALIGNMENT, "cooling_table.Hfracs", (void **)&cooling->table.logHfracs_all,
SWIFT_STRUCT_ALIGNMENT,
colibre_cooling_N_redshifts * colibre_cooling_N_temperature * colibre_cooling_N_redshifts * colibre_cooling_N_temperature *
colibre_cooling_N_metallicity * colibre_cooling_N_density * 3 * colibre_cooling_N_metallicity * colibre_cooling_N_density * 3 *
sizeof(float)) != 0) sizeof(float)) != 0)
......
...@@ -904,21 +904,21 @@ void cooling_clean(struct cooling_function_data *cooling) { ...@@ -904,21 +904,21 @@ void cooling_clean(struct cooling_function_data *cooling) {
free(cooling->MassFractions); free(cooling->MassFractions);
/* Free the tables */ /* Free the tables */
free(cooling->table.Tcooling); swift_free("cooling_table.Tcooling", cooling->table.Tcooling);
free(cooling->table.Ucooling); swift_free("cooling_table.Ucooling", cooling->table.Ucooling);
free(cooling->table.Theating); swift_free("cooling_table.Theating", cooling->table.Theating);
free(cooling->table.Uheating); swift_free("cooling_table.Uheating", cooling->table.Uheating);
free(cooling->table.Telectron_fraction); swift_free("cooling_table.Tefrac", cooling->table.Telectron_fraction);
free(cooling->table.Uelectron_fraction); swift_free("cooling_table.Uefrac", cooling->table.Uelectron_fraction);
free(cooling->table.T_from_U); swift_free("cooling_table.TfromU", cooling->table.T_from_U);
free(cooling->table.U_from_T); swift_free("cooling_table.UfromT", cooling->table.U_from_T);
free(cooling->table.Umu); swift_free("cooling_table.Umu", cooling->table.Umu);
free(cooling->table.Tmu); swift_free("cooling_table.Tmu", cooling->table.Tmu);
free(cooling->table.meanpartmass_Teq); swift_free("cooling_table.mueq", cooling->table.meanpartmass_Teq);
free(cooling->table.logHfracs_Teq); swift_free("cooling_table.Hfracs", cooling->table.logHfracs_Teq);
free(cooling->table.logHfracs_all); swift_free("cooling_table.Hfracs", cooling->table.logHfracs_all);
free(cooling->table.logTeq); swift_free("cooling_table.Teq", cooling->table.logTeq);
free(cooling->table.logPeq); swift_free("cooling_table.Peq", cooling->table.logPeq);
} }
/** /**
......
...@@ -249,7 +249,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -249,7 +249,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
/* Allocate and read arrays to store cooling tables. */ /* Allocate and read arrays to store cooling tables. */
/* Mean particle mass (temperature) */ /* Mean particle mass (temperature) */
if (posix_memalign((void **)&cooling->table.Tmu, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.Tmu", (void **)&cooling->table.Tmu,
SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_temperature * qla_cooling_N_redshifts * qla_cooling_N_temperature *
qla_cooling_N_metallicity * qla_cooling_N_density * qla_cooling_N_metallicity * qla_cooling_N_density *
sizeof(float)) != 0) sizeof(float)) != 0)
...@@ -263,7 +264,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -263,7 +264,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing mean particle mass dataset"); if (status < 0) error("error closing mean particle mass dataset");
/* Mean particle mass (internal energy) */ /* Mean particle mass (internal energy) */
if (posix_memalign((void **)&cooling->table.Umu, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.Umu", (void **)&cooling->table.Umu,
SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_internalenergy * qla_cooling_N_redshifts * qla_cooling_N_internalenergy *
qla_cooling_N_metallicity * qla_cooling_N_density * qla_cooling_N_metallicity * qla_cooling_N_density *
sizeof(float)) != 0) sizeof(float)) != 0)
...@@ -277,7 +279,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -277,7 +279,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing mean particle mass dataset"); if (status < 0) error("error closing mean particle mass dataset");
/* Cooling (temperature) */ /* Cooling (temperature) */
if (posix_memalign((void **)&cooling->table.Tcooling, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.Tcooling",
(void **)&cooling->table.Tcooling, SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_temperature * qla_cooling_N_redshifts * qla_cooling_N_temperature *
qla_cooling_N_metallicity * qla_cooling_N_density * qla_cooling_N_metallicity * qla_cooling_N_density *
qla_cooling_N_cooltypes * sizeof(float)) != 0) qla_cooling_N_cooltypes * sizeof(float)) != 0)
...@@ -291,7 +294,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -291,7 +294,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Cooling (internal energy) */ /* Cooling (internal energy) */
if (posix_memalign((void **)&cooling->table.Ucooling, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.Ucooling",
(void **)&cooling->table.Ucooling, SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_internalenergy * qla_cooling_N_redshifts * qla_cooling_N_internalenergy *
qla_cooling_N_metallicity * qla_cooling_N_density * qla_cooling_N_metallicity * qla_cooling_N_density *
qla_cooling_N_cooltypes * sizeof(float)) != 0) qla_cooling_N_cooltypes * sizeof(float)) != 0)
...@@ -305,7 +309,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -305,7 +309,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Heating (temperature) */ /* Heating (temperature) */
if (posix_memalign((void **)&cooling->table.Theating, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.Theating",
(void **)&cooling->table.Theating, SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_temperature * qla_cooling_N_redshifts * qla_cooling_N_temperature *
qla_cooling_N_metallicity * qla_cooling_N_density * qla_cooling_N_metallicity * qla_cooling_N_density *
qla_cooling_N_heattypes * sizeof(float)) != 0) qla_cooling_N_heattypes * sizeof(float)) != 0)
...@@ -319,7 +324,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -319,7 +324,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Heating (internal energy) */ /* Heating (internal energy) */
if (posix_memalign((void **)&cooling->table.Uheating, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.Uheating",
(void **)&cooling->table.Uheating, SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_internalenergy * qla_cooling_N_redshifts * qla_cooling_N_internalenergy *
qla_cooling_N_metallicity * qla_cooling_N_density * qla_cooling_N_metallicity * qla_cooling_N_density *
qla_cooling_N_heattypes * sizeof(float)) != 0) qla_cooling_N_heattypes * sizeof(float)) != 0)
...@@ -333,7 +339,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -333,7 +339,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Electron fraction (temperature) */ /* Electron fraction (temperature) */
if (posix_memalign((void **)&cooling->table.Telectron_fraction, if (swift_memalign("cooling_table.Tefrac",
(void **)&cooling->table.Telectron_fraction,
SWIFT_STRUCT_ALIGNMENT, SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_temperature * qla_cooling_N_redshifts * qla_cooling_N_temperature *
qla_cooling_N_metallicity * qla_cooling_N_density * qla_cooling_N_metallicity * qla_cooling_N_density *
...@@ -348,7 +355,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -348,7 +355,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Electron fraction (internal energy) */ /* Electron fraction (internal energy) */
if (posix_memalign((void **)&cooling->table.Uelectron_fraction, if (swift_memalign("cooling_table.Uefrac",
(void **)&cooling->table.Uelectron_fraction,
SWIFT_STRUCT_ALIGNMENT, SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_internalenergy * qla_cooling_N_redshifts * qla_cooling_N_internalenergy *
qla_cooling_N_metallicity * qla_cooling_N_density * qla_cooling_N_metallicity * qla_cooling_N_density *
...@@ -363,7 +371,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -363,7 +371,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Internal energy from temperature */ /* Internal energy from temperature */
if (posix_memalign((void **)&cooling->table.U_from_T, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.UfromT", (void **)&cooling->table.U_from_T,
SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_temperature * qla_cooling_N_redshifts * qla_cooling_N_temperature *
qla_cooling_N_metallicity * qla_cooling_N_density * qla_cooling_N_metallicity * qla_cooling_N_density *
sizeof(float)) != 0) sizeof(float)) != 0)
...@@ -377,7 +386,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -377,7 +386,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Temperature from interal energy */ /* Temperature from interal energy */
if (posix_memalign((void **)&cooling->table.T_from_U, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.TfromU", (void **)&cooling->table.T_from_U,
SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_internalenergy * qla_cooling_N_redshifts * qla_cooling_N_internalenergy *
qla_cooling_N_metallicity * qla_cooling_N_density * qla_cooling_N_metallicity * qla_cooling_N_density *
sizeof(float)) != 0) sizeof(float)) != 0)
...@@ -391,7 +401,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -391,7 +401,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing cooling dataset"); if (status < 0) error("error closing cooling dataset");
/* Thermal equilibrium temperature */ /* Thermal equilibrium temperature */
if (posix_memalign((void **)&cooling->table.logTeq, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.Teq", (void **)&cooling->table.logTeq,
SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_metallicity * qla_cooling_N_redshifts * qla_cooling_N_metallicity *
qla_cooling_N_density * sizeof(float)) != 0) qla_cooling_N_density * sizeof(float)) != 0)
error("Failed to allocate logTeq array\n"); error("Failed to allocate logTeq array\n");
...@@ -404,7 +415,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -404,7 +415,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing logTeq dataset"); if (status < 0) error("error closing logTeq dataset");
/* Mean particle mass at thermal equilibrium temperature */ /* Mean particle mass at thermal equilibrium temperature */
if (posix_memalign((void **)&cooling->table.meanpartmass_Teq, if (swift_memalign("cooling_table.mueq",
(void **)&cooling->table.meanpartmass_Teq,
SWIFT_STRUCT_ALIGNMENT, SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_metallicity * qla_cooling_N_redshifts * qla_cooling_N_metallicity *
qla_cooling_N_density * sizeof(float)) != 0) qla_cooling_N_density * sizeof(float)) != 0)
...@@ -418,7 +430,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -418,7 +430,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing mu dataset"); if (status < 0) error("error closing mu dataset");
/* Hydrogen fractions at thermal equilibirum temperature */ /* Hydrogen fractions at thermal equilibirum temperature */
if (posix_memalign((void **)&cooling->table.logHfracs_Teq, if (swift_memalign("cooling_table.Hfracs",
(void **)&cooling->table.logHfracs_Teq,
SWIFT_STRUCT_ALIGNMENT, SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_metallicity * qla_cooling_N_redshifts * qla_cooling_N_metallicity *
qla_cooling_N_density * 3 * sizeof(float)) != 0) qla_cooling_N_density * 3 * sizeof(float)) != 0)
...@@ -432,7 +445,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -432,7 +445,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
if (status < 0) error("error closing hydrogen fractions dataset"); if (status < 0) error("error closing hydrogen fractions dataset");
/* All hydrogen fractions */ /* All hydrogen fractions */
if (posix_memalign((void **)&cooling->table.logHfracs_all, if (swift_memalign("cooling_table.Hfracs",
(void **)&cooling->table.logHfracs_all,
SWIFT_STRUCT_ALIGNMENT, SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_temperature * qla_cooling_N_redshifts * qla_cooling_N_temperature *
qla_cooling_N_metallicity * qla_cooling_N_density * 3 * qla_cooling_N_metallicity * qla_cooling_N_density * 3 *
...@@ -450,7 +464,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) { ...@@ -450,7 +464,8 @@ void read_cooling_tables(struct cooling_function_data *restrict cooling) {
H5Fclose(tempfile_id); H5Fclose(tempfile_id);
/* Pressure at thermal equilibrium temperature */ /* Pressure at thermal equilibrium temperature */
if (posix_memalign((void **)&cooling->table.logPeq, SWIFT_STRUCT_ALIGNMENT, if (swift_memalign("cooling_table.Peq", (void **)&cooling->table.logPeq,
SWIFT_STRUCT_ALIGNMENT,
qla_cooling_N_redshifts * qla_cooling_N_metallicity * qla_cooling_N_redshifts * qla_cooling_N_metallicity *
qla_cooling_N_density * sizeof(float)) != 0) qla_cooling_N_density * sizeof(float)) != 0)
error("Failed to allocate logPeq array\n"); error("Failed to allocate logPeq array\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment