- changed status to open
CCTK_TraverseString with selection = CCTK_GROUP handles "all" string inconsistently
CCTK_TraverseString
(see its docs) takes a list of variable or group names and a callback function then calls a callback function once per variable in the passed in list of variables and groups.
Depending on whether selection
is CCTK_GROUP
or CCTK_VAR
or CCTK_VAR_OR_GROUP
the string will accept variable names, group names or either. However, in almost all cases, the callback function is called once per variable ie groups are expanded. The one exception is selection == CCTK_GROUP
and traverse_string == “all”
in which case there is special code to pass in groups. This code, introduced in git hash 778e8f49 "Fixed parsing of option string in CCTK_TraverseString()." of cactus seems to be a bug since the previous version would have iterated over variables as well (and so does the current if one passes an actual list of groups).
Erik and I stumbled across this while working on CarpetX, which always outputs whole groups so uses selection = CCTK_GROUP
while all instances in Cactus and the ET use selection = CCTK_VAR_OR_GROUP
.
Pull request https://bitbucket.org/cactuscode/cactus/pull-requests/79/cctk_traversestring-always-return-all/diff contains @Erik Schnetter 's fix, which restores the original (well historic, given that the bug was introduced Tue Jul 31 2001). The alternative would be to have selection == CCTK_GROUP
always return groups instead of variables, which may be more what a typical user would expect, but is not what happened in the (distant) past. A code that needs only the groups will have to either do nothing unless index
passed is equal to CCTK_FirstVarInGroupI(CCTK_GroupIndexFromVarI(index))
, or (if the action is a projection) convert to group index via CCTK_GroupIndexFromVarI
manually.
Comments (3)
-
reporter -
reporter Unless objected I will apply this after 2020-02-14.
-
reporter - changed status to resolved
- Log in to comment
Please review.