diff options
author | Thomas White <taw@physics.org> | 2023-05-15 17:17:33 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2023-07-28 13:22:05 +0200 |
commit | 6f774aaa68507d9dd0d1f8916d773a9bdb89f03b (patch) | |
tree | f602e69d6ebe325de083d1cb9f367debad1fc159 /libcrystfel/src | |
parent | e6cee18a78236c5bb763c024e586c7154c82535c (diff) |
Add detgeom_show_hierarchy()
Diffstat (limited to 'libcrystfel/src')
-rw-r--r-- | libcrystfel/src/detgeom.c | 25 | ||||
-rw-r--r-- | libcrystfel/src/detgeom.h | 2 |
2 files changed, 27 insertions, 0 deletions
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; i<level; i++ ) STATUS(" "); + + if ( group == NULL ) { + STATUS("!!!\n"); + return; + } + + STATUS("%s\n", group->name); + + for ( i=0; i<group->n_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 |