-
Notifications
You must be signed in to change notification settings - Fork 120
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
Introduce p4est_search_partition_gfp #196
Conversation
Thanks! Strictly speaking, if gfq is optional in the comm _gfx function, should it be optional in the partition _gfx function, too? So the assertions only execute if not NULL. |
In that case partition_gfp might directly call partition_gfx (NULL, p). |
I changed the assertions in |
Thanks for the update! I'm thinking about a more philosophical point: is it a good thing if some arguments of a function may or may not be NULL, legally. This increases coding flexibility but places more burdens on the user to read the API docs in detail. If they do not read them carefully, chances are high that they do something suboptimal. If we were to not allow for NULL defaults wherever sensible, the user might be a happier person and the code might be more stable. So I know I suggested that the gfq argument is always optional for the gfx functions. Whout would be your opinion, also checking with @tim-griesbach? |
That is a good point. For a more consistent setup @tim-griesbach and I think we should
What do you think? |
Thanks for your thoughts. The straightest approach would be to prepare a _gfp and/or _gfq version of a function when there is a mode that works like this, asserting the argument for non-NULL. If there's a mode that benefits from both arguments being available, then add a _gfx version and assert both to be non-NULL. Shall we apply this to both search_partition and is_empty and friends where needed? Let's not add functions that we do not call though, since dead code is difficult to maintain. |
These all sound good. For the last item a macro in the .c may be helpful. These changes seem to be in line with my previous thoughts just posted above. |
If you might briefly comment on my conversations above I'll be happy to resolve them. |
I've implemented everything according to the list. |
Thanks so much! |
We add p4est_search_partition_gfp as an alternative to p4est_search_partition_gfx.
The parameter gfq is no longer required as a parameter, which may avoid unnecessary communication in case gfq is not already available locally, but makes the function slightly slower.
To implement p4est_search_partition_gfp with minimal changes, we add p4est_comm_is_empty_gfx, which works like p4est_comm_is_empty_gfq for gfq != NULL and else calls p4est_quadrant_is_equal_piggy on gfp.