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

[SofaMiscTopology] Add component TopologyChecker #1594

Merged
merged 31 commits into from
Apr 2, 2021

Conversation

epernod
Copy link
Contributor

@epernod epernod commented Nov 6, 2020

This PR add a component called TopologyChecker to be added in the scene and link to a MeshTopology / TopologyContainer in order to check the topology either on demand or every end of step.

The methods used to check the topology is similar to the code inside the method xxxSetTopologyContainer::CheckTopology()
which will be removed.

This PR use changes from PR #1593 and won't compile until the previous one is merged

Fix #1367


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

@epernod epernod added enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request pr: new feature Implement a new feature labels Nov 6, 2020
@epernod epernod self-assigned this Nov 6, 2020
@guparan guparan added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Nov 12, 2020
@epernod
Copy link
Contributor Author

epernod commented Dec 11, 2020

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

@epernod epernod added pr: status to review To notify reviewers to review this pull-request and removed pr: status wip Development in the pull-request is still in progress labels Dec 11, 2020
@fredroy
Copy link
Contributor

fredroy commented Dec 12, 2020

Is there any ... test 🤓 ?

@epernod
Copy link
Contributor Author

epernod commented Dec 12, 2020

test the component that will do the tests. Could be possible I think

@epernod epernod added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Dec 15, 2020
@epernod
Copy link
Contributor Author

epernod commented Mar 6, 2021

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

@epernod
Copy link
Contributor Author

epernod commented Mar 24, 2021

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

@epernod
Copy link
Contributor Author

epernod commented Mar 25, 2021

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

@epernod epernod added pr: status to review To notify reviewers to review this pull-request and removed pr: status wip Development in the pull-request is still in progress labels Mar 25, 2021
@epernod
Copy link
Contributor Author

epernod commented Mar 25, 2021

@fredroy you wanted some tests.... I have added "some"... I know 2 are failing but I think the mesh is wrong. I will fix that in another PR

@epernod epernod requested a review from fredroy March 25, 2021 15:52
EXPECT_MSG_NOEMIT(Error);
EXPECT_EQ(checker->checkTriangleToEdgeCrossContainer(), true);

sofa::helper::WriteAccessor< sofa::core::objectmodel::Data<sofa::helper::vector<Topology::Edge> > > edges = topoCon->d_edge;
Copy link
Contributor

Choose a reason for hiding this comment

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

Advice: for super long line like that, use auto.
And in this case: auto edges = sofa::helper::getWriteAccessor(topoCon->d_edge);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, done!

const auto& edge = my_edges[i];
if (edge[0] == edge[1]) {
msg_error() << "CheckEdgeTopology failed: edge " << i << " has 2 identical vertices: " << edge;
res = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe cut the loop once res = false ? (or add the test i < nbE && !res in the for loop)

Copy link
Contributor Author

@epernod epernod Mar 25, 2021

Choose a reason for hiding this comment

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

yes, I hesitated, the idea was to catch all the errors... but it quickly become a mess..

}
}

if (simulation::AnimateEndEvent::checkEventType(event) && d_eachStep.getValue())
Copy link
Contributor

Choose a reason for hiding this comment

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

empty statement if animateEnd, so I guess you can remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in fact it was not supposed to be empty

@fredroy
Copy link
Contributor

fredroy commented Mar 25, 2021

@fredroy you wanted some tests.... I have added "some"... I know 2 are failing but I think the mesh is wrong. I will fix that in another PR

Could you identify them in the code (in a comment, maybe add the url or the number of this PR)
In case you dont have time to solve them or something like that; otherwise we wont know when these tests had failed 😏

@epernod
Copy link
Contributor Author

epernod commented Mar 25, 2021

@fredroy you wanted some tests.... I have added "some"... I know 2 are failing but I think the mesh is wrong. I will fix that in another PR

Could you identify them in the code (in a comment, maybe add the url or the number of this PR)
In case you dont have time to solve them or something like that; otherwise we wont know when these tests had failed 😏

In fact the checker had a bug. All the tests are now working. Thanks for the review, the tests were worth it!

@epernod epernod 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 Mar 31, 2021
@epernod epernod merged commit f769430 into sofa-framework:master Apr 2, 2021
@epernod epernod deleted the inf_topologyChecker branch April 12, 2021 22:30
@guparan guparan added this to the v21.06 milestone Jun 28, 2021
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: new feature Implement a new feature pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create TopologyChecker utilities
3 participants