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

Documentation and i/o fixes.

parent 9b480645
No related branches found
No related tags found
No related merge requests found
...@@ -466,25 +466,34 @@ INLINE static struct io_props io_make_output_field_convert_part_LONGLONG( ...@@ -466,25 +466,34 @@ INLINE static struct io_props io_make_output_field_convert_part_LONGLONG(
* @param type The type of the data * @param type The type of the data
* @param dimension Dataset dimension (1D, 3D, ...) * @param dimension Dataset dimension (1D, 3D, ...)
* @param units The units of the dataset * @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 gpartSize The size in byte of the particle
* @param gparts The particle array * @param gparts The particle array
* @param functionPtr The function used to convert a g-particle to a float * @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. * Do not call this function directly. Use the macro defined above.
*/ */
INLINE static struct io_props io_make_output_field_convert_gpart_INT( 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, const char name[FIELD_BUFFER_SIZE], enum IO_DATA_TYPE type, int dimension,
enum unit_conversion_factor units, size_t gpartSize, enum unit_conversion_factor units, float a_exponent, size_t gpartSize,
const struct gpart* gparts, conversion_func_gpart_int functionPtr) { const struct gpart* gparts, conversion_func_gpart_int functionPtr,
const char description[DESCRIPTION_BUFFER_SIZE]) {
struct io_props r; struct io_props r;
bzero(&r, sizeof(struct io_props)); bzero(&r, sizeof(struct io_props));
strcpy(r.name, name); strcpy(r.name, name);
if (strlen(description) == 0) {
sprintf(r.description, "No description given");
} else {
strcpy(r.description, description);
}
r.type = type; r.type = type;
r.dimension = dimension; r.dimension = dimension;
r.importance = UNUSED; r.importance = UNUSED;
r.units = units; r.units = units;
r.scale_factor_exponent = a_exponent;
r.partSize = gpartSize; r.partSize = gpartSize;
r.gparts = gparts; r.gparts = gparts;
r.conversion = 1; r.conversion = 1;
...@@ -500,9 +509,11 @@ INLINE static struct io_props io_make_output_field_convert_gpart_INT( ...@@ -500,9 +509,11 @@ INLINE static struct io_props io_make_output_field_convert_gpart_INT(
* @param type The type of the data * @param type The type of the data
* @param dimension Dataset dimension (1D, 3D, ...) * @param dimension Dataset dimension (1D, 3D, ...)
* @param units The units of the dataset * @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 gpartSize The size in byte of the particle
* @param gparts The particle array * @param gparts The particle array
* @param functionPtr The function used to convert a g-particle to a float * @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. * 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( ...@@ -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 a_exponent Exponent of the scale-factor to convert to physical units.
* @param spartSize The size in byte of the particle * @param spartSize The size in byte of the particle
* @param sparts The particle array * @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. * Do not call this function directly. Use the macro defined above.
*/ */
INLINE static struct io_props io_make_output_field_convert_spart_INT( 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, const char name[FIELD_BUFFER_SIZE], enum IO_DATA_TYPE type, int dimension,
enum unit_conversion_factor units, size_t spartSize, enum unit_conversion_factor units, float a_exponent, size_t spartSize,
const struct spart* sparts, conversion_func_spart_int functionPtr) { const struct spart* sparts, conversion_func_spart_int functionPtr,
const char description[DESCRIPTION_BUFFER_SIZE]) {
struct io_props r; struct io_props r;
bzero(&r, sizeof(struct io_props)); bzero(&r, sizeof(struct io_props));
strcpy(r.name, name); strcpy(r.name, name);
if (strlen(description) == 0) {
sprintf(r.description, "No description given");
} else {
strcpy(r.description, description);
}
r.type = type; r.type = type;
r.dimension = dimension; r.dimension = dimension;
r.importance = UNUSED; r.importance = UNUSED;
r.units = units; r.units = units;
r.scale_factor_exponent = a_exponent;
r.partSize = spartSize; r.partSize = spartSize;
r.sparts = sparts; r.sparts = sparts;
r.conversion = 1; r.conversion = 1;
...@@ -671,9 +690,11 @@ INLINE static struct io_props io_make_output_field_convert_spart_INT( ...@@ -671,9 +690,11 @@ INLINE static struct io_props io_make_output_field_convert_spart_INT(
* @param type The type of the data * @param type The type of the data
* @param dimension Dataset dimension (1D, 3D, ...) * @param dimension Dataset dimension (1D, 3D, ...)
* @param units The units of the dataset * @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 spartSize The size in byte of the particle
* @param sparts The particle array * @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 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. * 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( ...@@ -800,6 +821,49 @@ INLINE static struct io_props io_make_output_field_convert_spart_LONGLONG(
a_exponent, sizeof(bpart[0]), \ a_exponent, sizeof(bpart[0]), \
bpart, convert, desc) 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 * @brief Construct an #io_props from its parameters
* *
......
...@@ -687,6 +687,7 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const, ...@@ -687,6 +687,7 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const,
* density loop for the EAGLE star formation model. * density loop for the EAGLE star formation model.
* *
* @param p Pointer to the particle data. * @param p Pointer to the particle data.
* @param xp Pointer to the extended particle data.
* @param data The global star_formation information. * @param data The global star_formation information.
*/ */
__attribute__((always_inline)) INLINE static void star_formation_init_part( __attribute__((always_inline)) INLINE static void star_formation_init_part(
......
...@@ -216,6 +216,7 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const, ...@@ -216,6 +216,7 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const,
* Nothing to do here. * Nothing to do here.
* *
* @param p Pointer to the particle data. * @param p Pointer to the particle data.
* @param xp Pointer to the extended particle data.
* @param data The global star_formation information. * @param data The global star_formation information.
*/ */
__attribute__((always_inline)) INLINE static void star_formation_init_part( __attribute__((always_inline)) INLINE static void star_formation_init_part(
......
...@@ -102,6 +102,7 @@ INLINE static void convert_spart_vel(const struct engine *e, ...@@ -102,6 +102,7 @@ INLINE static void convert_spart_vel(const struct engine *e,
* @param sparts The s-particle array. * @param sparts The s-particle array.
* @param list The list of i/o properties to write. * @param list The list of i/o properties to write.
* @param num_fields The number of i/o fields 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, INLINE static void stars_write_particles(const struct spart *sparts,
struct io_props *list, int *num_fields, struct io_props *list, int *num_fields,
......
...@@ -105,6 +105,7 @@ INLINE static void convert_spart_vel(const struct engine *e, ...@@ -105,6 +105,7 @@ INLINE static void convert_spart_vel(const struct engine *e,
* @param sparts The s-particle array. * @param sparts The s-particle array.
* @param list The list of i/o properties to write. * @param list The list of i/o properties to write.
* @param num_fields The number of i/o fields 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, INLINE static void stars_write_particles(const struct spart *sparts,
struct io_props *list, int *num_fields, struct io_props *list, int *num_fields,
......
...@@ -489,7 +489,9 @@ float units_general_h_factor(const struct unit_system* us, ...@@ -489,7 +489,9 @@ float units_general_h_factor(const struct unit_system* us,
* 140 chars at most) * 140 chars at most)
* @param us The UnitsSystem in use. * @param us The UnitsSystem in use.
* @param baseUnitsExponents The exponent of each base units required to form * @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, void units_general_cgs_conversion_string(char* buffer,
const struct unit_system* us, const struct unit_system* us,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment