gitlab is upgraded to version 13, please report any issues and enjoy

Commit 4a585ee4 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Make ICC happy with our handling of enumerated types.

parent e33b6ff6
......@@ -27,7 +27,7 @@
* @brief The two sorts of data present in the GADGET IC files: compulsory to
* start a run or optional.
*/
enum DATA_IMPORTANCE { COMPULSORY = 1, OPTIONAL = 0 };
enum DATA_IMPORTANCE { COMPULSORY = 1, OPTIONAL = 0, UNUSED = -1 };
/**
* @brief The properties of a given dataset for i/o
......@@ -134,7 +134,7 @@ struct io_props io_make_output_field_(char name[FIELD_BUFFER_SIZE],
strcpy(r.name, name);
r.type = type;
r.dimension = dimension;
r.importance = 0;
r.importance = UNUSED;
r.units = units;
r.field = field;
r.partSize = partSize;
......@@ -178,7 +178,7 @@ struct io_props io_make_output_field_convert_part_(
strcpy(r.name, name);
r.type = type;
r.dimension = dimension;
r.importance = 0;
r.importance = UNUSED;
r.units = units;
r.field = field;
r.partSize = partSize;
......@@ -222,7 +222,7 @@ struct io_props io_make_output_field_convert_gpart_(
strcpy(r.name, name);
r.type = type;
r.dimension = dimension;
r.importance = 0;
r.importance = UNUSED;
r.units = units;
r.field = field;
r.partSize = partSize;
......
......@@ -767,7 +767,8 @@ void write_output_parallel(struct engine* e, const char* baseName,
/* Add the global information for that particle type to
* the XMF meta-file */
if (mpi_rank == 0)
writeXMFgroupheader(xmfFile, fileName, N_total[ptype], ptype);
writeXMFgroupheader(xmfFile, fileName, N_total[ptype],
(enum PARTICLE_TYPE)ptype);
/* Open the particle group in the file */
char partTypeGroupName[PARTICLE_GROUP_BUFFER_SIZE];
......@@ -828,7 +829,7 @@ void write_output_parallel(struct engine* e, const char* baseName,
H5Gclose(h_grp);
/* Close this particle group in the XMF file as well */
if (mpi_rank == 0) writeXMFgroupfooter(xmfFile, ptype);
if (mpi_rank == 0) writeXMFgroupfooter(xmfFile, (enum PARTICLE_TYPE)ptype);
}
/* Write LXMF file descriptor */
......
......@@ -498,8 +498,8 @@ void scheduler_splittasks(struct scheduler *s) {
/* Create the sort for ci. */
// lock_lock( &ci->lock );
if (ci->sorts == NULL)
ci->sorts =
scheduler_addtask(s, task_type_sort, 0, 1 << sid, 0, ci, NULL, 0);
ci->sorts = scheduler_addtask(s, task_type_sort, task_subtype_none,
1 << sid, 0, ci, NULL, 0);
else
ci->sorts->flags |= (1 << sid);
// lock_unlock_blind( &ci->lock );
......@@ -508,8 +508,8 @@ void scheduler_splittasks(struct scheduler *s) {
/* Create the sort for cj. */
// lock_lock( &cj->lock );
if (cj->sorts == NULL)
cj->sorts =
scheduler_addtask(s, task_type_sort, 0, 1 << sid, 0, cj, NULL, 0);
cj->sorts = scheduler_addtask(s, task_type_sort, task_subtype_none,
1 << sid, 0, cj, NULL, 0);
else
cj->sorts->flags |= (1 << sid);
// lock_unlock_blind( &cj->lock );
......@@ -534,9 +534,9 @@ void scheduler_splittasks(struct scheduler *s) {
* @param tight
*/
struct task *scheduler_addtask(struct scheduler *s, int type, int subtype,
int flags, int wait, struct cell *ci,
struct cell *cj, int tight) {
struct task *scheduler_addtask(struct scheduler *s, enum task_types type,
enum task_subtypes subtype, int flags, int wait,
struct cell *ci, struct cell *cj, int tight) {
/* Get the next free task. */
const int ind = atomic_inc(&s->tasks_next);
......
......@@ -112,9 +112,9 @@ void scheduler_start(struct scheduler *s, unsigned int mask,
void scheduler_reset(struct scheduler *s, int nr_tasks);
void scheduler_ranktasks(struct scheduler *s);
void scheduler_reweight(struct scheduler *s);
struct task *scheduler_addtask(struct scheduler *s, int type, int subtype,
int flags, int wait, struct cell *ci,
struct cell *cj, int tight);
struct task *scheduler_addtask(struct scheduler *s, enum task_types type,
enum task_subtypes subtype, int flags, int wait,
struct cell *ci, struct cell *cj, int tight);
void scheduler_splittasks(struct scheduler *s);
struct task *scheduler_done(struct scheduler *s, struct task *t);
struct task *scheduler_unlock(struct scheduler *s, struct task *t);
......
......@@ -859,7 +859,8 @@ void write_output_serial(struct engine* e, const char* baseName,
/* Add the global information for that particle type to the XMF
* meta-file */
if (mpi_rank == 0)
writeXMFgroupheader(xmfFile, fileName, N_total[ptype], ptype);
writeXMFgroupheader(xmfFile, fileName, N_total[ptype],
(enum PARTICLE_TYPE)ptype);
/* Open the particle group in the file */
char partTypeGroupName[PARTICLE_GROUP_BUFFER_SIZE];
......@@ -915,7 +916,8 @@ void write_output_serial(struct engine* e, const char* baseName,
H5Gclose(h_grp);
/* Close this particle group in the XMF file as well */
if (mpi_rank == 0) writeXMFgroupfooter(xmfFile, ptype);
if (mpi_rank == 0)
writeXMFgroupfooter(xmfFile, (enum PARTICLE_TYPE)ptype);
}
/* Close file */
......
......@@ -669,7 +669,8 @@ void write_output_single(struct engine* e, const char* baseName,
if (numParticles[ptype] == 0) continue;
/* Add the global information for that particle type to the XMF meta-file */
writeXMFgroupheader(xmfFile, fileName, numParticles[ptype], ptype);
writeXMFgroupheader(xmfFile, fileName, numParticles[ptype],
(enum PARTICLE_TYPE)ptype);
/* Open the particle group in the file */
char partTypeGroupName[PARTICLE_GROUP_BUFFER_SIZE];
......@@ -724,7 +725,7 @@ void write_output_single(struct engine* e, const char* baseName,
H5Gclose(h_grp);
/* Close this particle group in the XMF file as well */
writeXMFgroupfooter(xmfFile, ptype);
writeXMFgroupfooter(xmfFile, (enum PARTICLE_TYPE)ptype);
}
/* Write LXMF file descriptor */
......
......@@ -385,11 +385,11 @@ void units_cgs_conversion_string(char* buffer, const struct UnitSystem* us,
double units_general_cgs_conversion_factor(const struct UnitSystem* us,
const float baseUnitsExponants[5]) {
double factor = 1.;
int i;
for (i = 0; i < 5; ++i)
for (int i = 0; i < 5; ++i)
if (baseUnitsExponants[i] != 0)
factor *= pow(units_get_base_unit(us, i), baseUnitsExponants[i]);
factor *= pow(units_get_base_unit(us, (enum BaseUnits)i),
baseUnitsExponants[i]);
return factor;
}
......@@ -440,13 +440,12 @@ void units_general_cgs_conversion_string(char* buffer,
const struct UnitSystem* us,
const float baseUnitsExponants[5]) {
char temp[14];
double a_exp = units_general_a_factor(us, baseUnitsExponants);
double h_exp = units_general_h_factor(us, baseUnitsExponants);
int i;
const double a_exp = units_general_a_factor(us, baseUnitsExponants);
const double h_exp = units_general_h_factor(us, baseUnitsExponants);
/* Check whether we are unitless or not */
char isAllNonZero = 1;
for (i = 0; i < 5; ++i)
for (int i = 0; i < 5; ++i)
if (baseUnitsExponants[i] != 0.) isAllNonZero = 0;
if (isAllNonZero) {
......@@ -476,17 +475,20 @@ void units_general_cgs_conversion_string(char* buffer,
strncat(buffer, temp, 12);
/* Add conversion units */
for (i = 0; i < 5; ++i)
for (int i = 0; i < 5; ++i)
if (baseUnitsExponants[i] != 0) {
if (baseUnitsExponants[i] == 0.)
sprintf(temp, " ");
else if (baseUnitsExponants[i] == 1.)
sprintf(temp, "%s ", units_get_base_unit_internal_symbol(i));
sprintf(temp, "%s ",
units_get_base_unit_internal_symbol((enum BaseUnits)i));
else if (remainder(baseUnitsExponants[i], 1.) == 0)
sprintf(temp, "%s^%d ", units_get_base_unit_internal_symbol(i),
sprintf(temp, "%s^%d ",
units_get_base_unit_internal_symbol((enum BaseUnits)i),
(int)baseUnitsExponants[i]);
else
sprintf(temp, "%s^%7.4f ", units_get_base_unit_internal_symbol(i),
sprintf(temp, "%s^%7.4f ",
units_get_base_unit_internal_symbol((enum BaseUnits)i),
baseUnitsExponants[i]);
strncat(buffer, temp, 12);
}
......@@ -494,17 +496,19 @@ void units_general_cgs_conversion_string(char* buffer,
/* Add CGS units */
strncat(buffer, " [ ", 3);
for (i = 0; i < 5; ++i) {
for (int i = 0; i < 5; ++i) {
if (baseUnitsExponants[i] != 0) {
if (baseUnitsExponants[i] == 0.)
continue;
else if (baseUnitsExponants[i] == 1.)
sprintf(temp, "%s ", units_get_base_unit_cgs_symbol(i));
sprintf(temp, "%s ", units_get_base_unit_cgs_symbol((enum BaseUnits)i));
else if (remainder(baseUnitsExponants[i], 1.) == 0)
sprintf(temp, "%s^%d ", units_get_base_unit_cgs_symbol(i),
sprintf(temp, "%s^%d ",
units_get_base_unit_cgs_symbol((enum BaseUnits)i),
(int)baseUnitsExponants[i]);
else
sprintf(temp, "%s^%7.4f ", units_get_base_unit_cgs_symbol(i),
sprintf(temp, "%s^%7.4f ",
units_get_base_unit_cgs_symbol((enum BaseUnits)i),
baseUnitsExponants[i]);
strncat(buffer, temp, 12);
}
......
......@@ -253,7 +253,7 @@ int main(int argc, char *argv[]) {
double perturbation = 0.;
char outputFileNameExtension[200] = "";
char outputFileName[200] = "";
int vel = velocity_zero;
enum velocity_types vel = velocity_zero;
/* Initialize CPU frequency, this also starts time. */
unsigned long long cpufreq = 0;
......
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