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] Issue in GenericConstraintCorrection #567

Merged

Conversation

EulalieCoevoet
Copy link
Contributor

@EulalieCoevoet EulalieCoevoet commented Jan 18, 2018

In the PR #484, the way of searching the ODESolver in GenericConstraintCorrection changed from
c->get(odesolver, core::objectmodel::BaseContext::SearchRoot);
to
c->get(odesolver, core::objectmodel::BaseContext::Local);
In some of our simulations, the GenericConstraintCorrection is located in the root node. And so no ODE solver can be found, and the user can not set it manually.

In this PR:

  • Added data d_ODESolverName, to allow user to specify the ODE solver as it is actually done for the linear solvers
  • If no ODE solver found using d_ODESolverName, search in "Local", then in "SearchRoot".
  • Some cleaning (including renaming)

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.

@EulalieCoevoet EulalieCoevoet added pr: fix Fix a bug pr: fast merge Minor change that can be merged without waiting for the 7 review days pr: status to review To notify reviewers to review this pull-request pr: clean Cleaning the code labels Jan 18, 2018
@guparan
Copy link
Contributor

guparan commented Jan 18, 2018

Thanks for your PR @EulalieCoevoet :-)
LGTM except that I'd prefer not to add all these using, especially using helper::vector and using std::string because I think they hide too much info.
const vector<string>& solverNames = d_linearSolversName.getValue(); is a good example of this problem. Which vector? Which string?

@EulalieCoevoet
Copy link
Contributor Author

You know which vector and which string by looking at the using xD
No I understand, it's just that in Defrost, we choose to avoid the blurry of having a code full of path "::".
But if it's not the rule in Sofa, I will change this PR and stop cleaning like that in Sofa.

@damienmarchal
Copy link
Contributor

damienmarchal commented Jan 18, 2018

My 2 cents...
Eulalie is right, there is no 'formal' ambiguity as by just following the vector<> symbol the code editor jump to the 'using sofa::helper'.
Guillaume is right in the fact that allowing using std::vector and using sofa::helper::vector in our code base it will generate a lot of ambiguity.

May I suggest two strategy:

  1. 'using sofa::*' as much as you want unless it hides somethings from the stl.
  2. 'using sofa::*' even for sofa::helper::vector etc. After all we are in sofa so it makes sense to get rid of as much as of the sofa::prefix for code simplicity. To avoid ambiguities, forbid the employement of using on external type eg no 'using std::vector' or 'using std::string'.

Strategy 2 would produce a very consistent and readable code making it obvious we we are using external object or lib;

EDIT: I forgot to say: 👍 Eulalie for the bugtracking, the fixing, cleaning and PRing

@@ -36,78 +36,97 @@ namespace component
namespace constraintset
{

using helper::vector;
using std::string;
Copy link
Contributor

Choose a reason for hiding this comment

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

This will depend on which rules we use...but at least don't import std::string and sofa::helper::vector

@damienmarchal damienmarchal added this to the v17.12 milestone Jan 18, 2018
@guparan
Copy link
Contributor

guparan commented Jan 19, 2018

I agree with your suggestion 2 @damienmarchal. We should add this somewhere in the rules.

@EulalieCoevoet
Copy link
Contributor Author

EulalieCoevoet commented Jan 19, 2018

Sounds good to me :)
So to be clear I should remove all the using std::*.
And all the using sofa::*, including sofa::helper::vector are okay?

@guparan
Copy link
Contributor

guparan commented Jan 19, 2018

Yup, I guess it only concerns the two lines highlighted by Damien :-)

…ternal type eg 'using std::vector' or 'using std::string' is forbidden
if(d_ODESolverName.isSet())
context->get(m_ODESolver, d_ODESolverName.getValue());

if(m_ODESolver == NULL)
Copy link
Contributor

Choose a reason for hiding this comment

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

@fjourdes if you have some time can you drop an eye on the code changes made by Eulalie...before it was fetching the Local only...now Global is a fallback. Could it have bad consequence ?

@damienmarchal
Copy link
Contributor

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

@guparan guparan added 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 Jan 22, 2018
@guparan guparan merged commit 814d8fc into sofa-framework:master Jan 25, 2018
@EulalieCoevoet EulalieCoevoet deleted the fixGenericConstraintCorrection branch February 3, 2018 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: clean Cleaning the code pr: fast merge Minor change that can be merged without waiting for the 7 review days pr: fix Fix a bug pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants