Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tao_param_value_routine: handle long expressions #1154

Merged
merged 1 commit into from
Aug 17, 2024

Conversation

jsberg-bnl
Copy link
Contributor

You have this annoying user that insists on using long complex expressions. tao_param_value_routine was truncating sub-expressions because its intermediate strings weren't long enough. This patch fixes the problem. FYI error output from the buggy version looked like:

[ERROR | 2024-AUG-16 17:26:43] tao_evaluate_expression:
    UNMATCHED "("
    IN EXPRESSION: max(abs(ele::md[b_field]+ele::md[b1_gradient]*data::md.x
[ERROR | 2024-AUG-16 17:26:43] tao_evaluate_expression:
    ERROR IN EVALUATING EXPRESSION: max([max(abs(ele::mf##1[b_field]+ele::mf##1[b1_gradient]*data::mf.xm|model)),max(abs(ele::mf##1[b_field]+ele::mf##1[b1_gradient]*data::mf.xp|model)),max(abs(ele::md[b_field]+ele::md[b1_gradient]*data::md.xm|model)),max(abs(ele::md[b_field]+ele::md[b1_gradient]*data::md.xm|model))])
    CANNOT EVALUATE: [max(abs(ele::mf##1[b_field]+ele::mf##1[b1_gradient]*data::mf.xm|model)),max(abs(ele::mf##1[b_field]+ele::mf##1[b1_gradient]*data::mf.xp|model)),max(abs(ele::md[b_field]+ele::md[b1_gradient]*data::md.xm|model)),max(abs(ele::md[b_field]+ele::md[b1_gradient]*data::md.xm|model))]
[ERROR | 2024-AUG-16 17:26:43] tao_set_invalid:
    CANNOT EVALUATE EXPRESSION: max([max(abs(ele::mf##1[b_field]+ele::mf##1[b1_gradient]*data::mf.xm|model)),max(abs(ele::mf##1[b_field]+ele::mf##1[b1_gradient]*data::mf.xp|model)),max(abs(ele::md[b_field]+ele::md[b1_gradient]*data::md.xm|model)),max(abs(ele::md[b_field]+ele::md[b1_gradient]*data::md.xm|model))])
    FOR DATUM: field[1] with data_type: expression:max([max(abs(ele::mf##1[b_field]+ele::mf##1[b1_gradient]*data::mf.xm|model)),max(abs(ele::mf##1[b_field]+ele::mf##1[b1_gradient]*data::mf.xp|model)),max(abs(ele::md[b_field]+ele::md[b1_gradient]*data::md.xm|model)),max(abs(ele::md[b_field]+ele::md[b1_gradient]*data::md.xm|model))])

Ensure that str2 and word2 local strings are at least as long as the
input expression str, since they will hold substrings of str.
@DavidSagan DavidSagan merged commit 3d5f1f7 into bmad-sim:main Aug 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants