commit 91a9c2f2ad40114caa16ae2333893e7dc08d77fe
parent 268f08c07a0817bc99238f43658a8b8b973bd98a
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 23 May 2025 11:38:09 +0200
Revert "The suvm-map-data utility now writes the mapped data"
This reverts commit 268f08c07a0817bc99238f43658a8b8b973bd98a.
Diffstat:
| M | src/suvm_map_data.c | | | 71 | ----------------------------------------------------------------------- |
1 file changed, 0 insertions(+), 71 deletions(-)
diff --git a/src/suvm_map_data.c b/src/suvm_map_data.c
@@ -166,74 +166,6 @@ error:
}
static res_T
-write_data(struct cmd* cmd)
-{
- struct smsh_desc desc = SMSH_DESC_NULL;
- struct txtrdr* txtrdr = NULL;
- char* line = NULL;
- char* tk = NULL;
- char* tk_ctx = NULL;
- size_t ndata = 0;
- res_T res = RES_OK;
-
- ASSERT(cmd);
-
- if(cmd->data == NULL) goto exit; /* No data */
-
- SMSH(get_desc(cmd->mesh, &desc));
- ASSERT(desc.dnode == 3);
- ASSERT(desc.dcell == 4);
-
- res = txtrdr_stream(NULL, cmd->data, "stream", '#', &txtrdr);
- if(res != RES_OK) goto error;
-
- if((res = txtrdr_read_line(txtrdr)) != RES_OK) goto error;
- if((line = txtrdr_get_line(txtrdr)) == NULL) goto exit; /* No data */
-
- #define FPRINTF(...) { \
- if(fprintf(cmd->output, __VA_ARGS__) < 0) { \
- fprintf(stderr, "data read error -- %s\n", strerror(errno)); \
- res = RES_IO_ERR; \
- goto error; \
- } \
- } (void)0
-
- FPRINTF("CELL_DATA %zu\n", desc.ncells);
- FPRINTF("SCALARS map-data float 1\n");
- FPRINTF("LOOKUP_TABLE default\n");
-
- do {
- float data = 0;
-
- if((tk = strtok_r(line, " \t", &tk_ctx)) == NULL) {
- res = RES_BAD_ARG;
- goto error;
- }
-
- if((res != cstr_to_float(tk, &data)) != RES_OK) {
- fprintf(stderr, "%s:%zu: invalid data '%s'\n",
- txtrdr_get_name(txtrdr), txtrdr_get_line_num(txtrdr), tk);
- goto error;
- }
- FPRINTF("%f\n", data);
- ++ndata;
-
- if((res = txtrdr_read_line(txtrdr)) != RES_OK) goto error;
- } while(ndata < desc.ncells && (line = txtrdr_get_line(txtrdr)) != NULL);
-
- #undef FPRINTF
-
- for(; ndata < desc.ncells; fprintf(stderr, "0\n"), ++ndata);
-
-exit:
- if(txtrdr) txtrdr_ref_put(txtrdr);
- return res;
-error:
- fprintf(stderr, "map data error -- %s\n", res_to_cstr(res));
- goto exit;
-}
-
-static res_T
setup_mesh(struct cmd* cmd, const struct args* args)
{
struct smsh_create_args create_args = SMSH_CREATE_ARGS_DEFAULT;
@@ -272,8 +204,6 @@ setup_data(struct cmd* cmd, const struct args* args)
ASSERT(cmd && args);
if(!args->data) {
- cmd->data = NULL;
- } else if(!strcmp(args->data, "-")) {
cmd->data = stdin;
} else if((cmd->data = fopen(args->data, "r")) == NULL) {
fprintf(stderr, "error opening data file '%s' -- %s\n",
@@ -344,7 +274,6 @@ cmd_run(struct cmd* cmd)
if((res = write_vtk_header(cmd)) != RES_OK) goto error;
if((res = write_mesh(cmd)) != RES_OK) goto error;
- if((res = write_data(cmd)) != RES_OK) goto error;
exit:
return res;