diff options
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/reflist-utils.c | 31 | ||||
-rw-r--r-- | libcrystfel/src/reflist-utils.h | 2 |
2 files changed, 33 insertions, 0 deletions
diff --git a/libcrystfel/src/reflist-utils.c b/libcrystfel/src/reflist-utils.c index 53ab399a..a84371f3 100644 --- a/libcrystfel/src/reflist-utils.c +++ b/libcrystfel/src/reflist-utils.c @@ -471,3 +471,34 @@ RefList *res_cutoff(RefList *list, UnitCell *cell, double min, double max) reflist_free(list); return new; } + + +/** + * copy_reflist: + * @list: A %RefList + * + * Returns: A copy of %RefList. + **/ +RefList *copy_reflist(RefList *list) +{ + Reflection *refl; + RefListIterator *iter; + RefList *new; + + new = reflist_new(); + + for ( refl = first_refl(list, &iter); + refl != NULL; + refl = next_refl(refl, iter) ) + { + signed int h, k, l; + Reflection *n; + + get_indices(refl, &h, &k, &l); + + n = add_refl(new, h, k, l); + copy_data(n, refl); + } + + return new; +} diff --git a/libcrystfel/src/reflist-utils.h b/libcrystfel/src/reflist-utils.h index b12b8dfa..7e0742a9 100644 --- a/libcrystfel/src/reflist-utils.h +++ b/libcrystfel/src/reflist-utils.h @@ -61,4 +61,6 @@ extern double max_intensity(RefList *list); extern RefList *res_cutoff(RefList *list, UnitCell *cell, double min, double max); +extern RefList *copy_reflist(RefList *list); + #endif /* REFLIST_UTILS_H */ |