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

[SofaTopologyMapping] Cleanups of some topological mappings + better initialization #1126

Merged
merged 2 commits into from
Sep 12, 2019

Conversation

jnbrunet
Copy link
Contributor

@jnbrunet jnbrunet commented Aug 21, 2019

Various cleanup and better checks at the init stage to make sure the topological mappings have everything they need.

Only Hexa2Quad, Quad2Triangle and Tetra2Triangle for now.


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.

@@ -101,10 +106,8 @@ void Hexa2QuadTopologicalMapping::init()
return;
}

QuadSetTopologyContainer *to_tstc;
toModel->getContext()->get(to_tstc);
Copy link
Contributor

Choose a reason for hiding this comment

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

could toModel be different than to_tstc ?
I think you are right, but I don't remember why this get() was here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, toModel is a BaseMeshTopology, so it could be something else than a QuadSetTopologyContainer. I'm not sure if casting it to a QuadSetTopologyContainer is really necessary here... but at least this PR keeps the "toModel must be a QuadSetTopologyContainer" requirement.

@@ -267,14 +272,14 @@ void Quad2TriangleTopologicalMapping::updateTopologicalMappingTopDown()
}
case core::topology::QUADSREMOVED:
{
const sofa::helper::vector<unsigned int> &tab = ( static_cast< const QuadsRemoved *>( *itBegin ) )->getArray();
const auto & tab = ( static_cast< const QuadsRemoved *>( *itBegin ) )->getArray();
Copy link
Contributor

Choose a reason for hiding this comment

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

I have nothing against using auto type, but in those cases maybe changing the name of the variable would be good.
Because auto tab gives no info of what we are manipulating. maybe tabIndices or what you think is best.

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 went to the file very quickly changing to auto where my IDE would suggest to do so (and a bit more), I agree that the name isn't very well chosen. I will try if I have some time to change the names... but here the idea of auto is more that it will automatically handle the case where the return value type changes in the future.

@epernod epernod added pr: clean Cleaning the code project: Topology pr: status to review To notify reviewers to review this pull-request labels Aug 21, 2019
@jnbrunet
Copy link
Contributor Author

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

@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 Aug 28, 2019
@epernod epernod added pr: status to review To notify reviewers to review this pull-request pr: status ready Approved a pull-request, ready to be squashed and removed pr: status wip Development in the pull-request is still in progress pr: status to review To notify reviewers to review this pull-request labels Sep 11, 2019
@jnbrunet
Copy link
Contributor Author

Thanks a lot @epernod !!

@epernod epernod merged commit 7b30ae3 into sofa-framework:master Sep 12, 2019
@jnbrunet jnbrunet deleted the topological_mapping_cleanups branch September 12, 2019 12:04
@guparan guparan added this to the v19.12 milestone Jan 14, 2020
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: 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