diff options
author | Thomas White <taw@physics.org> | 2020-06-08 17:10:37 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:53:44 +0200 |
commit | df4acdb43b3c713197f8d847587fa1e060692ba4 (patch) | |
tree | 51b50184c67f6f39a5618dbccffa9d3d6e347f9b /src | |
parent | 230113ea3ff6efb2a52b91138e6295801b62603a (diff) |
Convert indexamajig to new Stream API
Diffstat (limited to 'src')
-rw-r--r-- | src/im-sandbox.c | 10 | ||||
-rw-r--r-- | src/indexamajig.c | 23 | ||||
-rw-r--r-- | src/process_image.c | 4 | ||||
-rw-r--r-- | src/process_image.h | 3 |
4 files changed, 23 insertions, 17 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c index 83594585..8c40fa91 100644 --- a/src/im-sandbox.c +++ b/src/im-sandbox.c @@ -444,7 +444,7 @@ static int pump_chunk(FILE *fh, int ofd) if ( chunk_started ) { ERROR("EOF during chunk!\n"); lwrite(ofd, "Unfinished chunk!\n"); - lwrite(ofd, CHUNK_END_MARKER"\n"); + lwrite(ofd, STREAM_CHUNK_END_MARKER"\n"); } /* else normal end of output */ return 1; } @@ -457,7 +457,7 @@ static int pump_chunk(FILE *fh, int ofd) if ( strcmp(line, "FLUSH\n") == 0 ) break; lwrite(ofd, line); - if ( strcmp(line, CHUNK_END_MARKER"\n") == 0 ) break; + if ( strcmp(line, STREAM_CHUNK_END_MARKER"\n") == 0 ) break; } while ( 1 ); return 0; @@ -524,7 +524,7 @@ static void try_read(struct sandbox *sb, TimeAccounts *taccs) struct timeval tv; fd_set fds; int fdmax; - const int ofd = get_stream_fd(sb->stream); + const int ofd = stream_get_fd(sb->stream); time_accounts_set(taccs, TACC_SELECT); @@ -659,9 +659,9 @@ static void start_worker_process(struct sandbox *sb, int slot) * prefix */ - st = open_stream_fd_for_write(stream_pipe[1]); + st = stream_open_fd_for_write(stream_pipe[1]); r = run_work(sb->iargs, st, slot, tmp, sb); - close_stream(st); + stream_close(st); free(tmp); diff --git a/src/indexamajig.c b/src/indexamajig.c index 2081580b..c074e801 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -544,11 +544,13 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state) break; case 603 : - args->iargs.stream_peaks = 0; + args->iargs.stream_flags = CLEAR_BIT(args->iargs.stream_flags, + STREAM_PEAKS); break; case 604 : - args->iargs.stream_refls = 0; + args->iargs.stream_flags = CLEAR_BIT(args->iargs.stream_flags, + STREAM_REFLECTIONS); break; case 605 : @@ -643,8 +645,8 @@ int main(int argc, char *argv[]) args.iargs.ir_out = -1.0; args.iargs.use_saturated = 1; args.iargs.no_revalidate = 0; - args.iargs.stream_peaks = 1; - args.iargs.stream_refls = 1; + args.iargs.stream_flags = STREAM_PEAKS | STREAM_REFLECTIONS + | STREAM_CRYSTALS | STREAM_UNITCELL; args.iargs.stream_nonhits = 1; args.iargs.int_diag = INTDIAG_NONE; args.iargs.min_peaks = 0; @@ -996,13 +998,18 @@ int main(int argc, char *argv[]) free(rn); /* Open output stream */ - st = open_stream_for_write_4(args.outfile, args.geom_filename, - args.iargs.cell, argc, argv, - args.indm_str); + st = stream_open_for_write(args.outfile); if ( st == NULL ) { ERROR("Failed to open stream '%s'\n", args.outfile); return 1; } + + /* Write audit info */ + stream_write_commandline_args(st, argc, argv); + stream_write_geometry_file(st, args.geom_filename); + stream_write_target_cell(st, args.iargs.cell); + stream_write_indexing_methods(st, args.indm_str); + free(args.outfile); free(args.indm_str); @@ -1031,7 +1038,7 @@ int main(int argc, char *argv[]) free(args.temp_location); free(tmpdir); data_template_free(args.iargs.dtempl); - close_stream(st); + stream_close(st); cleanup_indexing(args.iargs.ipriv); return r; diff --git a/src/process_image.c b/src/process_image.c index 5cc89d1b..24a93ce1 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -407,8 +407,8 @@ streamwrite: time_accounts_set(taccs, TACC_WRITESTREAM); set_last_task(last_task, "stream write"); sb_shared->pings[cookie]++; - ret = write_chunk(st, image, iargs->dtempl, - iargs->stream_peaks, iargs->stream_refls); + ret = stream_write_chunk(st, image, iargs->dtempl, + iargs->stream_flags); if ( ret != 0 ) { ERROR("Error writing stream file.\n"); } diff --git a/src/process_image.h b/src/process_image.h index 354641c3..6e86f923 100644 --- a/src/process_image.h +++ b/src/process_image.h @@ -83,8 +83,7 @@ struct index_args int integrate_saturated; int use_saturated; int no_revalidate; - int stream_peaks; - int stream_refls; + int stream_flags; int stream_nonhits; IntegrationMethod int_meth; IntDiag int_diag; |