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

Clean up OpenSim::PointForceDirection #3890

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

adamkewley
Copy link
Contributor

@adamkewley adamkewley commented Aug 26, 2024

Minor clean-up. The motivation for doing so is that I'm currently working on a new ForceEmitter base class, which can re-use PointForceDirection, rather than (e.g.) having to introduce its own point-force holding class.

Fixes issue N/A

Brief summary of changes

  • Remove virtual destructor. It's unused codebase-wide
  • Deprecate scale feature. It's unused in opensim-core, which uses the magnitude of direction to encode the force
  • BREAKING: add a final qualifier to the class, which will cause all code that was inheriting PointForceDirection to no longer compile, which is a requirement for removing the virtual destructor
    • It's unlikely downstream code will be inheriting from this. It's a mostly-internal-use class that only pops up as a datastructure passed out by GeometryPath

Testing I've completed

  • None: they're basic depecations

Looking for feedback on...

  • Basics

CHANGELOG.md (choose one)

  • Updated with a note about the final and [[deprecated]] changes. Unlikely to affect downstream users.

This change is Reviewable

Copy link
Member

@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.

A couple minor suggestions and one (non-blocking) question about upgrading the PhysicalFrame member to a Socket.

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


CHANGELOG.md line 13 at r1 (raw file):

- `PointForceDirection` no longer has a virtual destructor, is `final`, and its `scale` functionality
  has been marked as `[[deprecated]]`

v4.6 is the upcoming release, so you can move this under that section.


OpenSim/Simulation/Model/PointForceDirection.h line 38 at r1 (raw file):

 * Force (or any other object) with multiple points of contact through
 * which forces are applied to bodies. This represents one such point and an
 * array of these objects defines a complete Force distribution (ie. path).

Suggestion:

 * array of these objects defines a complete Force distribution (i.e., path).

Copy link
Member

@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.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @adamkewley)


OpenSim/Simulation/Model/PointForceDirection.h line 84 at r1 (raw file):

    /** The frame in which the point is defined */
    const PhysicalFrame* _frame;

Do you think it's worth it to upgrade this to a Socket?

@adamkewley
Copy link
Contributor Author

Do you think it's worth it to upgrade this to a Socket?

Not in this particular case: the class is a plain C++ class, rather than an OpenSim::Component, so it doesn't have (e.g.) the socket table that's used to store socket declarations - it's essentially an internal struct for the C++ API that seems to mostly just be used by GeometryPath

Copy link
Member

@tkuchida tkuchida left a comment

Choose a reason for hiding this comment

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

🐴

/** get the body in which the point is defined */
const PhysicalFrame& frame() {return _frame; }
const PhysicalFrame& frame() { return *_frame; }
Copy link
Member

Choose a reason for hiding this comment

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

Just to bring this up to date, I think the comment on L66 (and similar) should refer to PhysicalFrame rather than "body" since not all PhysicalFrames are Bodys.

@adamkewley
Copy link
Contributor Author

Thanks for the comments @nickbianco and @tkuchida - I've addressed them as best as possible, including rewriting some of the documentation.

Since this is a minor change, I'll go ahead and merge it, rather than doing multiple rounds

@adamkewley adamkewley merged commit 05b334d into main Aug 27, 2024
9 of 10 checks passed
@adamkewley adamkewley deleted the feature_PointForceDirection-cleanup branch August 27, 2024 11:23
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.

3 participants