tchange some vars to int, fix i/o - granular - granular dynamics simulation
(HTM) git clone git://src.adamsgaard.dk/granular
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 1cf1a4e153da238d577b6fa522b1f66d968d0e1d
(DIR) parent 7d5760dc6d678e68b3f8c177da45149e94358d23
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Sun, 21 Mar 2021 10:47:39 +0100
change some vars to int, fix i/o
Diffstat:
M grain.c | 22 +++++++++++-----------
M grain.h | 8 ++++----
M util.c | 2 +-
M util.h | 2 +-
4 files changed, 17 insertions(+), 17 deletions(-)
---
(DIR) diff --git a/grain.c b/grain.c
t@@ -85,9 +85,9 @@ grain_print(FILE *stream, const struct grain *g)
print_padded_nd_double(stream, g->disp);
print_padded_nd_double(stream, g->forceext);
fprintf(stream, "%.*g\t", FLOATPREC, g->density);
- fprintf(stream, "%zu\t", g->fixed);
- fprintf(stream, "%zu\t", g->rotating);
- fprintf(stream, "%zu\t", g->enabled);
+ fprintf(stream, "%d\t", g->fixed);
+ fprintf(stream, "%d\t", g->rotating);
+ fprintf(stream, "%d\t", g->enabled);
fprintf(stream, "%.*g\t", FLOATPREC, g->youngs_modulus);
fprintf(stream, "%.*g\t", FLOATPREC, g->poissons_ratio);
fprintf(stream, "%.*g\t", FLOATPREC, g->friction_coeff);
t@@ -98,7 +98,7 @@ grain_print(FILE *stream, const struct grain *g)
fprintf(stream, "%zu\t", g->ncontacts);
print_padded_nd_double(stream, g->contact_stress);
fprintf(stream, "%.*g\t", FLOATPREC, g->thermal_energy);
- fprintf(stream, "%zu\n", g->color);
+ fprintf(stream, "%d\n", g->color);
}
struct grain *
t@@ -121,9 +121,9 @@ grain_read(char *line)
"%lg\t%lg\t%lg\t" /* disp */
"%lg\t%lg\t%lg\t" /* forceext */
"%lg\t" /* density */
- "%zu\t" /* fixed */
- "%zu\t" /* rotating */
- "%zu\t" /* enabled */
+ "%d\t" /* fixed */
+ "%d\t" /* rotating */
+ "%d\t" /* enabled */
"%lg\t" /* youngs_modulus */
"%lg\t" /* poissons_ratio */
"%lg\t" /* friction_coeff */
t@@ -134,7 +134,7 @@ grain_read(char *line)
"%zu\t" /* ncontacts */
"%lg\t%lg\t%lg\t" /* contact_stress */
"%lg\t" /* thermal_energy */
- "%zu\n", /* color */
+ "%d\n", /* color */
&g->radius,
&g->pos[0], &g->pos[1], &g->pos[2],
&g->vel[0], &g->vel[1], &g->vel[2],
t@@ -191,9 +191,9 @@ grain_check_values(const struct grain *g)
check_float("grain->contact_stress", g->contact_stress[i], &status);
}
- check_bool("grain->fixed", g->fixed, &status);
- check_bool("grain->rotating", g->rotating, &status);
- check_bool("grain->enabled", g->enabled, &status);
+ check_int_bool("grain->fixed", g->fixed, &status);
+ check_int_bool("grain->rotating", g->rotating, &status);
+ check_int_bool("grain->enabled", g->enabled, &status);
check_float_non_negative("grain->youngs_modulus",
g->youngs_modulus,
(DIR) diff --git a/grain.h b/grain.h
t@@ -15,9 +15,9 @@ struct grain {
double disp[3];
double forceext[3];
double density;
- size_t fixed;
- size_t rotating;
- size_t enabled;
+ int fixed;
+ int rotating;
+ int enabled;
double youngs_modulus;
double poissons_ratio;
double friction_coeff;
t@@ -28,7 +28,7 @@ struct grain {
size_t ncontacts;
double contact_stress[3];
double thermal_energy;
- size_t color;
+ int color;
};
struct grain grain_new(void);
(DIR) diff --git a/util.c b/util.c
t@@ -57,7 +57,7 @@ check_float_positive(const char name[], const double value, int *status)
}
void
-check_bool(const char name[], const int value, int *status)
+check_int_bool(const char name[], const int value, int *status)
{
char message[100];
(DIR) diff --git a/util.h b/util.h
t@@ -7,7 +7,7 @@ void warn_parameter_value(const char message[], const double value, int *status)
void check_float(const char name[], const double value, int *status);
void check_float_non_negative(const char name[], const double value, int *status);
void check_float_positive(const char name[], const double value, int *status);
-void check_bool(const char name[], const double value, int *status);
+void check_int_bool(const char name[], const int value, int *status);
void check_int_non_negative(const char name[], const int value, int *status);
double residual(const double new_val, const double old_val);