diff --git a/src/io_properties.h b/src/io_properties.h index 07d29c3ce4450d77237b34411ceb5a40bcecc136..d7cc0ebb681053df3ff1d8bf0fa6d1469c3769ef 100644 --- a/src/io_properties.h +++ b/src/io_properties.h @@ -466,25 +466,34 @@ INLINE static struct io_props io_make_output_field_convert_part_LONGLONG( * @param type The type of the data * @param dimension Dataset dimension (1D, 3D, ...) * @param units The units of the dataset + * @param a_exponent Exponent of the scale-factor to convert to physical units. * @param gpartSize The size in byte of the particle * @param gparts The particle array * @param functionPtr The function used to convert a g-particle to a float + * @param description Description of the field added to the meta-data. * * Do not call this function directly. Use the macro defined above. */ INLINE static struct io_props io_make_output_field_convert_gpart_INT( const char name[FIELD_BUFFER_SIZE], enum IO_DATA_TYPE type, int dimension, - enum unit_conversion_factor units, size_t gpartSize, - const struct gpart* gparts, conversion_func_gpart_int functionPtr) { + enum unit_conversion_factor units, float a_exponent, size_t gpartSize, + const struct gpart* gparts, conversion_func_gpart_int functionPtr, + const char description[DESCRIPTION_BUFFER_SIZE]) { struct io_props r; bzero(&r, sizeof(struct io_props)); strcpy(r.name, name); + if (strlen(description) == 0) { + sprintf(r.description, "No description given"); + } else { + strcpy(r.description, description); + } r.type = type; r.dimension = dimension; r.importance = UNUSED; r.units = units; + r.scale_factor_exponent = a_exponent; r.partSize = gpartSize; r.gparts = gparts; r.conversion = 1; @@ -500,9 +509,11 @@ INLINE static struct io_props io_make_output_field_convert_gpart_INT( * @param type The type of the data * @param dimension Dataset dimension (1D, 3D, ...) * @param units The units of the dataset + * @param a_exponent Exponent of the scale-factor to convert to physical units. * @param gpartSize The size in byte of the particle * @param gparts The particle array * @param functionPtr The function used to convert a g-particle to a float + * @param description Description of the field added to the meta-data. * * Do not call this function directly. Use the macro defined above. */ @@ -639,23 +650,31 @@ INLINE static struct io_props io_make_output_field_convert_gpart_LONGLONG( * @param a_exponent Exponent of the scale-factor to convert to physical units. * @param spartSize The size in byte of the particle * @param sparts The particle array - * @param functionPtr The function used to convert a g-particle to a float + * @param functionPtr The function used to convert a s-particle to a float + * @param description Description of the field added to the meta-data. * * Do not call this function directly. Use the macro defined above. */ INLINE static struct io_props io_make_output_field_convert_spart_INT( const char name[FIELD_BUFFER_SIZE], enum IO_DATA_TYPE type, int dimension, - enum unit_conversion_factor units, size_t spartSize, - const struct spart* sparts, conversion_func_spart_int functionPtr) { + enum unit_conversion_factor units, float a_exponent, size_t spartSize, + const struct spart* sparts, conversion_func_spart_int functionPtr, + const char description[DESCRIPTION_BUFFER_SIZE]) { struct io_props r; bzero(&r, sizeof(struct io_props)); strcpy(r.name, name); + if (strlen(description) == 0) { + sprintf(r.description, "No description given"); + } else { + strcpy(r.description, description); + } r.type = type; r.dimension = dimension; r.importance = UNUSED; r.units = units; + r.scale_factor_exponent = a_exponent; r.partSize = spartSize; r.sparts = sparts; r.conversion = 1; @@ -671,9 +690,11 @@ INLINE static struct io_props io_make_output_field_convert_spart_INT( * @param type The type of the data * @param dimension Dataset dimension (1D, 3D, ...) * @param units The units of the dataset + * @param a_exponent Exponent of the scale-factor to convert to physical units. * @param spartSize The size in byte of the particle * @param sparts The particle array * @param functionPtr The function used to convert a g-particle to a float + * @param description Description of the field added to the meta-data. * * Do not call this function directly. Use the macro defined above. */ @@ -800,6 +821,49 @@ INLINE static struct io_props io_make_output_field_convert_spart_LONGLONG( a_exponent, sizeof(bpart[0]), \ bpart, convert, desc) +/** + * @brief Construct an #io_props from its parameters + * + * @param name Name of the field to read + * @param type The type of the data + * @param dimension Dataset dimension (1D, 3D, ...) + * @param units The units of the dataset + * @param a_exponent Exponent of the scale-factor to convert to physical units. + * @param bpartSize The size in byte of the particle + * @param bparts The particle array + * @param functionPtr The function used to convert a b-particle to a float + * @param description Description of the field added to the meta-data. + * + * Do not call this function directly. Use the macro defined above. + */ +INLINE static struct io_props io_make_output_field_convert_spart_INT( + const char name[FIELD_BUFFER_SIZE], enum IO_DATA_TYPE type, int dimension, + enum unit_conversion_factor units, float a_exponent, size_t bpartSize, + const struct bpart* bparts, conversion_func_bpart_int functionPtr, + const char description[DESCRIPTION_BUFFER_SIZE]) { + + struct io_props r; + bzero(&r, sizeof(struct io_props)); + + strcpy(r.name, name); + if (strlen(description) == 0) { + sprintf(r.description, "No description given"); + } else { + strcpy(r.description, description); + } + r.type = type; + r.dimension = dimension; + r.importance = UNUSED; + r.units = units; + r.scale_factor_exponent = a_exponent; + r.partSize = bpartSize; + r.bparts = bparts; + r.conversion = 1; + r.convert_bpart_i = functionPtr; + + return r; +} + /** * @brief Construct an #io_props from its parameters * diff --git a/src/star_formation/EAGLE/star_formation.h b/src/star_formation/EAGLE/star_formation.h index 55f1c8d4271b16f63ce00e6d6cac9eaee5a778a6..f2c77e036842b4ca040c58a6bcad1513b03a42bd 100644 --- a/src/star_formation/EAGLE/star_formation.h +++ b/src/star_formation/EAGLE/star_formation.h @@ -687,6 +687,7 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const, * density loop for the EAGLE star formation model. * * @param p Pointer to the particle data. + * @param xp Pointer to the extended particle data. * @param data The global star_formation information. */ __attribute__((always_inline)) INLINE static void star_formation_init_part( diff --git a/src/star_formation/none/star_formation.h b/src/star_formation/none/star_formation.h index 3275e1a4c43ce232d73dbb2f331c1c6e81118ec1..6b83010ec5f8935778af8c9ad21010ff3452fc0e 100644 --- a/src/star_formation/none/star_formation.h +++ b/src/star_formation/none/star_formation.h @@ -216,6 +216,7 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const, * Nothing to do here. * * @param p Pointer to the particle data. + * @param xp Pointer to the extended particle data. * @param data The global star_formation information. */ __attribute__((always_inline)) INLINE static void star_formation_init_part( diff --git a/src/stars/Default/stars_io.h b/src/stars/Default/stars_io.h index 2a824aaa9954f48de8653b5a0b6c6a3b839aa2c9..54e6b5d05a823cb8401ec01c4fe962bbc8f01ca8 100644 --- a/src/stars/Default/stars_io.h +++ b/src/stars/Default/stars_io.h @@ -102,6 +102,7 @@ INLINE static void convert_spart_vel(const struct engine *e, * @param sparts The s-particle array. * @param list The list of i/o properties to write. * @param num_fields The number of i/o fields to write. + * @param with_cosmology Are we running a cosmological simulation? */ INLINE static void stars_write_particles(const struct spart *sparts, struct io_props *list, int *num_fields, diff --git a/src/stars/EAGLE/stars_io.h b/src/stars/EAGLE/stars_io.h index 8e3f6056921936fdcf86337af165e130cc6e02eb..b67c57078796a4be3d34d828884cedcff808614e 100644 --- a/src/stars/EAGLE/stars_io.h +++ b/src/stars/EAGLE/stars_io.h @@ -105,6 +105,7 @@ INLINE static void convert_spart_vel(const struct engine *e, * @param sparts The s-particle array. * @param list The list of i/o properties to write. * @param num_fields The number of i/o fields to write. + * @param with_cosmology Are we running a cosmological simulation? */ INLINE static void stars_write_particles(const struct spart *sparts, struct io_props *list, int *num_fields, diff --git a/src/units.c b/src/units.c index 58422bfffe6605daed4a4eae4dd0c2755006b2e9..c7fe549aff5d8cbcec77814f40f0682bd0fc3a8c 100644 --- a/src/units.c +++ b/src/units.c @@ -489,7 +489,9 @@ float units_general_h_factor(const struct unit_system* us, * 140 chars at most) * @param us The UnitsSystem in use. * @param baseUnitsExponents The exponent of each base units required to form - * the desired quantity. See conversionFactor() for a working example + * the desired quantity. See conversionFactor() for a working example. + * @param scale_factor_exponent The scale-factor exponent to use to convert this + * unit to physical units. */ void units_general_cgs_conversion_string(char* buffer, const struct unit_system* us,