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

[Simulation] Trigger error when Node already contains component #5212

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

alxbilger
Copy link
Contributor

@alxbilger alxbilger commented Jan 10, 2025

For some component types (see list below), visitors only consider the last added component in the Node. This is due to the fact that Node stores some links as SingleLink. The user has no idea of that, so this PR triggers an error when a second component of the same type is added into a Node.

The error message looks like:

[ERROR]   [Node(root)] Trying to add a BaseMechanicalState ('unnamed' [MechanicalObject] 000001634787E4E0) into the Node '/', whereas it already contains one ('A' [MechanicalObject] 00000163467EA9A0). Only one BaseMechanicalState is permitted in a Node. The previous BaseMechanicalState is replaced and the behavior is undefined.

Note that the name is 'unnamed' because its has not been parsed. I added the address of the object in case both objects have the same name.

A unit test is added on BaseMechanicalState.

List of concerned components:

    NodeSingle<sofa::core::behavior::BaseAnimationLoop> animationManager;
    NodeSingle<sofa::core::visual::VisualLoop> visualLoop;
    NodeSingle<sofa::core::visual::BaseVisualStyle> visualStyle;
    NodeSingle<sofa::core::topology::Topology> topology;
    NodeSingle<sofa::core::topology::BaseMeshTopology> meshTopology;
    NodeSingle<sofa::core::BaseState> state;
    NodeSingle<sofa::core::behavior::BaseMechanicalState> mechanicalState;
    NodeSingle<sofa::core::BaseMapping> mechanicalMapping;
    NodeSingle<sofa::core::behavior::BaseMass> mass;
    NodeSingle<sofa::core::collision::Pipeline> collisionPipeline;

By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@alxbilger alxbilger added enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request labels Jan 10, 2025
@alxbilger alxbilger added the topic for next dev-meeting PR to be discussed in sofa-dev meeting label Jan 13, 2025
@fredroy
Copy link
Contributor

fredroy commented Jan 15, 2025

[ci-build][with-all-tests]

@hugtalbot hugtalbot removed the topic for next dev-meeting PR to be discussed in sofa-dev meeting label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants