stardis

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

commit d71dcd634c52d1b31402157250f33b6c808342d6
parent 58f40f4f4f9b7c2010ce8dc9a5971bec69276638
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri, 12 Jun 2020 14:23:59 +0200

Add overlapping triangles in dumps

Diffstat:
Msrc/stardis-app.c | 16+++++++++++++---
Msrc/stardis-main.c | 15++++++++++-----
Msrc/stardis-output.c | 16+++++++++++++++-
3 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/src/stardis-app.c b/src/stardis-app.c @@ -506,7 +506,7 @@ stardis_init struct dummies dummies = DUMMIES_NULL; struct htable_intface htable_interfaces; struct str str; - unsigned i, vcount, tcount, count; + unsigned i, vcount, tcount, ocount, count; int is_for_compute; ASSERT(args && logger && allocator && stardis); @@ -617,6 +617,16 @@ stardis_init res = tmp_res; goto error; } + ERR(senc3d_scene_get_overlapping_triangles_count(stardis->senc3d_scn, &ocount)); + if(ocount) { + logger_print(stardis->logger, (is_for_compute ? LOG_ERROR : LOG_WARNING), + "Scene contains %u overlapping triangles.\n", + ocount); + if(is_for_compute) { + res = RES_BAD_ARG; + goto error; + } + } /* Create media and property holders for those found in descriptions */ for(i = 0; i < darray_descriptions_size_get(&stardis->descriptions); i++) { @@ -665,11 +675,11 @@ stardis_init &create_context, &stardis->sdis_scn); if(res != RES_OK) { logger_print(stardis->logger, LOG_ERROR, - "Cannot create the stardis solver scene, no computation possible.\n"); + "Cannot create the stardis solver scene.\n"); goto error; } } - + exit: str_release(&str); htable_intface_release(&htable_interfaces); diff --git a/src/stardis-main.c b/src/stardis-main.c @@ -37,6 +37,7 @@ main int err = EXIT_SUCCESS; struct mem_allocator allocator; struct logger logger; + int mode = 0; res_T res = RES_OK; ERR(mem_init_proxy_allocator(&allocator, &mem_default_allocator)); @@ -52,12 +53,13 @@ main ERR(init_args(&logger, &allocator, &args)); args_initialized = 1; ERR(parse_args(argc, argv, args)); + mode = args->mode; - if(args->mode & MODE_DUMP_HELP) { + if(mode & MODE_DUMP_HELP) { short_help(stdout, argv[0]); goto exit; } - else if(args->mode & MODE_DUMP_VERSION) { + else if(mode & MODE_DUMP_VERSION) { print_version(stdout); goto exit; } @@ -75,11 +77,11 @@ main release_args(args); args_initialized = 0; - if(stardis.mode & MODE_DUMP_VTK) { + if(mode & MODE_DUMP_VTK) { /* Dump all the app-independent information */ ERR(sg3d_geometry_dump_as_vtk(stardis.geometry.sg3d, stdout)); /* Dump the compute region if any */ - if(stardis.mode & REGION_COMPUTE_MODES) { + if(mode & REGION_COMPUTE_MODES) { ERR(dump_compute_region_at_the_end_of_vtk(&stardis, stdout)); } /* Dump enclosures and related information @@ -91,7 +93,7 @@ main goto exit; } - ASSERT(stardis.mode & COMPUTE_MODES); + ASSERT(mode & COMPUTE_MODES); ERR(stardis_compute(&stardis)); exit: @@ -110,6 +112,9 @@ exit: } return err; error: + if(mode & COMPUTE_MODES) + logger_print(&logger, LOG_ERROR, + "No computation possible.\n"); err = EXIT_FAILURE; goto exit; } diff --git a/src/stardis-output.c b/src/stardis-output.c @@ -821,7 +821,7 @@ dump_enclosure_related_stuff_at_the_end_of_vtk res_T res = RES_OK; unsigned* trgs = NULL; struct senc3d_enclosure* enc = NULL; - unsigned tsz, e, s, t, scount, ecount; + unsigned tsz, e, s, t, scount, ecount, ocount; int* enc_status = NULL; int invalid_enclosures_count = 0; ASSERT(stardis && stream); @@ -848,6 +848,20 @@ dump_enclosure_related_stuff_at_the_end_of_vtk FOR_EACH(t, 0, tsz) fprintf(stream, "%u\n", trgs[t]); } + /* Dump overlapping triangles information */ + ERR(senc3d_scene_get_overlapping_triangles_count(stardis->senc3d_scn, &ocount)); + if(ocount) { + FOR_EACH(t, 0, tsz) trgs[t] = 0; + FOR_EACH(t, 0, ocount) { + unsigned trid; + ERR(senc3d_scene_get_overlapping_triangle(stardis->senc3d_scn, t, &trid)); + trgs[trid] = 1; + } + fprintf(stream, "SCALARS Overlapping_triangles unsigned_int 1\n"); + fprintf(stream, "LOOKUP_TABLE default\n"); + FOR_EACH(t, 0, tsz) fprintf(stream, "%u\n", trgs[t]); + } + /* Dump enclosure information */ ERR(senc3d_scene_get_enclosure_count(stardis->senc3d_scn, &ecount)); enc_status = MEM_CALLOC(stardis->allocator, ecount, sizeof(*enc_status));