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

Move the part-related swallowing functions to the black_holes_struct file....

Move the part-related swallowing functions to the black_holes_struct file. Added a structure for the merging of BHs.
parent 6addcb52
No related branches found
No related tags found
1 merge request!863Black holes mergers
...@@ -156,42 +156,6 @@ __attribute__((always_inline)) INLINE static void black_holes_swallow_part( ...@@ -156,42 +156,6 @@ __attribute__((always_inline)) INLINE static void black_holes_swallow_part(
/* Nothing to do here: No swallowing in the default model */ /* Nothing to do here: No swallowing in the default model */
} }
/**
* @brief Update a given #part's BH data field to mark the particle has
* not yet been swallowed.
*
* @param p_data The #part's #black_holes_part_data structure.
*/
__attribute__((always_inline)) INLINE static void
black_holes_mark_as_not_swallowed(struct black_holes_part_data* p_data) {
/* Nothing to do here: No swallowing in the default model */
}
/**
* @brief Update a given #part's BH data field to mark the particle has
* having been been swallowed.
*
* @param p_data The #part's #black_holes_part_data structure.
*/
__attribute__((always_inline)) INLINE static void black_holes_mark_as_swallowed(
struct black_holes_part_data* p_data) {
/* Nothing to do here: No swallowing in the default model */
}
/**
* @brief Return the ID of the BH that should swallow this #part.
*
* @param p_data The #part's #black_holes_part_data structure.
*/
__attribute__((always_inline)) INLINE static long long
black_holes_get_swallow_id(struct black_holes_part_data* p_data) {
/* Return a non-existing ID */
return -1;
}
/** /**
* @brief Compute the accretion rate of the black hole and all the quantites * @brief Compute the accretion rate of the black hole and all the quantites
* required for the feedback loop. * required for the feedback loop.
......
...@@ -66,6 +66,9 @@ struct bpart { ...@@ -66,6 +66,9 @@ struct bpart {
* content, etc.) */ * content, etc.) */
struct chemistry_bpart_data chemistry_data; struct chemistry_bpart_data chemistry_data;
/*! Black holes merger information (e.g. merging ID) */
struct black_holes_bpart_data merger_data;
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* Time of the last drift */ /* Time of the last drift */
......
...@@ -24,4 +24,45 @@ ...@@ -24,4 +24,45 @@
*/ */
struct black_holes_part_data {}; struct black_holes_part_data {};
/**
* @brief Black holes-related fields carried by each *BH* particle.
*/
struct black_holes_bpart_data {};
/**
* @brief Update a given #part's BH data field to mark the particle has
* not yet been swallowed.
*
* @param p_data The #part's #black_holes_part_data structure.
*/
__attribute__((always_inline)) INLINE static void
black_holes_mark_as_not_swallowed(struct black_holes_part_data* p_data) {
/* Nothing to do here: No swallowing in the default model */
}
/**
* @brief Update a given #part's BH data field to mark the particle has
* having been been swallowed.
*
* @param p_data The #part's #black_holes_part_data structure.
*/
__attribute__((always_inline)) INLINE static void black_holes_mark_as_swallowed(
struct black_holes_part_data* p_data) {
/* Nothing to do here: No swallowing in the default model */
}
/**
* @brief Return the ID of the BH that should swallow this #part.
*
* @param p_data The #part's #black_holes_part_data structure.
*/
__attribute__((always_inline)) INLINE static long long
black_holes_get_swallow_id(struct black_holes_part_data* p_data) {
/* Return a non-existing ID */
return -1;
}
#endif /* SWIFT_BLACK_HOLES_STRUCT_DEFAULT_H */ #endif /* SWIFT_BLACK_HOLES_STRUCT_DEFAULT_H */
...@@ -234,41 +234,6 @@ __attribute__((always_inline)) INLINE static void black_holes_swallow_part( ...@@ -234,41 +234,6 @@ __attribute__((always_inline)) INLINE static void black_holes_swallow_part(
bp->ngb_mass -= gas_mass; bp->ngb_mass -= gas_mass;
} }
/**
* @brief Update a given #part's BH data field to mark the particle has
* not yet been swallowed.
*
* @param p_data The #part's #black_holes_part_data structure.
*/
__attribute__((always_inline)) INLINE static void
black_holes_mark_as_not_swallowed(struct black_holes_part_data* p_data) {
p_data->swallow_id = -1;
}
/**
* @brief Update a given #part's BH data field to mark the particle has
* having been been swallowed.
*
* @param p_data The #part's #black_holes_part_data structure.
*/
__attribute__((always_inline)) INLINE static void black_holes_mark_as_swallowed(
struct black_holes_part_data* p_data) {
p_data->swallow_id = -2;
}
/**
* @brief Return the ID of the BH that should swallow this #part.
*
* @param p_data The #part's #black_holes_part_data structure.
*/
__attribute__((always_inline)) INLINE static long long
black_holes_get_swallow_id(struct black_holes_part_data* p_data) {
return p_data->swallow_id;
}
/** /**
* @brief Compute the accretion rate of the black hole and all the quantites * @brief Compute the accretion rate of the black hole and all the quantites
* required for the feedback loop. * required for the feedback loop.
......
...@@ -118,6 +118,9 @@ struct bpart { ...@@ -118,6 +118,9 @@ struct bpart {
* content, etc.) */ * content, etc.) */
struct chemistry_bpart_data chemistry_data; struct chemistry_bpart_data chemistry_data;
/*! Black holes merger information (e.g. merging ID) */
struct black_holes_bpart_data merger_data;
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* Time of the last drift */ /* Time of the last drift */
......
...@@ -28,4 +28,48 @@ struct black_holes_part_data { ...@@ -28,4 +28,48 @@ struct black_holes_part_data {
long long swallow_id; long long swallow_id;
}; };
/**
* @brief Black holes-related fields carried by each *BH* particle.
*/
struct black_holes_bpart_data {
/*! ID of the black-hole that will swallow this #bpart. */
long long swallow_id;
};
/**
* @brief Update a given #part's BH data field to mark the particle has
* not yet been swallowed.
*
* @param p_data The #part's #black_holes_part_data structure.
*/
__attribute__((always_inline)) INLINE static void
black_holes_mark_as_not_swallowed(struct black_holes_part_data* p_data) {
p_data->swallow_id = -1;
}
/**
* @brief Update a given #part's BH data field to mark the particle has
* having been been swallowed.
*
* @param p_data The #part's #black_holes_part_data structure.
*/
__attribute__((always_inline)) INLINE static void black_holes_mark_as_swallowed(
struct black_holes_part_data* p_data) {
p_data->swallow_id = -2;
}
/**
* @brief Return the ID of the BH that should swallow this #part.
*
* @param p_data The #part's #black_holes_part_data structure.
*/
__attribute__((always_inline)) INLINE static long long
black_holes_get_swallow_id(struct black_holes_part_data* p_data) {
return p_data->swallow_id;
}
#endif /* SWIFT_BLACK_HOLES_STRUCT_EAGLE_H */ #endif /* SWIFT_BLACK_HOLES_STRUCT_EAGLE_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment