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
Refactor function parser #13773
Refactor function parser #13773
Conversation
e53a933
to
d10f56d
Compare
d10f56d
to
2c037e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice simplification.
return {// functions predefined by muparser | ||
"sin", | ||
"cos", | ||
"tan", | ||
"asin", | ||
"acos", | ||
"atan", | ||
"sinh", | ||
"cosh", | ||
"tanh", | ||
"asinh", | ||
"acosh", | ||
"atanh", | ||
"atan2", | ||
"log2", | ||
"log10", | ||
"log", | ||
"ln", | ||
"exp", | ||
"sqrt", | ||
"sign", | ||
"rint", | ||
"abs", | ||
"min", | ||
"max", | ||
"sum", | ||
"avg", | ||
// functions we define ourselves above | ||
"if", | ||
"int", | ||
"ceil", | ||
"cot", | ||
"csc", | ||
"floor", | ||
"sec", | ||
"pow", | ||
"erf", | ||
"erfc", | ||
"rand", | ||
"rand_seed"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this list be static
and the function return a const &
to it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do that, but we only call this when we set up the muParser objects so its not going to make a measurable performance difference. I would prefer not to add extra static objects unless we need to.
ping |
Followup to #13745 - we can avoid duplicating a lot of code by adding another base class. We need to use a separate base class (instead of just functions) so that we can use the PIMPL idiom.