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

[WriteState] minor fix with the time attribute, default values #776

Merged
merged 2 commits into from
Oct 3, 2018

Conversation

olivier-goury
Copy link
Contributor

@olivier-goury olivier-goury commented Sep 14, 2018

Small fix, correcting the check for the multiplicity between "time" and dt, as well as putting period to dt by default if nothing is given by the user.
Set back to the default behavior : periodic export activated


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.

@olivier-goury olivier-goury added the enhancement About a possible enhancement label Sep 14, 2018
@olivier-goury olivier-goury changed the title minor fix with the time attribute, default values [WriteState] minor fix with the time attribute, default values Sep 14, 2018
@hugtalbot hugtalbot added the pr: status to review To notify reviewers to review this pull-request label Sep 18, 2018
@@ -47,7 +47,7 @@ WriteState::WriteState()
, d_writeV( initData(&d_writeV, false, "writeV", "flag enabling output of V vector"))
, d_writeF( initData(&d_writeF, false, "writeF", "flag enabling output of F vector"))
, d_time( initData(&d_time, helper::vector<double>(0), "time", "set time to write outputs (by default export at t=0)"))
, d_period( initData(&d_period, 0.0, "period", "period between outputs"))
, d_period( initData(&d_period, this->getContext()->getDt(), "period", "period between outputs"))
Copy link
Contributor

Choose a reason for hiding this comment

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

is this default initialization really working ?
if not, this should definitely go in the init() function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know this initialization may seem strange but it works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can go in the init too, but then the isSet() method called on period returns true.

Copy link
Contributor

Choose a reason for hiding this comment

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

that's a good point that you do. And the value is correctly initialized ? (using the specified time step value)

Copy link
Contributor

@damienmarchal damienmarchal Sep 19, 2018

Choose a reason for hiding this comment

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

Well ... I let Olivier answer :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad. Actually, we saw with Damien that "this->getContext()->getDt()" before the context is really defined returns always 0.01, no matter what the real dt is! I tested it with dt=0.01 so I thought this was working fine. I will fix this now!

@olivier-goury
Copy link
Contributor Author

Alright, the initialization of the period is back to a less funky way!

@olivier-goury
Copy link
Contributor Author

Hello,
@hugtalbot I changed the initialisation. I think the PR is ready now.
Thanks

@hugtalbot
Copy link
Contributor

Yes, I just wanted to give it a try by tonight, if I don't have the time, we can merge it.
Sorry for not informing you Olivier!

@guparan
Copy link
Contributor

guparan commented Oct 1, 2018

[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 Oct 3, 2018
@guparan guparan merged commit 8758e9d into sofa-framework:master Oct 3, 2018
@guparan guparan added this to the v18.12 milestone Oct 26, 2018
@damienmarchal damienmarchal deleted the fixWriteState branch December 11, 2018 11:10
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.

4 participants