commit ca91294a00837991d382c14845b5d184c13291c3
parent 9963e18d2a5226c046fec6aa328245814831f472
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Mon, 11 May 2020 15:14:08 +0200
Add _err suffix for failure path dumps
Diffstat:
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/doc/stardis.1.txt.in b/doc/stardis.1.txt.in
@@ -187,7 +187,8 @@ options that write to _standard output_ (-g, -h, -R, -v).
file per path. Possible values for *type* are *error* (write paths ending
in error), *success* (write successful paths), and *all* (write all paths).
Actual file names are produced by appending *files_name_prefix* and the path
- rank starting at index 00000000: prefix00000000.vtk, prefix00000001.vtk, ...
+ rank starting at index 00000000, and possibly followed by *_err* for failure
+ paths: prefix00000000.vtk, prefix00000001_err.vtk, ...
+
This option can only be used in conjuction with options that compute a
result (-F, -m, -P, -p, -R, -S, -s) and cannot be used in conjunction with
diff --git a/src/stardis-app.h b/src/stardis-app.h
@@ -775,7 +775,7 @@ struct stardis {
struct mem_allocator* allocator;
struct logger* logger;
struct sdis_device* dev;
- enum sdis_heat_path_flag dump_paths;
+ int dump_paths;
int verbose;
};
diff --git a/src/stardis-output.c b/src/stardis-output.c
@@ -163,14 +163,17 @@ dump_path
&& dump_ctx->stardis
&& !str_is_empty(&dump_ctx->stardis->paths_filename));
- name_sz = 16 + str_len(&dump_ctx->stardis->paths_filename);
+ ERR(sdis_heat_path_get_status(path, &status));
+
+ name_sz = 20 + str_len(&dump_ctx->stardis->paths_filename);
name = MEM_CALLOC(dump_ctx->stardis->allocator, name_sz, sizeof(*name));
if(!name) {
res = RES_MEM_ERR;
goto error;
}
- snprintf(name, name_sz, "%s%08zu.vtk",
- str_cget(&dump_ctx->stardis->paths_filename), dump_ctx->rank++);
+ snprintf(name, name_sz, "%s%08zu%s.vtk",
+ str_cget(&dump_ctx->stardis->paths_filename), dump_ctx->rank++,
+ (status == SDIS_HEAT_PATH_FAILURE ? "_err" : ""));
stream = fopen(name, "w");
if(!stream) {
@@ -200,7 +203,6 @@ dump_path
fprintf(stream, "CELL_DATA %d\n", 1);
fprintf(stream, "SCALARS Path_Type unsigned_char 1\n");
fprintf(stream, "LOOKUP_TABLE default\n");
- ERR(sdis_heat_path_get_status(path, &status));
switch (status) {
case SDIS_HEAT_PATH_SUCCESS: fprintf(stream, "0\n"); break;
case SDIS_HEAT_PATH_FAILURE: fprintf(stream, "1\n"); break;