Commit bab13b8e authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

More unified chemistry i/o API between the main repository and the COLIBRE fork

parent bd6d2ffc
......@@ -57,7 +57,8 @@ INLINE static int chemistry_read_particles(struct part* parts,
*/
INLINE static int chemistry_write_particles(const struct part* parts,
const struct xpart* xparts,
struct io_props* list) {
struct io_props* list,
const int with_cosmology) {
/* List what we want to write */
list[0] = io_make_output_field(
......
......@@ -68,7 +68,8 @@ INLINE static void convert_gas_metals(const struct engine* e,
*/
INLINE static int chemistry_write_particles(const struct part* parts,
const struct xpart* xparts,
struct io_props* list) {
struct io_props* list,
const int with_cosmology) {
/* List what we want to write */
list[0] = io_make_output_field(
......
......@@ -49,7 +49,8 @@ INLINE static int chemistry_read_particles(struct part* parts,
*/
INLINE static int chemistry_write_particles(const struct part* parts,
const struct xpart* xparts,
struct io_props* list) {
struct io_props* list,
const int with_cosmology) {
/* update list according to hydro_io */
......
......@@ -49,7 +49,8 @@ INLINE static int chemistry_read_particles(struct part* parts,
*/
INLINE static int chemistry_write_particles(const struct part* parts,
const struct xpart* xparts,
struct io_props* list) {
struct io_props* list,
const int with_cosmology) {
/* update list according to hydro_io */
......
......@@ -2855,7 +2855,8 @@ int get_ptype_fields(const int ptype, struct io_props* list,
case swift_type_gas:
hydro_write_particles(NULL, NULL, list, &num_fields);
num_fields += chemistry_write_particles(NULL, NULL, list + num_fields);
num_fields += chemistry_write_particles(NULL, NULL, list + num_fields,
with_cosmology);
num_fields +=
cooling_write_particles(NULL, NULL, list + num_fields, NULL);
num_fields += tracers_write_particles(NULL, NULL, list + num_fields,
......
......@@ -498,8 +498,8 @@ void write_output_distributed(struct engine* e,
/* No inhibted particles: easy case */
Nparticles = Ngas;
hydro_write_particles(parts, xparts, list, &num_fields);
num_fields +=
chemistry_write_particles(parts, xparts, list + num_fields);
num_fields += chemistry_write_particles(
parts, xparts, list + num_fields, with_cosmology);
if (with_cooling || with_temperature) {
num_fields += cooling_write_particles(
parts, xparts, list + num_fields, e->cooling_func);
......@@ -538,8 +538,8 @@ void write_output_distributed(struct engine* e,
/* Select the fields to write */
hydro_write_particles(parts_written, xparts_written, list,
&num_fields);
num_fields += chemistry_write_particles(parts_written, xparts_written,
list + num_fields);
num_fields += chemistry_write_particles(
parts_written, xparts_written, list + num_fields, with_cosmology);
if (with_cooling || with_temperature) {
num_fields +=
cooling_write_particles(parts_written, xparts_written,
......
......@@ -438,7 +438,8 @@ void write_los_hdf5_datasets(hid_t grp, const int j, const size_t N,
/* Find all the gas output fields */
hydro_write_particles(parts, xparts, list, &num_fields);
num_fields += chemistry_write_particles(parts, xparts, list + num_fields);
num_fields += chemistry_write_particles(parts, xparts, list + num_fields,
with_cosmology);
if (with_cooling || with_temperature) {
num_fields += cooling_write_particles(parts, xparts, list + num_fields,
e->cooling_func);
......
......@@ -981,7 +981,8 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units,
if (with_hydro) {
Nparticles = *Ngas;
hydro_read_particles(*parts, list, &num_fields);
num_fields += chemistry_read_particles(*parts, list + num_fields);
num_fields += chemistry_read_particles(*parts, list + num_fields,
with_cosmology);
}
break;
......@@ -1251,8 +1252,8 @@ void prepare_file(struct engine* e, const char* fileName,
case swift_type_gas:
hydro_write_particles(parts, xparts, list, &num_fields);
num_fields +=
chemistry_write_particles(parts, xparts, list + num_fields);
num_fields += chemistry_write_particles(
parts, xparts, list + num_fields, with_cosmology);
if (with_cooling || with_temperature) {
num_fields += cooling_write_particles(
parts, xparts, list + num_fields, e->cooling_func);
......@@ -1624,8 +1625,8 @@ void write_output_parallel(struct engine* e,
/* No inhibted particles: easy case */
Nparticles = Ngas;
hydro_write_particles(parts, xparts, list, &num_fields);
num_fields +=
chemistry_write_particles(parts, xparts, list + num_fields);
num_fields += chemistry_write_particles(
parts, xparts, list + num_fields, with_cosmology);
if (with_cooling || with_temperature) {
num_fields += cooling_write_particles(
parts, xparts, list + num_fields, e->cooling_func);
......@@ -1664,8 +1665,8 @@ void write_output_parallel(struct engine* e,
/* Select the fields to write */
hydro_write_particles(parts_written, xparts_written, list,
&num_fields);
num_fields += chemistry_write_particles(parts_written, xparts_written,
list + num_fields);
num_fields += chemistry_write_particles(
parts_written, xparts_written, list + num_fields, with_cosmology);
if (with_cooling || with_temperature) {
num_fields +=
cooling_write_particles(parts_written, xparts_written,
......
......@@ -1207,8 +1207,8 @@ void write_output_serial(struct engine* e,
/* No inhibted particles: easy case */
Nparticles = Ngas;
hydro_write_particles(parts, xparts, list, &num_fields);
num_fields +=
chemistry_write_particles(parts, xparts, list + num_fields);
num_fields += chemistry_write_particles(
parts, xparts, list + num_fields, with_cosmology);
if (with_cooling || with_temperature) {
num_fields += cooling_write_particles(
parts, xparts, list + num_fields, e->cooling_func);
......@@ -1247,8 +1247,9 @@ void write_output_serial(struct engine* e,
/* Select the fields to write */
hydro_write_particles(parts_written, xparts_written, list,
&num_fields);
num_fields += chemistry_write_particles(
parts_written, xparts_written, list + num_fields);
num_fields +=
chemistry_write_particles(parts_written, xparts_written,
list + num_fields, with_cosmology);
if (with_cooling || with_temperature) {
num_fields +=
cooling_write_particles(parts_written, xparts_written,
......
......@@ -999,8 +999,8 @@ void write_output_single(struct engine* e,
/* No inhibted particles: easy case */
N = Ngas;
hydro_write_particles(parts, xparts, list, &num_fields);
num_fields +=
chemistry_write_particles(parts, xparts, list + num_fields);
num_fields += chemistry_write_particles(
parts, xparts, list + num_fields, with_cosmology);
if (with_cooling || with_temperature) {
num_fields += cooling_write_particles(
parts, xparts, list + num_fields, e->cooling_func);
......@@ -1039,8 +1039,8 @@ void write_output_single(struct engine* e,
/* Select the fields to write */
hydro_write_particles(parts_written, xparts_written, list,
&num_fields);
num_fields += chemistry_write_particles(parts_written, xparts_written,
list + num_fields);
num_fields += chemistry_write_particles(
parts_written, xparts_written, list + num_fields, with_cosmology);
if (with_cooling || with_temperature) {
num_fields +=
cooling_write_particles(parts_written, xparts_written,
......
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