diff --git a/src/parallel_io.c b/src/parallel_io.c index 154ec442c6435188874b0087a65150f84f6d7f03..f1d449799d25a0975727460070bae968f9facade 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -84,11 +84,13 @@ * @param h The value of the reduced Hubble constant to use for cleaning. * @param a The current value of the scale-factor. */ -void readArray_chunk(hid_t h_data, hid_t h_plist_id, - const struct io_props props, size_t N, long long offset, - const struct unit_system* internal_units, - const struct unit_system* ic_units, int cleanup_h, - int cleanup_sqrt_a, double h, double a) { +void read_array_parallel_chunk(hid_t h_data, hid_t h_plist_id, + const struct io_props props, size_t N, + long long offset, + const struct unit_system* internal_units, + const struct unit_system* ic_units, + int cleanup_h, int cleanup_sqrt_a, double h, + double a) { const size_t typeSize = io_sizeof_type(props.type); const size_t copySize = typeSize * props.dimension; @@ -239,11 +241,11 @@ void readArray_chunk(hid_t h_data, hid_t h_plist_id, * @param h The value of the reduced Hubble constant to use for cleaning. * @param a The current value of the scale-factor. */ -void readArray(hid_t grp, struct io_props props, size_t N, long long N_total, - int mpi_rank, long long offset, - const struct unit_system* internal_units, - const struct unit_system* ic_units, int cleanup_h, - int cleanup_sqrt_a, double h, double a) { +void read_array_parallel(hid_t grp, struct io_props props, size_t N, + long long N_total, int mpi_rank, long long offset, + const struct unit_system* internal_units, + const struct unit_system* ic_units, int cleanup_h, + int cleanup_sqrt_a, double h, double a) { const size_t typeSize = io_sizeof_type(props.type); const size_t copySize = typeSize * props.dimension; @@ -332,8 +334,9 @@ void readArray(hid_t grp, struct io_props props, size_t N, long long N_total, /* Write the first chunk */ const size_t this_chunk = (N > max_chunk_size) ? max_chunk_size : N; - readArray_chunk(h_data, h_plist_id, props, this_chunk, offset, - internal_units, ic_units, cleanup_h, cleanup_sqrt_a, h, a); + read_array_parallel_chunk(h_data, h_plist_id, props, this_chunk, offset, + internal_units, ic_units, cleanup_h, + cleanup_sqrt_a, h, a); /* Compute how many items are left */ if (N > max_chunk_size) { @@ -375,9 +378,10 @@ void readArray(hid_t grp, struct io_props props, size_t N, long long N_total, * @param N_total The total number of particles to write in this array. * @param snapshot_units The units used for the data in this snapshot. */ -void prepareArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile, - char* partTypeGroupName, struct io_props props, - long long N_total, const struct unit_system* snapshot_units) { +void prepare_array_parallel(struct engine* e, hid_t grp, char* fileName, + FILE* xmfFile, char* partTypeGroupName, + struct io_props props, long long N_total, + const struct unit_system* snapshot_units) { /* Create data space */ const hid_t h_space = H5Screate(H5S_SIMPLE); @@ -483,10 +487,11 @@ void prepareArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile, * @param internal_units The #unit_system used internally. * @param snapshot_units The #unit_system used in the snapshots. */ -void writeArray_chunk(struct engine* e, hid_t h_data, - const struct io_props props, size_t N, long long offset, - const struct unit_system* internal_units, - const struct unit_system* snapshot_units) { +void write_array_parallel_chunk(struct engine* e, hid_t h_data, + const struct io_props props, size_t N, + long long offset, + const struct unit_system* internal_units, + const struct unit_system* snapshot_units) { const size_t typeSize = io_sizeof_type(props.type); const size_t num_elements = N * props.dimension; @@ -609,11 +614,12 @@ void writeArray_chunk(struct engine* e, hid_t h_data, * @param internal_units The #unit_system used internally. * @param snapshot_units The #unit_system used in the snapshots. */ -void writeArray(struct engine* e, hid_t grp, char* fileName, - char* partTypeGroupName, struct io_props props, size_t N, - long long N_total, int mpi_rank, long long offset, - const struct unit_system* internal_units, - const struct unit_system* snapshot_units) { +void write_array_parallel(struct engine* e, hid_t grp, char* fileName, + char* partTypeGroupName, struct io_props props, + size_t N, long long N_total, int mpi_rank, + long long offset, + const struct unit_system* internal_units, + const struct unit_system* snapshot_units) { const size_t typeSize = io_sizeof_type(props.type); @@ -636,8 +642,8 @@ void writeArray(struct engine* e, hid_t grp, char* fileName, /* Write the first chunk */ const size_t this_chunk = (N > max_chunk_size) ? max_chunk_size : N; - writeArray_chunk(e, h_data, props, this_chunk, offset, internal_units, - snapshot_units); + write_array_parallel_chunk(e, h_data, props, this_chunk, offset, + internal_units, snapshot_units); /* Compute how many items are left */ if (N > max_chunk_size) { @@ -979,9 +985,9 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units, /* Read everything */ if (!dry_run) for (int i = 0; i < num_fields; ++i) - readArray(h_grp, list[i], Nparticles, N_total[ptype], mpi_rank, - offset[ptype], internal_units, ic_units, cleanup_h, - cleanup_sqrt_a, h, a); + read_array_parallel(h_grp, list[i], Nparticles, N_total[ptype], + mpi_rank, offset[ptype], internal_units, ic_units, + cleanup_h, cleanup_sqrt_a, h, a); /* Close particle group */ H5Gclose(h_grp); @@ -1323,8 +1329,8 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6], int should_write = parser_get_opt_param_int(params, field, 1); if (should_write) - prepareArray(e, h_grp, fileName, xmfFile, partTypeGroupName, list[i], - N_total[ptype], snapshot_units); + prepare_array_parallel(e, h_grp, fileName, xmfFile, partTypeGroupName, + list[i], N_total[ptype], snapshot_units); } /* Close particle group */ @@ -1866,9 +1872,9 @@ void write_output_parallel(struct engine* e, const char* baseName, int should_write = parser_get_opt_param_int(params, field, 1); if (should_write) - writeArray(e, h_grp, fileName, partTypeGroupName, list[i], Nparticles, - N_total[ptype], mpi_rank, offset[ptype], internal_units, - snapshot_units); + write_array_parallel(e, h_grp, fileName, partTypeGroupName, list[i], + Nparticles, N_total[ptype], mpi_rank, + offset[ptype], internal_units, snapshot_units); } /* Free temporary array */ diff --git a/src/serial_io.c b/src/serial_io.c index 9efa2e81aa42d8b71198d7e8a8c8991003f8a2cb..70b5855ba03f245c2b3a821957ea3a500f9d1ba6 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -81,11 +81,11 @@ * @todo A better version using HDF5 hyper-slabs to read the file directly into * the part array will be written once the structures have been stabilized. */ -void readArray(hid_t grp, const struct io_props props, size_t N, - long long N_total, long long offset, - const struct unit_system* internal_units, - const struct unit_system* ic_units, int cleanup_h, - int cleanup_sqrt_a, double h, double a) { +void read_array_serial(hid_t grp, const struct io_props props, size_t N, + long long N_total, long long offset, + const struct unit_system* internal_units, + const struct unit_system* ic_units, int cleanup_h, + int cleanup_sqrt_a, double h, double a) { const size_t typeSize = io_sizeof_type(props.type); const size_t copySize = typeSize * props.dimension; @@ -238,11 +238,12 @@ void readArray(hid_t grp, const struct io_props props, size_t N, H5Dclose(h_data); } -void prepareArray(const struct engine* e, hid_t grp, char* fileName, - FILE* xmfFile, char* partTypeGroupName, - const struct io_props props, unsigned long long N_total, - const struct unit_system* internal_units, - const struct unit_system* snapshot_units) { +void prepare_array_serial(const struct engine* e, hid_t grp, char* fileName, + FILE* xmfFile, char* partTypeGroupName, + const struct io_props props, + unsigned long long N_total, + const struct unit_system* internal_units, + const struct unit_system* snapshot_units) { /* Create data space */ const hid_t h_space = H5Screate(H5S_SIMPLE); @@ -372,12 +373,12 @@ void prepareArray(const struct engine* e, hid_t grp, char* fileName, * @todo A better version using HDF5 hyper-slabs to write the file directly from * the part array will be written once the structures have been stabilized. */ -void writeArray(const struct engine* e, hid_t grp, char* fileName, - FILE* xmfFile, char* partTypeGroupName, - const struct io_props props, size_t N, long long N_total, - int mpi_rank, long long offset, - const struct unit_system* internal_units, - const struct unit_system* snapshot_units) { +void write_array_serial(const struct engine* e, hid_t grp, char* fileName, + FILE* xmfFile, char* partTypeGroupName, + const struct io_props props, size_t N, + long long N_total, int mpi_rank, long long offset, + const struct unit_system* internal_units, + const struct unit_system* snapshot_units) { const size_t typeSize = io_sizeof_type(props.type); const size_t num_elements = N * props.dimension; @@ -386,8 +387,8 @@ void writeArray(const struct engine* e, hid_t grp, char* fileName, /* Prepare the arrays in the file */ if (mpi_rank == 0) - prepareArray(e, grp, fileName, xmfFile, partTypeGroupName, props, N_total, - internal_units, snapshot_units); + prepare_array_serial(e, grp, fileName, xmfFile, partTypeGroupName, props, + N_total, internal_units, snapshot_units); /* Allocate temporary buffer */ void* temp = NULL; @@ -785,9 +786,9 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units, /* Read everything */ if (!dry_run) for (int i = 0; i < num_fields; ++i) - readArray(h_grp, list[i], Nparticles, N_total[ptype], offset[ptype], - internal_units, ic_units, cleanup_h, cleanup_sqrt_a, h, - a); + read_array_serial(h_grp, list[i], Nparticles, N_total[ptype], + offset[ptype], internal_units, ic_units, + cleanup_h, cleanup_sqrt_a, h, a); /* Close particle group */ H5Gclose(h_grp); @@ -1484,9 +1485,9 @@ void write_output_serial(struct engine* e, const char* baseName, int should_write = parser_get_opt_param_int(params, field, 1); if (should_write) - writeArray(e, h_grp, fileName, xmfFile, partTypeGroupName, list[i], - Nparticles, N_total[ptype], mpi_rank, offset[ptype], - internal_units, snapshot_units); + write_array_serial(e, h_grp, fileName, xmfFile, partTypeGroupName, + list[i], Nparticles, N_total[ptype], mpi_rank, + offset[ptype], internal_units, snapshot_units); } /* Free temporary array */ diff --git a/src/single_io.c b/src/single_io.c index 05ccfa8fde3f55cf226f18dae35818ee2575f437..e2022e99635be23027e23b5e1a0edded5b492581 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -78,10 +78,10 @@ * @todo A better version using HDF5 hyper-slabs to read the file directly into * the part array will be written once the structures have been stabilized. */ -void readArray(hid_t h_grp, const struct io_props props, size_t N, - const struct unit_system* internal_units, - const struct unit_system* ic_units, int cleanup_h, - int cleanup_sqrt_a, double h, double a) { +void read_array_single(hid_t h_grp, const struct io_props props, size_t N, + const struct unit_system* internal_units, + const struct unit_system* ic_units, int cleanup_h, + int cleanup_sqrt_a, double h, double a) { const size_t typeSize = io_sizeof_type(props.type); const size_t copySize = typeSize * props.dimension; @@ -230,11 +230,11 @@ void readArray(hid_t h_grp, const struct io_props props, size_t N, * @todo A better version using HDF5 hyper-slabs to write the file directly from * the part array will be written once the structures have been stabilized. */ -void writeArray(const struct engine* e, hid_t grp, char* fileName, - FILE* xmfFile, char* partTypeGroupName, - const struct io_props props, size_t N, - const struct unit_system* internal_units, - const struct unit_system* snapshot_units) { +void write_array_single(const struct engine* e, hid_t grp, char* fileName, + FILE* xmfFile, char* partTypeGroupName, + const struct io_props props, size_t N, + const struct unit_system* internal_units, + const struct unit_system* snapshot_units) { const size_t typeSize = io_sizeof_type(props.type); const size_t num_elements = N * props.dimension; @@ -656,8 +656,8 @@ void read_ic_single(const char* fileName, /* Read everything */ if (!dry_run) for (int i = 0; i < num_fields; ++i) - readArray(h_grp, list[i], Nparticles, internal_units, ic_units, - cleanup_h, cleanup_sqrt_a, h, a); + read_array_single(h_grp, list[i], Nparticles, internal_units, ic_units, + cleanup_h, cleanup_sqrt_a, h, a); /* Close particle group */ H5Gclose(h_grp); @@ -1268,8 +1268,8 @@ void write_output_single(struct engine* e, const char* baseName, int should_write = parser_get_opt_param_int(params, field, 1); if (should_write) - writeArray(e, h_grp, fileName, xmfFile, partTypeGroupName, list[i], N, - internal_units, snapshot_units); + write_array_single(e, h_grp, fileName, xmfFile, partTypeGroupName, + list[i], N, internal_units, snapshot_units); } /* Free temporary arrays */