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

Add ExpressionBasedFunction #3892

Merged
merged 8 commits into from
Aug 28, 2024
Merged

Add ExpressionBasedFunction #3892

merged 8 commits into from
Aug 28, 2024

Conversation

nickbianco
Copy link
Member

@nickbianco nickbianco commented Aug 26, 2024

Fixes issue #3812

Brief summary of changes

Adds ExpressionBasedFunction for creating OpenSim Functions that leverage Lepton's expression parsing.

Testing I've completed

Add tests to testFunctions.cpp.

Looking for feedback on...

CHANGELOG.md (choose one)

  • updated.

This change is Reviewable

Copy link
Member

@aymanhab aymanhab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor questions but looks great

Reviewed 9 of 9 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @AllisonJohn and @nickbianco)


OpenSim/Common/ExpressionBasedFunction.h line 59 at r1 (raw file):

    OpenSim_DECLARE_PROPERTY(expression, std::string, 
            "The mathematical expression defining this Function.");
    OpenSim_DECLARE_LIST_PROPERTY(variables, std::string, 

Space separated? Case sensitive? Quoted or not? allowed/disallowed names

On a related note, if the definition is invalid, when does it blow up?


OpenSim/Common/ExpressionBasedFunction.cpp line 116 at r1 (raw file):

    Lepton::ExpressionProgram m_valueProgram;
    std::vector<Lepton::ExpressionProgram> m_derivativePrograms;
};

The prefix SimTK outside the namespace is a bit uncommon is that intentional? How would it show in documentation/doxygen?

Also is it in the style guide to use the m_ prefix?

Copy link
Member Author

@nickbianco nickbianco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @aymanhab! Ready for review again.

Reviewable status: 7 of 9 files reviewed, 2 unresolved discussions (waiting on @AllisonJohn and @aymanhab)


OpenSim/Common/ExpressionBasedFunction.h line 59 at r1 (raw file):

Previously, aymanhab (Ayman Habib) wrote…

Space separated? Case sensitive? Quoted or not? allowed/disallowed names

On a related note, if the definition is invalid, when does it blow up?

List properties in XML will be space separated. I added some documentation about allowed/non-allowed variable names.


OpenSim/Common/ExpressionBasedFunction.cpp line 116 at r1 (raw file):

Previously, aymanhab (Ayman Habib) wrote…

The prefix SimTK outside the namespace is a bit uncommon is that intentional? How would it show in documentation/doxygen?

Also is it in the style guide to use the m_ prefix?

This class is internal and will be hidden from Doxgyen. See MultivariatePolynomialFunction for a similar implementation.

There's nothing in DEVELOPING.md or CONTRIBUTING.md about variable name prefixes.

Copy link
Member

@aymanhab aymanhab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 3 of 3 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @AllisonJohn)

@nickbianco nickbianco merged commit 9aac541 into main Aug 28, 2024
12 checks passed
@nickbianco nickbianco deleted the expression_based_function branch August 28, 2024 16:26
@nickbianco
Copy link
Member Author

Thanks @aymanhab!

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