Commit 066a4f79 authored by Matthieu Schaller's avatar Matthieu Schaller

Do not compile all the stars, black holes and sink cell properties when...

Do not compile all the stars, black holes and sink cell properties when configuring in a mode where these are not used
parent 8b1f49dc
......@@ -84,7 +84,7 @@ LineOfSight:
scale_factor_first: 0.1
delta_time: 1.1
# Quick Lyman-alpha cooling (EAGLE with fixed primoridal Z)
# Quick Lyman-alpha cooling (EAGLE-XL with fixed primoridal Z)
QLACooling:
dir_name: ./UV_dust1_CR1_G1_shield1.hdf5 # Location of the cooling tables
H_reion_z: 7.5 # Redshift of Hydrogen re-ionization (Planck 2018)
......
......@@ -4406,8 +4406,8 @@ int cell_unskip_black_holes_tasks(struct cell *c, struct scheduler *s) {
if (cell_need_rebuild_for_black_holes_pair(ci, cj)) rebuild = 1;
if (cell_need_rebuild_for_black_holes_pair(cj, ci)) rebuild = 1;
scheduler_activate(s, ci->hydro.super->black_holes.swallow_ghost[0]);
scheduler_activate(s, cj->hydro.super->black_holes.swallow_ghost[0]);
scheduler_activate(s, ci->hydro.super->black_holes.swallow_ghost_0);
scheduler_activate(s, cj->hydro.super->black_holes.swallow_ghost_0);
#ifdef WITH_MPI
/* Activate the send/recv tasks. */
......@@ -4588,12 +4588,12 @@ int cell_unskip_black_holes_tasks(struct cell *c, struct scheduler *s) {
if (c->black_holes.density_ghost != NULL)
scheduler_activate(s, c->black_holes.density_ghost);
if (c->black_holes.swallow_ghost[0] != NULL)
scheduler_activate(s, c->black_holes.swallow_ghost[0]);
if (c->black_holes.swallow_ghost[1] != NULL)
scheduler_activate(s, c->black_holes.swallow_ghost[1]);
if (c->black_holes.swallow_ghost[2] != NULL)
scheduler_activate(s, c->black_holes.swallow_ghost[2]);
if (c->black_holes.swallow_ghost_0 != NULL)
scheduler_activate(s, c->black_holes.swallow_ghost_0);
if (c->black_holes.swallow_ghost_1 != NULL)
scheduler_activate(s, c->black_holes.swallow_ghost_1);
if (c->black_holes.swallow_ghost_2 != NULL)
scheduler_activate(s, c->black_holes.swallow_ghost_2);
if (c->black_holes.black_holes_in != NULL)
scheduler_activate(s, c->black_holes.black_holes_in);
if (c->black_holes.black_holes_out != NULL)
......
......@@ -33,6 +33,9 @@
/* Local includes. */
#include "align.h"
#include "cell_black_holes.h"
#include "cell_sinks.h"
#include "cell_stars.h"
#include "kernel_hydro.h"
#include "lock.h"
#include "multipole_struct.h"
......@@ -40,7 +43,6 @@
#include "periodic.h"
#include "sort_part.h"
#include "space.h"
#include "star_formation_logger_struct.h"
#include "task.h"
#include "timeline.h"
......@@ -478,7 +480,7 @@ struct cell {
/*! Pointer to the #gpart data. */
struct gpart *parts;
/*! Pointer to the #spart data at rebuild time. */
/*! Pointer to the #gpart data at rebuild time. */
struct gpart *parts_rebuild;
/*! This cell's multipole. */
......@@ -567,223 +569,13 @@ struct cell {
} grav;
/*! Stars variables */
struct {
/*! Pointer to the #spart data. */
struct spart *parts;
/*! Pointer to the #spart data at rebuild time. */
struct spart *parts_rebuild;
/*! The star ghost task itself */
struct task *ghost;
/*! Linked list of the tasks computing this cell's star density. */
struct link *density;
/*! Linked list of the tasks computing this cell's star feedback. */
struct link *feedback;
/*! The task computing this cell's sorts before the density. */
struct task *sorts;
/*! The drift task for sparts */
struct task *drift;
/*! Implicit tasks marking the entry of the stellar physics block of tasks
*/
struct task *stars_in;
/*! Implicit tasks marking the exit of the stellar physics block of tasks */
struct task *stars_out;
/*! Last (integer) time the cell's spart were drifted forward in time. */
integertime_t ti_old_part;
/*! Spin lock for various uses (#spart case). */
swift_lock_type lock;
/*! Spin lock for star formation use. */
swift_lock_type star_formation_lock;
/*! Nr of #spart in this cell. */
int count;
/*! Nr of #spart this cell can hold after addition of new #spart. */
int count_total;
/*! Max smoothing length in this cell. */
float h_max;
/*! Values of h_max before the drifts, used for sub-cell tasks. */
float h_max_old;
/*! Maximum part movement in this cell since last construction. */
float dx_max_part;
/*! Values of dx_max before the drifts, used for sub-cell tasks. */
float dx_max_part_old;
/*! Maximum particle movement in this cell since the last sort. */
float dx_max_sort;
/*! Values of dx_max_sort before the drifts, used for sub-cell tasks. */
float dx_max_sort_old;
/*! Pointer for the sorted indices. */
struct sort_entry *sort;
/*! Bit mask of sort directions that will be needed in the next timestep. */
uint16_t requires_sorts;
/*! Bit-mask indicating the sorted directions */
uint16_t sorted;
/*! Bit-mask indicating the sorted directions */
uint16_t sort_allocated;
/*! Bit mask of sorts that need to be computed for this cell. */
uint16_t do_sort;
/*! Maximum end of (integer) time step in this cell for star tasks. */
integertime_t ti_end_min;
/*! Maximum end of (integer) time step in this cell for star tasks. */
integertime_t ti_end_max;
/*! Maximum beginning of (integer) time step in this cell for star tasks.
*/
integertime_t ti_beg_max;
/*! Number of #spart updated in this cell. */
int updated;
/*! Is the #spart data of this cell being used in a sub-cell? */
int hold;
/*! Star formation history struct */
struct star_formation_history sfh;
#ifdef SWIFT_DEBUG_CHECKS
/*! Last (integer) time the cell's sort arrays were updated. */
integertime_t ti_sort;
#endif
} stars;
struct cell_stars stars;
/*! Black hole variables */
struct {
/*! Pointer to the #bpart data. */
struct bpart *parts;
/*! The drift task for bparts */
struct task *drift;
/*! Implicit tasks marking the entry of the BH physics block of tasks
*/
struct task *black_holes_in;
/*! Implicit tasks marking the exit of the BH physics block of tasks */
struct task *black_holes_out;
/*! The star ghost task itself */
struct task *density_ghost;
/*! The star ghost task itself */
struct task *swallow_ghost[3];
/*! Linked list of the tasks computing this cell's BH density. */
struct link *density;
/*! Linked list of the tasks computing this cell's BH swallowing and
* merging. */
struct link *swallow;
/*! Linked list of the tasks processing the particles to swallow */
struct link *do_gas_swallow;
/*! Linked list of the tasks processing the particles to swallow */
struct link *do_bh_swallow;
/*! Linked list of the tasks computing this cell's BH feedback. */
struct link *feedback;
/*! Last (integer) time the cell's bpart were drifted forward in time. */
integertime_t ti_old_part;
/*! Spin lock for various uses (#bpart case). */
swift_lock_type lock;
/*! Nr of #bpart in this cell. */
int count;
/*! Nr of #bpart this cell can hold after addition of new #bpart. */
int count_total;
/*! Max smoothing length in this cell. */
float h_max;
/*! Values of h_max before the drifts, used for sub-cell tasks. */
float h_max_old;
/*! Maximum part movement in this cell since last construction. */
float dx_max_part;
/*! Values of dx_max before the drifts, used for sub-cell tasks. */
float dx_max_part_old;
/*! Maximum end of (integer) time step in this cell for black tasks. */
integertime_t ti_end_min;
/*! Maximum end of (integer) time step in this cell for black hole tasks. */
integertime_t ti_end_max;
/*! Maximum beginning of (integer) time step in this cell for black hole
* tasks.
*/
integertime_t ti_beg_max;
/*! Number of #bpart updated in this cell. */
int updated;
/*! Is the #bpart data of this cell being used in a sub-cell? */
int hold;
} black_holes;
struct cell_black_holes black_holes;
/*! Sink particles variables */
struct {
/*! Pointer to the #sink data. */
struct sink *parts;
/*! Nr of #sink in this cell. */
int count;
/*! Nr of #sink this cell can hold after addition of new one. */
int count_total;
/*! Is the #sink data of this cell being used in a sub-cell? */
int hold;
/*! Spin lock for various uses (#sink case). */
swift_lock_type lock;
/*! Last (integer) time the cell's sink were drifted forward in time. */
integertime_t ti_old_part;
/*! Minimum end of (integer) time step in this cell for sink tasks. */
integertime_t ti_end_min;
/*! Maximum end of (integer) time step in this cell for sink tasks. */
integertime_t ti_end_max;
/*! Maximum beginning of (integer) time step in this cell for sink
* tasks.
*/
integertime_t ti_beg_max;
} sinks;
struct cell_sinks sinks;
#ifdef WITH_MPI
/*! MPI variables */
......@@ -1541,11 +1333,13 @@ __attribute__((always_inline)) INLINE static void cell_malloc_stars_sorts(
__attribute__((always_inline)) INLINE static void cell_free_stars_sorts(
struct cell *c) {
#ifndef STARS_NONE
if (c->stars.sort != NULL) {
swift_free("stars.sort", c->stars.sort);
c->stars.sort = NULL;
c->stars.sort_allocated = 0;
}
#endif
}
/**
......
#ifndef SWIFT_CELL_BLACK_HOLES_H
#define SWIFT_CELL_BLACK_HOLES_H
/* Config parameters. */
#include "../config.h"
/* Local includes. */
#include "lock.h"
#include "task.h"
#include "timeline.h"
struct cell_black_holes {
#ifdef BLACK_HOLES_NONE
union {
#endif
/*! Pointer to the #bpart data. */
struct bpart *parts;
/*! The drift task for bparts */
struct task *drift;
/*! Implicit tasks marking the entry of the BH physics block of tasks
*/
struct task *black_holes_in;
/*! Implicit tasks marking the exit of the BH physics block of tasks */
struct task *black_holes_out;
/*! The density ghost task itself */
struct task *density_ghost;
/*! The other ghost tasks themselves */
struct task *swallow_ghost_0;
struct task *swallow_ghost_1;
struct task *swallow_ghost_2;
/*! Linked list of the tasks computing this cell's BH density. */
struct link *density;
/*! Linked list of the tasks computing this cell's BH swallowing and
* merging. */
struct link *swallow;
/*! Linked list of the tasks processing the particles to swallow */
struct link *do_gas_swallow;
/*! Linked list of the tasks processing the particles to swallow */
struct link *do_bh_swallow;
/*! Linked list of the tasks computing this cell's BH feedback. */
struct link *feedback;
/*! Last (integer) time the cell's bpart were drifted forward in time. */
integertime_t ti_old_part;
/*! Spin lock for various uses (#bpart case). */
swift_lock_type lock;
/*! Nr of #bpart in this cell. */
int count;
/*! Nr of #bpart this cell can hold after addition of new #bpart. */
int count_total;
/*! Max smoothing length in this cell. */
float h_max;
/*! Values of h_max before the drifts, used for sub-cell tasks. */
float h_max_old;
/*! Maximum part movement in this cell since last construction. */
float dx_max_part;
/*! Values of dx_max before the drifts, used for sub-cell tasks. */
float dx_max_part_old;
/*! Maximum end of (integer) time step in this cell for black tasks. */
integertime_t ti_end_min;
/*! Maximum end of (integer) time step in this cell for black hole tasks. */
integertime_t ti_end_max;
/*! Maximum beginning of (integer) time step in this cell for black hole
* tasks.
*/
integertime_t ti_beg_max;
/*! Number of #bpart updated in this cell. */
int updated;
/*! Is the #bpart data of this cell being used in a sub-cell? */
int hold;
#ifdef BLACK_HOLES_NONE
};
#endif
};
#endif /* SWIFT_CELL_BLACK_HOLES_H */
#ifndef SWIFT_CELL_SINKS_H
#define SWIFT_CELL_SINKS_H
/* Config parameters. */
#include "../config.h"
/* Local includes. */
#include "lock.h"
#include "timeline.h"
struct cell_sinks {
#ifdef SINK_NONE
union {
#endif
/*! Pointer to the #sink data. */
struct sink *parts;
/*! Nr of #sink in this cell. */
int count;
/*! Nr of #sink this cell can hold after addition of new one. */
int count_total;
/*! Is the #sink data of this cell being used in a sub-cell? */
int hold;
/*! Spin lock for various uses (#sink case). */
swift_lock_type lock;
/*! Last (integer) time the cell's sink were drifted forward in time. */
integertime_t ti_old_part;
/*! Minimum end of (integer) time step in this cell for sink tasks. */
integertime_t ti_end_min;
/*! Maximum end of (integer) time step in this cell for sink tasks. */
integertime_t ti_end_max;
/*! Maximum beginning of (integer) time step in this cell for sink
* tasks. */
integertime_t ti_beg_max;
#ifdef SINK_NONE
};
#endif
};
#endif /* SWIFT_CELL_SINKS_H */
#ifndef SWIFT_CELL_STARS_H
#define SWIFT_CELL_STARS_H
/* Config parameters. */
#include "../config.h"
/* Local includes. */
#include "lock.h"
#include "star_formation_logger_struct.h"
#include "task.h"
#include "timeline.h"
struct cell_stars {
#ifdef STARS_NONE
union {
#endif
/*! Pointer to the #spart data. */
struct spart *parts;
/*! Pointer to the #spart data at rebuild time. */
struct spart *parts_rebuild;
/*! The star ghost task itself */
struct task *ghost;
/*! Linked list of the tasks computing this cell's star density. */
struct link *density;
/*! Linked list of the tasks computing this cell's star feedback. */
struct link *feedback;
/*! The task computing this cell's sorts before the density. */
struct task *sorts;
/*! The drift task for sparts */
struct task *drift;
/*! Implicit tasks marking the entry of the stellar physics block of tasks
*/
struct task *stars_in;
/*! Implicit tasks marking the exit of the stellar physics block of tasks */
struct task *stars_out;
/*! Last (integer) time the cell's spart were drifted forward in time. */
integertime_t ti_old_part;
/*! Spin lock for various uses (#spart case). */
swift_lock_type lock;
/*! Spin lock for star formation use. */
swift_lock_type star_formation_lock;
/*! Nr of #spart in this cell. */
int count;
/*! Nr of #spart this cell can hold after addition of new #spart. */
int count_total;
/*! Max smoothing length in this cell. */
float h_max;
/*! Values of h_max before the drifts, used for sub-cell tasks. */
float h_max_old;
/*! Maximum part movement in this cell since last construction. */
float dx_max_part;
/*! Values of dx_max before the drifts, used for sub-cell tasks. */
float dx_max_part_old;
/*! Maximum particle movement in this cell since the last sort. */
float dx_max_sort;
/*! Values of dx_max_sort before the drifts, used for sub-cell tasks. */
float dx_max_sort_old;
/*! Pointer for the sorted indices. */
struct sort_entry *sort;
/*! Bit mask of sort directions that will be needed in the next timestep. */
uint16_t requires_sorts;
/*! Bit-mask indicating the sorted directions */
uint16_t sorted;
/*! Bit-mask indicating the sorted directions */
uint16_t sort_allocated;
/*! Bit mask of sorts that need to be computed for this cell. */
uint16_t do_sort;
/*! Maximum end of (integer) time step in this cell for star tasks. */
integertime_t ti_end_min;
/*! Maximum end of (integer) time step in this cell for star tasks. */
integertime_t ti_end_max;
/*! Maximum beginning of (integer) time step in this cell for star tasks.
*/
integertime_t ti_beg_max;
/*! Number of #spart updated in this cell. */
int updated;
/*! Is the #spart data of this cell being used in a sub-cell? */
int hold;
/*! Star formation history struct */
struct star_formation_history sfh;
#ifdef SWIFT_DEBUG_CHECKS
/*! Last (integer) time the cell's sort arrays were updated. */
integertime_t ti_sort;
#endif
#ifdef STARS_NONE
};
#endif
};
#endif /* SWIFT_CELL_STARS_H */
This diff is collapsed.
......@@ -709,8 +709,8 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
if (cell_need_rebuild_for_black_holes_pair(ci, cj)) *rebuild_space = 1;
if (cell_need_rebuild_for_black_holes_pair(cj, ci)) *rebuild_space = 1;
scheduler_activate(s, ci->hydro.super->black_holes.swallow_ghost[0]);
scheduler_activate(s, cj->hydro.super->black_holes.swallow_ghost[0]);
scheduler_activate(s, ci->hydro.super->black_holes.swallow_ghost_0);
scheduler_activate(s, cj->hydro.super->black_holes.swallow_ghost_0);
#ifdef WITH_MPI
/* Activate the send/recv tasks. */
......
......@@ -237,9 +237,9 @@ void space_rebuild_recycle_mapper(void *map_data, int num_elements,
c->stars.density = NULL;
c->stars.feedback = NULL;
c->black_holes.density_ghost = NULL;
c->black_holes.swallow_ghost[0] = NULL;
c->black_holes.swallow_ghost[1] = NULL;
c->black_holes.swallow_ghost[2] = NULL;
c->black_holes.swallow_ghost_0 = NULL;
c->black_holes.swallow_ghost_1 = NULL;
c->black_holes.swallow_ghost_2 = NULL;
c->black_holes.density = NULL;
c->black_holes.swallow = NULL;
c->black_holes.do_gas_swallow = NULL;
......
......@@ -25,6 +25,11 @@
#include "../config.h"
/* MPI headers. */
#ifdef WITH_MPI
#include <mpi.h>
#endif
/* Includes. */
#include "align.h"
#include "cycle.h"
......
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