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

Simplify code by using cell->is_locally_owned() and friends #12904

Merged
merged 1 commit into from Nov 2, 2021

Conversation

kronbichler
Copy link
Member

As far as I understand our code, statements like

          dof.get_triangulation().locally_owned_subdomain() ==
            numbers::invalid_subdomain_id ||
          cell->level_subdomain_id() ==
            dof.get_triangulation().locally_owned_subdomain()

is exactly what we do in cell->is_locally_owned_on_level(), see

// Serial triangulations report invalid_subdomain_id as their locally owned
// subdomain, so the first condition checks whether we have a serial
// triangulation, in which case all cells are locally owned. The second
// condition compares the subdomain id in the parallel case.
return (this->tria->locally_owned_subdomain() ==
numbers::invalid_subdomain_id ||
this->level_subdomain_id() == this->tria->locally_owned_subdomain());
so use that shorter code. While there, I also observed that some code in MatrixFree used similar logic in a manual way, but we don't support any other than the partitioning implied by the Triangulation class anyway.

@peterrum
Copy link
Member

peterrum commented Nov 1, 2021

is exactly what we do in cell->is_locally_owned_on_level(), see

Yes it is. I was annoyed that had to write these locs over and over again ;)

@bangerth
Copy link
Member

bangerth commented Nov 1, 2021

If you find yourself annoyed by something, fix it :-)

@Rombur Rombur merged commit a9d8426 into dealii:master Nov 2, 2021
@kronbichler kronbichler deleted the simplify_mg_code branch November 2, 2021 06:57
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

4 participants