From 6f774aaa68507d9dd0d1f8916d773a9bdb89f03b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 15 May 2023 17:17:33 +0200 Subject: Add detgeom_show_hierarchy() --- libcrystfel/src/detgeom.c | 25 +++++++++++++++++++++++++ libcrystfel/src/detgeom.h | 2 ++ 2 files changed, 27 insertions(+) (limited to 'libcrystfel/src') diff --git a/libcrystfel/src/detgeom.c b/libcrystfel/src/detgeom.c index bd98aed2..7f458343 100644 --- a/libcrystfel/src/detgeom.c +++ b/libcrystfel/src/detgeom.c @@ -186,3 +186,28 @@ struct detgeom_panel *detgeom_find_panel(struct detgeom *dg, const char *name) } return NULL; } + + +static void detgeom_show_group(const struct detgeom_panel_group *group, int level) +{ + int i; + + for ( i=0; iname); + + for ( i=0; in_children; i++ ) { + detgeom_show_group(group->children[i], level+1); + } +} + + +void detgeom_show_hierarchy(const struct detgeom *dg) +{ + detgeom_show_group(dg->top_group, 0); +} diff --git a/libcrystfel/src/detgeom.h b/libcrystfel/src/detgeom.h index b06ccb8f..0b37e9f1 100644 --- a/libcrystfel/src/detgeom.h +++ b/libcrystfel/src/detgeom.h @@ -125,6 +125,8 @@ extern double detgeom_mean_camera_length(struct detgeom *dg); extern struct detgeom_panel *detgeom_find_panel(struct detgeom *dg, const char *name); +extern void detgeom_show_hierarchy(const struct detgeom *dg); + #ifdef __cplusplus } #endif -- cgit v1.2.3