diff options
author | Thomas White <taw@physics.org> | 2021-01-11 09:53:47 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-01-11 09:57:58 +0100 |
commit | 9d9e819bc535102ca52d6270b6a928e6e70539b6 (patch) | |
tree | 135655915dc6418356f72076b572fc1ed032159e /libcrystfel/src/cell.h | |
parent | 708590dd4bfac92bde90d9762f413c7496afbddf (diff) |
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.
Diffstat (limited to 'libcrystfel/src/cell.h')
-rw-r--r-- | libcrystfel/src/cell.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libcrystfel/src/cell.h b/libcrystfel/src/cell.h index bf5d689c..064dacd0 100644 --- a/libcrystfel/src/cell.h +++ b/libcrystfel/src/cell.h @@ -107,15 +107,15 @@ extern void cell_set_cartesian(UnitCell *cell, extern void cell_set_parameters(UnitCell *cell, double a, double b, double c, double alpha, double beta, double gamma); -extern int cell_get_parameters(const UnitCell *cell, double *a, double *b, double *c, +extern int cell_get_parameters(UnitCell *cell, double *a, double *b, double *c, double *alpha, double *beta, double *gamma); -extern int cell_get_cartesian(const UnitCell *cell, +extern int cell_get_cartesian(UnitCell *cell, double *ax, double *ay, double *az, double *bx, double *by, double *bz, double *cx, double *cy, double *cz); -extern int cell_get_reciprocal(const UnitCell *cell, +extern int cell_get_reciprocal(UnitCell *cell, double *asx, double *asy, double *asz, double *bsx, double *bsy, double *bsz, double *csx, double *csy, double *csz); @@ -138,7 +138,7 @@ struct g6 double F; }; -extern struct g6 cell_get_G6(const UnitCell *cell); +extern struct g6 cell_get_G6(UnitCell *cell); extern char cell_get_centering(const UnitCell *cell); extern void cell_set_centering(UnitCell *cell, char centering); @@ -146,8 +146,6 @@ extern void cell_set_centering(UnitCell *cell, char centering); extern char cell_get_unique_axis(const UnitCell *cell); extern void cell_set_unique_axis(UnitCell *cell, char unique_axis); -extern const char *cell_rep(UnitCell *cell); - extern UnitCell *cell_transform_gsl_direct(UnitCell *in, gsl_matrix *m); extern UnitCell *cell_transform_rational(UnitCell *cell, RationalMatrix *m); |