stardis

Perform coupled heat transfer calculations
git clone git://git.meso-star.fr/stardis.git
Log | Files | Refs | README | LICENSE

commit c1c54add495ef31e6d7ff5529ff98ecda148a51c
parent 85f43486adbc08a0900b84b5eaa0f2a0debf90b3
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Thu,  6 Feb 2020 17:55:24 +0100

Fix warnings

Diffstat:
Msrc/stardis-app.c | 11++++-------
Msrc/stardis-app.h | 48++++++++++++------------------------------------
Msrc/stardis-compute.c | 12++++--------
Msrc/stardis-fluid.c | 12++++++------
Msrc/stardis-intface.c | 24++++++------------------
Msrc/stardis-solid.c | 11++++++-----
6 files changed, 38 insertions(+), 80 deletions(-)

diff --git a/src/stardis-app.c b/src/stardis-app.c @@ -213,12 +213,8 @@ read_triangles sa_push(boundary->sides, current_side); continue; /* Next triangle */ break; - default: { - char msg[1024]; - snprintf(msg, sizeof(msg), "%s (%s: %d): Invalid type.\n", - __FUNCTION__, __FILE__, __LINE__); - FATAL(msg); - } + default: + FATAL("error:" STR(__FILE__) ":" STR(__LINE__)": Invalid type.\n"); } if (*side_desc_ptr != UINT_MAX && *side_desc_ptr != desc_id) { /* Already described with a different description! */ @@ -227,7 +223,8 @@ read_triangles (file_type == CONTENT_CONNECTION ? "connection" : (current_side == SDIS_FRONT ? "front" : "back")), stl_filename); - print_trg_as_obj(stderr, (const struct vertex*)stl_desc->vertices, stl_desc->indices + (3 * tri_index)); + print_trg_as_obj(stderr, (const struct vertex*)stl_desc->vertices, + stl_desc->indices + (3 * tri_index)); return RES_BAD_ARG; } /* Everithing is OK: store description */ diff --git a/src/stardis-app.h b/src/stardis-app.h @@ -884,12 +884,8 @@ print_description case DESC_BOUND_F_FOR_SOLID: print_f_boundary(stream, &desc->d.f_boundary, desc->type); break; - default: { - char msg[1024]; - snprintf(msg, sizeof(msg), "%s (%s: %d): Invalid type.\n", - __FUNCTION__, __FILE__, __LINE__); - FATAL(msg); - } + default: + FATAL("error:" STR(__FILE__) ":" STR(__LINE__)": Invalid type.\n"); } } @@ -912,12 +908,8 @@ eq_description(const struct description* a, const struct description* b) return eq_f_boundary(&a->d.f_boundary, &b->d.f_boundary); case DESC_SOLID_FLUID_CONNECT: return eq_sf_connect(&a->d.sf_connect, &b->d.sf_connect); - default: { - char msg[1024]; - snprintf(msg, sizeof(msg), "%s (%s: %d): Invalid type.\n", - __FUNCTION__, __FILE__, __LINE__); - FATAL(msg); - } + default: + FATAL("error:" STR(__FILE__) ":" STR(__LINE__)": Invalid type.\n"); } } @@ -949,12 +941,8 @@ cp_description(struct description* dst, const struct description* src) return cp_f_boundary(&dst->d.f_boundary, &src->d.f_boundary); case DESC_SOLID_FLUID_CONNECT: return cp_sf_connect(&dst->d.sf_connect, &src->d.sf_connect); - default: { - char msg[1024]; - snprintf(msg, sizeof(msg), "%s (%s: %d): Invalid type.\n", - __FUNCTION__, __FILE__, __LINE__); - FATAL(msg); - } + default: + FATAL("error:" STR(__FILE__) ":" STR(__LINE__)": Invalid type.\n"); } } @@ -980,12 +968,8 @@ cp_release_description(struct description* dst, struct description* src) return cp_release_sf_connect(&dst->d.sf_connect, &src->d.sf_connect); case DESCRIPTION_TYPE_COUNT__: return RES_OK; - default: { - char msg[1024]; - snprintf(msg, sizeof(msg), "%s (%s: %d): Invalid type.\n", - __FUNCTION__, __FILE__, __LINE__); - FATAL(msg); - } + default: + FATAL("error:" STR(__FILE__) ":" STR(__LINE__)": Invalid type.\n"); } } @@ -1010,12 +994,8 @@ release_description(struct description* a) return release_sf_connect(&a->d.sf_connect); case DESCRIPTION_TYPE_COUNT__: return RES_OK; - default: { - char msg[1024]; - snprintf(msg, sizeof(msg), "%s (%s: %d): Invalid type.\n", - __FUNCTION__, __FILE__, __LINE__); - FATAL(msg); - } + default: + FATAL("error:" STR(__FILE__) ":" STR(__LINE__)": Invalid type.\n"); } } @@ -1037,12 +1017,8 @@ hash_description(const struct description* key) return hash_f_boundary(&key->d.f_boundary); case DESC_SOLID_FLUID_CONNECT: return hash_sf_connect(&key->d.sf_connect); - default: { - char msg[1024]; - snprintf(msg, sizeof(msg), "%s (%s: %d): Invalid type.\n", - __FUNCTION__, __FILE__, __LINE__); - FATAL(msg); - } + default: + FATAL("error:" STR(__FILE__) ":" STR(__LINE__)": Invalid type.\n"); } } diff --git a/src/stardis-compute.c b/src/stardis-compute.c @@ -319,12 +319,8 @@ create_holder if (res != RES_OK) goto error; break; - default: { - char msg[1024]; - snprintf(msg, sizeof(msg), "%s (%s: %d): Invalid type.\n", - __FUNCTION__, __FILE__, __LINE__); - FATAL(msg); - } + default: + FATAL("error:" STR(__FILE__) ":" STR(__LINE__)": Invalid type.\n"); } end: @@ -832,7 +828,7 @@ stardis_compute sa_size(stardis->geometry.vertex), geometry_get_position, &stardis->geometry, &scn); if(res != RES_OK) { - fprintf(stderr, "%s: could not setup the scene!\n", __FUNCTION__); + fprintf(stderr, "%s: could not setup the scene!\n", FUNC_NAME); goto error; } @@ -857,7 +853,7 @@ stardis_compute res = compute_map(scn, stardis, mode); else FATAL("Unknown mode.\n"); if(res != RES_OK) { - fprintf(stderr, "%s: computation failed!\n", __FUNCTION__); + fprintf(stderr, "%s: computation failed!\n", FUNC_NAME); goto error; } diff --git a/src/stardis-fluid.c b/src/stardis-fluid.c @@ -37,7 +37,6 @@ fluid_get_temperature struct sdis_data* data) { const struct fluid* fluid_props = sdis_data_cget(data); - char msg[128]; ASSERT(fluid_props->t_init || fluid_props->temp); if (fluid_props->is_green || vtx->time > fluid_props->t0) { /* Always use temp for Green mode, regardless of time */ @@ -49,13 +48,14 @@ fluid_get_temperature if (fluid_props->t_init) return te_eval(fluid_props->t_init, vtx); /* Must have had t_init defined: error! */ - if (fluid_props->name[0]) - snprintf(msg, sizeof(msg), + if (fluid_props->name[0]) { + fprintf(stderr, "fluid_get_temperature: getting undefined Tinit (fluid '%s')\n", fluid_props->name); - else - snprintf(msg, sizeof(msg), "fluid_get_temperature: getting undefined Tinit\n"); - FATAL(msg); + ASSERT(0); + abort(); + } else + FATAL("fluid_get_temperature: getting undefined Tinit\n"); } static void diff --git a/src/stardis-intface.c b/src/stardis-intface.c @@ -147,12 +147,8 @@ create_intface front_med = media[id]; fluid_side_shader = &interface_shader.front; break; - default: { - char msg[1024]; - snprintf(msg, sizeof(msg), "%s (%s: %d): Invalid type.\n", - __FUNCTION__, __FILE__, __LINE__); - FATAL(msg); - } + default: + FATAL("error:" STR(__FILE__) ":" STR(__LINE__)": Invalid type.\n"); } } if (back_defined) { @@ -168,12 +164,8 @@ create_intface back_med = media[id]; fluid_side_shader = &interface_shader.back; break; - default: { - char msg[1024]; - snprintf(msg, sizeof(msg), "%s (%s: %d): Invalid type.\n", - __FUNCTION__, __FILE__, __LINE__); - FATAL(msg); - } + default: + FATAL("error:" STR(__FILE__) ":" STR(__LINE__)": Invalid type.\n"); } } if (connect_defined) { @@ -321,12 +313,8 @@ create_intface interface_props->alpha = connect->d.sf_connect.specular_fraction; } break; - default: { - char msg[1024]; - snprintf(msg, sizeof(msg), "%s (%s: %d): Invalid type.\n", - __FUNCTION__, __FILE__, __LINE__); - FATAL(msg); - } + default: + FATAL("error:" STR(__FILE__) ":" STR(__LINE__)": Invalid type.\n"); } } diff --git a/src/stardis-solid.c b/src/stardis-solid.c @@ -83,13 +83,14 @@ solid_get_temperature if (solid_props->t_init) return te_eval(solid_props->t_init, vtx); /* Must have had t_init defined: error! */ - if (solid_props->name[0]) - snprintf(msg, sizeof(msg), + if (solid_props->name[0]) { + fprintf(stderr, "solid_get_temperature: getting undefined Tinit (solid '%s')\n", solid_props->name); - else - snprintf(msg, sizeof(msg), "solid_get_temperature: getting undefined Tinit\n"); - FATAL(msg); + ASSERT(0); + abort(); + } else + FATAL("solid_get_temperature: getting undefined Tinit\n"); } static double