Commit 35332b91 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Ported the differences to the other 2 SPH schemes

parent 2163286c
...@@ -56,6 +56,8 @@ __attribute__((always_inline)) INLINE static void hydro_read_particles( ...@@ -56,6 +56,8 @@ __attribute__((always_inline)) INLINE static void hydro_read_particles(
* *
* @param h_grp The HDF5 group in which to write the arrays. * @param h_grp The HDF5 group in which to write the arrays.
* @param fileName The name of the file (unsued in MPI mode). * @param fileName The name of the file (unsued in MPI mode).
* @param partTypeGroupName The name of the group containing the particles in
*the HDF5 file.
* @param xmfFile The XMF file to write to (unused in MPI mode). * @param xmfFile The XMF file to write to (unused in MPI mode).
* @param N The number of particles on that MPI rank. * @param N The number of particles on that MPI rank.
* @param N_total The total number of particles (only used in MPI mode) * @param N_total The total number of particles (only used in MPI mode)
...@@ -67,26 +69,31 @@ __attribute__((always_inline)) INLINE static void hydro_read_particles( ...@@ -67,26 +69,31 @@ __attribute__((always_inline)) INLINE static void hydro_read_particles(
* *
*/ */
__attribute__((always_inline)) INLINE static void hydro_write_particles( __attribute__((always_inline)) INLINE static void hydro_write_particles(
hid_t h_grp, char* fileName, FILE* xmfFile, int N, long long N_total, hid_t h_grp, char* fileName, char* partTypeGroupName, FILE* xmfFile, int N,
int mpi_rank, long long offset, struct part* parts, struct UnitSystem* us) { long long N_total, int mpi_rank, long long offset, struct part* parts,
struct UnitSystem* us) {
/* Write arrays */ /* Write arrays */
writeArray(h_grp, fileName, xmfFile, "Coordinates", DOUBLE, N, 3, parts, writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "Coordinates", DOUBLE,
N_total, mpi_rank, offset, x, us, UNIT_CONV_LENGTH); N, 3, parts, N_total, mpi_rank, offset, x, us, UNIT_CONV_LENGTH);
writeArray(h_grp, fileName, xmfFile, "Velocities", FLOAT, N, 3, parts, writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "Velocities", FLOAT,
N_total, mpi_rank, offset, v, us, UNIT_CONV_SPEED); N, 3, parts, N_total, mpi_rank, offset, v, us, UNIT_CONV_SPEED);
writeArray(h_grp, fileName, xmfFile, "Masses", FLOAT, N, 1, parts, N_total, writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "Masses", FLOAT, N, 1,
mpi_rank, offset, mass, us, UNIT_CONV_MASS); parts, N_total, mpi_rank, offset, mass, us, UNIT_CONV_MASS);
writeArray(h_grp, fileName, xmfFile, "SmoothingLength", FLOAT, N, 1, parts, writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "SmoothingLength",
N_total, mpi_rank, offset, h, us, UNIT_CONV_LENGTH); FLOAT, N, 1, parts, N_total, mpi_rank, offset, h, us,
writeArray(h_grp, fileName, xmfFile, "InternalEnergy", FLOAT, N, 1, parts, UNIT_CONV_LENGTH);
N_total, mpi_rank, offset, u, us, UNIT_CONV_ENERGY_PER_UNIT_MASS); writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "InternalEnergy",
writeArray(h_grp, fileName, xmfFile, "ParticleIDs", ULONGLONG, N, 1, parts, FLOAT, N, 1, parts, N_total, mpi_rank, offset, u, us,
N_total, mpi_rank, offset, id, us, UNIT_CONV_NO_UNITS); UNIT_CONV_ENERGY_PER_UNIT_MASS);
writeArray(h_grp, fileName, xmfFile, "Acceleration", FLOAT, N, 3, parts, writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "ParticleIDs",
N_total, mpi_rank, offset, a_hydro, us, UNIT_CONV_ACCELERATION); ULONGLONG, N, 1, parts, N_total, mpi_rank, offset, id, us,
writeArray(h_grp, fileName, xmfFile, "Density", FLOAT, N, 1, parts, N_total, UNIT_CONV_NO_UNITS);
mpi_rank, offset, rho, us, UNIT_CONV_DENSITY); writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "Acceleration", FLOAT,
N, 3, parts, N_total, mpi_rank, offset, a_hydro, us,
UNIT_CONV_ACCELERATION);
writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "Density", FLOAT, N,
1, parts, N_total, mpi_rank, offset, rho, us, UNIT_CONV_DENSITY);
} }
/** /**
......
...@@ -56,6 +56,8 @@ __attribute__((always_inline)) INLINE static void hydro_read_particles( ...@@ -56,6 +56,8 @@ __attribute__((always_inline)) INLINE static void hydro_read_particles(
* *
* @param h_grp The HDF5 group in which to write the arrays. * @param h_grp The HDF5 group in which to write the arrays.
* @param fileName The name of the file (unsued in MPI mode). * @param fileName The name of the file (unsued in MPI mode).
* @param partTypeGroupName The name of the group containing the particles in
*the HDF5 file.
* @param xmfFile The XMF file to write to (unused in MPI mode). * @param xmfFile The XMF file to write to (unused in MPI mode).
* @param N The number of particles on that MPI rank. * @param N The number of particles on that MPI rank.
* @param N_total The total number of particles (only used in MPI mode) * @param N_total The total number of particles (only used in MPI mode)
......
...@@ -56,6 +56,8 @@ __attribute__((always_inline)) INLINE static void hydro_read_particles( ...@@ -56,6 +56,8 @@ __attribute__((always_inline)) INLINE static void hydro_read_particles(
* *
* @param h_grp The HDF5 group in which to write the arrays. * @param h_grp The HDF5 group in which to write the arrays.
* @param fileName The name of the file (unsued in MPI mode). * @param fileName The name of the file (unsued in MPI mode).
* @param partTypeGroupName The name of the group containing the particles in
*the HDF5 file.
* @param xmfFile The XMF file to write to (unused in MPI mode). * @param xmfFile The XMF file to write to (unused in MPI mode).
* @param N The number of particles on that MPI rank. * @param N The number of particles on that MPI rank.
* @param N_total The total number of particles (only used in MPI mode) * @param N_total The total number of particles (only used in MPI mode)
...@@ -67,26 +69,31 @@ __attribute__((always_inline)) INLINE static void hydro_read_particles( ...@@ -67,26 +69,31 @@ __attribute__((always_inline)) INLINE static void hydro_read_particles(
* *
*/ */
__attribute__((always_inline)) INLINE static void hydro_write_particles( __attribute__((always_inline)) INLINE static void hydro_write_particles(
hid_t h_grp, char* fileName, FILE* xmfFile, int N, long long N_total, hid_t h_grp, char* fileName, char* partTypeGroupName, FILE* xmfFile, int N,
int mpi_rank, long long offset, struct part* parts, struct UnitSystem* us) { long long N_total, int mpi_rank, long long offset, struct part* parts,
struct UnitSystem* us) {
/* Write arrays */ /* Write arrays */
writeArray(h_grp, fileName, xmfFile, "Coordinates", DOUBLE, N, 3, parts, writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "Coordinates", DOUBLE,
N_total, mpi_rank, offset, x, us, UNIT_CONV_LENGTH); N, 3, parts, N_total, mpi_rank, offset, x, us, UNIT_CONV_LENGTH);
writeArray(h_grp, fileName, xmfFile, "Velocities", FLOAT, N, 3, parts, writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "Velocities", FLOAT,
N_total, mpi_rank, offset, v, us, UNIT_CONV_SPEED); N, 3, parts, N_total, mpi_rank, offset, v, us, UNIT_CONV_SPEED);
writeArray(h_grp, fileName, xmfFile, "Masses", FLOAT, N, 1, parts, N_total, writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "Masses", FLOAT, N, 1,
mpi_rank, offset, mass, us, UNIT_CONV_MASS); parts, N_total, mpi_rank, offset, mass, us, UNIT_CONV_MASS);
writeArray(h_grp, fileName, xmfFile, "SmoothingLength", FLOAT, N, 1, parts, writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "SmoothingLength",
N_total, mpi_rank, offset, h, us, UNIT_CONV_LENGTH); FLOAT, N, 1, parts, N_total, mpi_rank, offset, h, us,
writeArray(h_grp, fileName, xmfFile, "InternalEnergy", FLOAT, N, 1, parts, UNIT_CONV_LENGTH);
N_total, mpi_rank, offset, u, us, UNIT_CONV_ENERGY_PER_UNIT_MASS); writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "InternalEnergy",
writeArray(h_grp, fileName, xmfFile, "ParticleIDs", ULONGLONG, N, 1, parts, FLOAT, N, 1, parts, N_total, mpi_rank, offset, u, us,
N_total, mpi_rank, offset, id, us, UNIT_CONV_NO_UNITS); UNIT_CONV_ENERGY_PER_UNIT_MASS);
writeArray(h_grp, fileName, xmfFile, "Acceleration", FLOAT, N, 3, parts, writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "ParticleIDs",
N_total, mpi_rank, offset, a_hydro, us, UNIT_CONV_ACCELERATION); ULONGLONG, N, 1, parts, N_total, mpi_rank, offset, id, us,
writeArray(h_grp, fileName, xmfFile, "Density", FLOAT, N, 1, parts, N_total, UNIT_CONV_NO_UNITS);
mpi_rank, offset, rho, us, UNIT_CONV_DENSITY); writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "Acceleration", FLOAT,
N, 3, parts, N_total, mpi_rank, offset, a_hydro, us,
UNIT_CONV_ACCELERATION);
writeArray(h_grp, fileName, xmfFile, partTypeGroupName, "Density", FLOAT, N,
1, parts, N_total, mpi_rank, offset, rho, us, UNIT_CONV_DENSITY);
} }
/** /**
......
Supports Markdown
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