Skip to content
Snippets Groups Projects
Commit ccdc8b06 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Pass a pointer to the xpart to the cool_part() function.

parent dcd91e19
No related branches found
No related tags found
1 merge request!247Radiated energy
...@@ -95,8 +95,8 @@ ...@@ -95,8 +95,8 @@
//#define EXTERNAL_POTENTIAL_DISK_PATCH //#define EXTERNAL_POTENTIAL_DISK_PATCH
/* Cooling properties */ /* Cooling properties */
#define COOLING_NONE //#define COOLING_NONE
//#define COOLING_CONST_DU #define COOLING_CONST_DU
//#define COOLING_CONST_LAMBDA //#define COOLING_CONST_LAMBDA
//#define COOLING_GRACKLE //#define COOLING_GRACKLE
......
...@@ -59,7 +59,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( ...@@ -59,7 +59,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
const struct phys_const* restrict phys_const, const struct phys_const* restrict phys_const,
const struct UnitSystem* restrict us, const struct UnitSystem* restrict us,
const struct cooling_function_data* restrict cooling, const struct cooling_function_data* restrict cooling,
struct part* restrict p, float dt) { struct part* restrict p, struct xpart* restrict xp, float dt) {
/* Get current internal energy (dt=0) */ /* Get current internal energy (dt=0) */
const float u_old = hydro_get_internal_energy(p, 0.f); const float u_old = hydro_get_internal_energy(p, 0.f);
......
...@@ -86,7 +86,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( ...@@ -86,7 +86,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
const struct phys_const* restrict phys_const, const struct phys_const* restrict phys_const,
const struct UnitSystem* restrict us, const struct UnitSystem* restrict us,
const struct cooling_function_data* restrict cooling, const struct cooling_function_data* restrict cooling,
struct part* restrict p, float dt) { struct part* restrict p, struct xpart* restrict xp, float dt) {
/* Get current internal energy (dt=0) */ /* Get current internal energy (dt=0) */
const float u_old = hydro_get_internal_energy(p, 0.f); const float u_old = hydro_get_internal_energy(p, 0.f);
......
...@@ -51,7 +51,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( ...@@ -51,7 +51,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
const struct phys_const* restrict phys_const, const struct phys_const* restrict phys_const,
const struct UnitSystem* restrict us, const struct UnitSystem* restrict us,
const struct cooling_function_data* restrict cooling, const struct cooling_function_data* restrict cooling,
struct part* restrict p, float dt) {} struct part* restrict p, struct xpart* restrict xp, float dt) {}
/** /**
* @brief Computes the cooling time-step. * @brief Computes the cooling time-step.
......
...@@ -170,6 +170,7 @@ void runner_do_grav_external(struct runner *r, struct cell *c, int timer) { ...@@ -170,6 +170,7 @@ void runner_do_grav_external(struct runner *r, struct cell *c, int timer) {
void runner_do_cooling(struct runner *r, struct cell *c, int timer) { void runner_do_cooling(struct runner *r, struct cell *c, int timer) {
struct part *restrict parts = c->parts; struct part *restrict parts = c->parts;
struct xpart *restrict xparts = c->xparts;
const int count = c->count; const int count = c->count;
const int ti_current = r->e->ti_current; const int ti_current = r->e->ti_current;
const struct cooling_function_data *cooling_func = r->e->cooling_func; const struct cooling_function_data *cooling_func = r->e->cooling_func;
...@@ -195,13 +196,14 @@ void runner_do_cooling(struct runner *r, struct cell *c, int timer) { ...@@ -195,13 +196,14 @@ void runner_do_cooling(struct runner *r, struct cell *c, int timer) {
/* Get a direct pointer on the part. */ /* Get a direct pointer on the part. */
struct part *restrict p = &parts[i]; struct part *restrict p = &parts[i];
struct xpart *restrict xp = &xparts[i];
/* Kick has already updated ti_end, so need to check ti_begin */ /* Kick has already updated ti_end, so need to check ti_begin */
if (p->ti_begin == ti_current) { if (p->ti_begin == ti_current) {
const double dt = (p->ti_end - p->ti_begin) * timeBase; const double dt = (p->ti_end - p->ti_begin) * timeBase;
cooling_cool_part(constants, us, cooling_func, p, dt); cooling_cool_part(constants, us, cooling_func, p, xp, dt);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment