-
Notifications
You must be signed in to change notification settings - Fork 63
Feature: search partition #1793
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
base: main
Are you sure you want to change the base?
Conversation
|
Hey @hannesbrandt , thank you for this Draft-PR. What do you need to progress further, to convert it into a PR and to merge it into main eventually? Thank you & have a nice week, |
|
Hey @Davknapp, the implementation of the partition search itself is ready to be merged. However, the example/test program currently relies on some workarounds I implemented in |
|
I just had a look at it: For the global-id part: You can use the function "t8_forest_get_local_id " to get the local-id. That way all the other functions don't need to be changed. |
| const int num_points, int *is_inside, | ||
| const double tolerance) const | ||
| { | ||
| const t8_eclass_t tree_class = t8_forest_get_tree_class (forest, ltreeid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change necessary?
| T8_ASSERT (forest != NULL); | ||
| T8_ASSERT (forest->scheme != NULL); | ||
| /* Get the tree's class and scheme */ | ||
| const t8_eclass_t tree_class = t8_forest_get_tree_class (forest, ltree_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you ensure the execution of these functions on commited forests, all of the changes here can be reverted, I think
| * This function performs a search operation on a tree identified by the given local tree ID. | ||
| * It uses the \a search_recursion function to perform the search. | ||
| * | ||
| * \param[in] ltreeid The local tree ID of the tree to be searched. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please document all parameters
| * \param[in] plast The last processor that owns part of \a element. Guaranteed to be non-empty. | ||
| */ | ||
| void | ||
| search_recursion (const t8_locidx_t ltreeid, t8_element_t *element, const t8_scheme *ts, int pfirst, int plast); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| search_recursion (const t8_locidx_t ltreeid, t8_element_t *element, const t8_scheme *ts, int pfirst, int plast); | |
| search_recursion (const t8_locidx_t ltreeid, const t8_element_t *element, const t8_scheme *ts, int pfirst, int plast); |
| * \param[in] ltreeid The local tree ID of the tree to be searched. | ||
| */ | ||
| void | ||
| search_tree (const t8_locidx_t ltreeid, int pfirst, int plast); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want to pass a reference here. As far as I understand it you want to change the values of pfirst & plast in this functions, or pass it further down to let it be changed. So int &pfirst should do the trick .
|
|
||
| /* compute sum of local number of queries across all processes */ | ||
| gnq = 0; | ||
| for (il = 0; il < g->global_nlq->elem_count; il++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| for (il = 0; il < g->global_nlq->elem_count; il++) { | |
| for (size_t il = 0; il < g->global_nlq->elem_count; il++) { |
| static bool | ||
| t8_tutorial_search_partition_partition_element_fn (const t8_forest_t forest, const t8_locidx_t ltreeid, | ||
| const t8_element_t *element, int pfirst, int plast, | ||
| t8_tutorial_search_partition_global_t *g) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use a better name than g.
| static bool | ||
| t8_tutorial_search_partition_partition_query_fn (const t8_forest_t forest, const t8_locidx_t ltreeid, | ||
| const t8_element_t *element, int pfirst, int plast, | ||
| const t8_point_t &query, t8_tutorial_search_partition_global_t *g) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use a better name than g.
| const std::vector<t8_point_t> &queries, | ||
| const std::vector<size_t> &active_query_indices, | ||
| std::vector<bool> &query_matches, | ||
| t8_tutorial_search_partition_global_t *g) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use a better name than g.
| static void | ||
| t8_tutorial_search_partition_search_partition (t8_tutorial_search_partition_global_t *g) | ||
| { | ||
| size_t iz, lenz, buffer_size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please declare the variables when they are needed, not always at the beginning, especially for variables used as indices in loops.
Partition search for the replicated coarse mesh and tutorial
This PR adds the partition search for forests with replicated coarse mesh using the interface defined in #1286.
Additionally, the search is exercised in a new tutorial
t8_tutorial_search_partition.cxx. In the tutorial, a forest is defined on the unit cube and refined adaptively. The coarse mesh can be either a 2x2x2 brick or the hybrid hypercube example cmesh. A set of random query points is created on rank 0 and broadcasted to all processes. The replicated queries are first searched in the local part of the forest using the already existing local search routines. Subsequently, they are searched in the partition of the forest and thereby assigned to processes. The results of the partition search are checked for consistency with the results of the local search across all processes.This PR is currently just a draft for the following reasons
t8_forest_element_points_insideall expect a local tree id as input. For the partition search it would be convenient to call the same routines for global tree ids as well. As a temporary solution we adapted the required geometric functions to accept a global tree id and use the replicated cmesh instead of the forest to obtain the tree class. A future partition search for distributed cmeshes may even benefit from similar geometric functionalities using the tree class directly as input.t8_forest_element_centroid, which are not allowed to be called during adaptation, as the forest is temporarily not committed. We temporarily disabled the respective assertions.All these boxes must be checked by the AUTHOR before requesting review:
Documentation:,Bugfix:,Feature:,Improvement:orOther:.All these boxes must be checked by the REVIEWERS before merging the pull request:
As a reviewer please read through all the code lines and make sure that the code is fully understood, bug free, well-documented and well-structured.
General
Tests
If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):
Scripts and Wiki
script/find_all_source_files.scpto check the indentation of these files.License
doc/(or already has one).