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

[SofaConstraint] ADD control on constraint force in UniformConstraint #1027

Merged

Conversation

adagolodjo
Copy link
Contributor

@adagolodjo adagolodjo commented May 6, 2019

Force the constraint force to zero or restPosition

As @damienmarchal said, this is a new version of what Christian proposed in PR #1022 the only difference is that Damien propose to change all the for loops (inside the getConstraintViolation function) by one lambda function. And I will complete this PR next weeks by doing this in all constraints component.


This PR:

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

Reviewers will merge only if all these checks are true.

:d_iterative(initData(&d_iterative, true, "iterative", "Iterate over the bilateral constraints, otherwise a block factorisation\
is computed."))
:d_iterative(initData(&d_iterative, true, "iterative", "Iterate over the bilateral constraints, otherwise a block factorisation is computed."))
,d_constraintRestPos(initData(&d_constraintRestPos, false, "constraintRestPos", "if false, constraint the pos to be zero / if true constraint the current position to stay at rest position"))
Copy link
Contributor

Choose a reason for hiding this comment

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

a verb... constrainToRestPos

resV->set(m_constraintIndex + i*N + j, vfree[i][j] + invDt * pos[i][j] );
}
if (d_constraintRestPos.getValue()){
computeViolation(resV, m_constraintIndex, vfree, Deriv::size(),[&invDt,&pos,&vfree,&restPos](int i, int j)
Copy link
Contributor

Choose a reason for hiding this comment

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

lambda 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Lambda is indeed nice but the indentation is strange.
I'd suggest

computeViolation( resV, m_constraintIndex, vfree, Deriv::size(), [&invDt, &pos, &vfree, &restPos](int i, int j) {
    return vfree[i][j] + invDt * ( pos[i][j] - restPos[i][j] );
});

@damienmarchal
Copy link
Contributor

Hello Youness,

Thank for the PR, could you explain abit if this is a new version of the one made by @ChristianDuriez (#1022)

@epernod epernod added the pr: status to review To notify reviewers to review this pull-request label May 6, 2019
@guparan guparan changed the title [SofaConstraint] add control in the component UniformConstraint wether the constraint f… [SofaConstraint] ADD control on constraint force in UniformConstraint May 7, 2019
@hugtalbot hugtalbot added enhancement About a possible enhancement pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels May 9, 2019
@damienmarchal
Copy link
Contributor

[ci-build][with-scene-tests][with-regression-tests]

@damienmarchal damienmarchal merged commit d92ff11 into sofa-framework:master May 9, 2019
@damienmarchal damienmarchal deleted the SmallAddsAndFixMay6 branch May 9, 2019 13:02
@guparan guparan removed pr: status to review To notify reviewers to review this pull-request labels Jun 20, 2019
@guparan guparan added this to the v19.06 milestone Jun 20, 2019
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 ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants