Commit 4a5d4000 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

New function initialising the extra arrays just after reading in the ICs

parent b7869d73
......@@ -564,6 +564,7 @@ void cell_init_parts(struct cell *c, void *data) {
xp[i].v_full[0] = p[i].v[0];
xp[i].v_full[1] = p[i].v[1];
xp[i].v_full[2] = p[i].v[2];
hydro_first_init_part(&p[i], &xp[i]);
hydro_init_part(&p[i]);
hydro_reset_acceleration(&p[i]);
}
......
......@@ -38,6 +38,18 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
return fminf(dt_cfl, dt_u_change);
}
/**
* @brief Initialises the particles for the first time
*
* This function is called only once just after the ICs have been
* read in to do some conversions.
*
* @param p The particle to act upon
* @param xp The extended particle data to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_first_init_part(struct part* p, struct xpart* xp) {}
/**
* @brief Prepares a particle for the density calculation.
*
......
......@@ -41,6 +41,18 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
return fminf(dt_cfl, dt_accel);
}
/**
* @brief Initialises the particles for the first time
*
* This function is called only once just after the ICs have been
* read in to do some conversions.
*
* @param p The particle to act upon
* @param xp The extended particle data to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_first_init_part(struct part* p, struct xpart* xp) {}
/**
* @brief Prepares a particle for the density calculation.
*
......
......@@ -35,6 +35,21 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
return dt_cfl;
}
/**
* @brief Initialises the particles for the first time
*
* This function is called only once just after the ICs have been
* read in to do some conversions.
*
* @param p The particle to act upon
* @param xp The extended particle data to act upon
*/
__attribute__((always_inline))
INLINE static void hydro_first_init_part(struct part* p, struct xpart* xp) {
xp->u_full = p->u;
}
/**
* @brief Prepares a particle for the density calculation.
*
......
......@@ -26,6 +26,9 @@ struct xpart {
/* Velocity at the last full step. */
float v_full[3];
/* Thermal energy at the last full step. */
float u_full;
} __attribute__((aligned(xpart_align)));
/* Data of a single particle. */
......
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