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

Fix GridGenerator::merge_triangulations() for simplex meshes #12979

Merged
merged 1 commit into from Nov 22, 2021

Conversation

peterrum
Copy link
Member

No description provided.

Copy link
Member

@drwells drwells left a comment

Choose a reason for hiding this comment

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

I'm traveling today so I might not be around to approve this later. This is fine but it would be better if we avoided the double negative.

Comment on lines 6466 to 6470
if (std::find_if(cells.begin(), cells.end(), [](const auto &cell) {
return cell.vertices.size() !=
ReferenceCells::get_hypercube<dim>().n_vertices();
}) == cells.end())
GridTools::consistently_order_cells(cells);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (std::find_if(cells.begin(), cells.end(), [](const auto &cell) {
return cell.vertices.size() !=
ReferenceCells::get_hypercube<dim>().n_vertices();
}) == cells.end())
GridTools::consistently_order_cells(cells);
if (std::all_of(cells.begin(), cells.end(), [](const auto &cell) {
return cell.vertices.size() ==
ReferenceCells::get_hypercube<dim>().n_vertices();
}))
GridTools::consistently_order_cells(cells);

Copy link
Member

Choose a reason for hiding this comment

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

I think the condition really rather is that there is something to be done if any of the cells reference is a (generalized) hex, isn't it? Shouldn't it be

Suggested change
if (std::find_if(cells.begin(), cells.end(), [](const auto &cell) {
return cell.vertices.size() !=
ReferenceCells::get_hypercube<dim>().n_vertices();
}) == cells.end())
GridTools::consistently_order_cells(cells);
if (std::any_of(cells.begin(), cells.end(), [](const auto &cell) {
return cell.vertices.size() ==
ReferenceCells::get_hypercube<dim>().n_vertices();
}) == cells.end())
GridTools::consistently_order_cells(cells);

then?

Copy link
Member Author

Choose a reason for hiding this comment

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

The right logic is all_of. GridTools::consistently_order_cells only works if all cells are hypercubes. In all other cases, we store the orientation of faces/edges anyway. I have made the modification. It ready from my side!

@peterrum
Copy link
Member Author

/rebuild

@drwells drwells merged commit 026e105 into dealii:master Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants