From 9d9e819bc535102ca52d6270b6a928e6e70539b6 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 11 Jan 2021 09:53:47 +0100 Subject: UnitCell: Store all representations once they're calculated Previously, the "getter" functions would re-calculate the requested representation every time they were called. This could mean doing a matrix inversion in the middle of a tight loop, wasting loads of time. Now, it stores the calculated values and returns them directly next time. Setting the parameters invalidates the values for all representations other than the one given. The cost of doing this is that the cell can no longer be "const" in the getter functions. This tracked through some other code, but nothing too severe. --- libcrystfel/src/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libcrystfel/src/stream.c') diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index 08f0e332..afaf40a5 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -1250,7 +1250,7 @@ Stream *stream_open_fd_for_write(int fd, const DataTemplate *dtempl) } -void stream_write_target_cell(Stream *st, const UnitCell *cell) +void stream_write_target_cell(Stream *st, UnitCell *cell) { if ( cell == NULL ) return; fprintf(st->fh, STREAM_CELL_START_MARKER"\n"); -- cgit v1.2.3