-
Notifications
You must be signed in to change notification settings - Fork 53
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
Feature element boundary [3/3] #1081
base: main
Are you sure you want to change the base?
Conversation
…re-element_boundary
Ready for review - i added a test case. |
Is now ready for re-review. |
src/t8_forest/t8_forest.cxx
Outdated
else { | ||
SC_ABORT ("This forest has holes and a computation of boundary elements is not supported. Once " | ||
"https://github.com/DLR-AMR/t8code/issues/825 is resolved, the function will be available.\n"); | ||
} | ||
/* we need to compute the face neighbors to know whether the element is a boundary element. */ | ||
const int is_balanced = t8_forest_is_balanced (forest); | ||
int num_neighbors; | ||
t8_element_t **neighbor_leaves; | ||
t8_locidx_t *pelement_indices; | ||
t8_eclass_scheme_c *pneigh_scheme; | ||
/* The forest has holes, the leaf could lie inside a tree but its neighbor was deleted. */ | ||
t8_forest_leaf_face_neighbors (forest, local_tree, leaf, &neighbor_leaves, face, NULL, &num_neighbors, | ||
&pelement_indices, &pneigh_scheme, is_balanced); | ||
|
||
if (num_neighbors == 0) { | ||
/* The element has no neighbors, it is a boundary element. */ | ||
return 1; | ||
} | ||
else { | ||
/* If neighbors were found, these arrays were allocated and need clean-up. */ | ||
T8_FREE (neighbor_leaves); | ||
T8_FREE (pelement_indices); | ||
/* This leaf is not a boundary leaf. */ | ||
return 0; | ||
} |
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 it's cleaner, if the additional computations for forests with holes is moved into the else branch, or the SC_ABORT is moved outside the else branch, so it becomes clear that for incomplete trees we can return earlier
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 removed the else and added a descriptive comment.
I hope this clarifies the issue.
scheme = t8_scheme_new_default_cxx (); | ||
forest = t8_forest_new_uniform (cmesh, scheme, level, 0, sc_MPI_COMM_WORLD); | ||
t8_forest_ref (forest); | ||
//const int maxlevel = t8_forest_get_maxlevel (forest); |
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.
Delete
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.
Done
Found the bug, tests should pass now. |
Describe your changes here:
Implemented a function to check whether a leaf element is at the domain boundary or not.
We need to take special care with forests with holes, since these forests have inner boundaries.
Currently draft since we need to implement a test case.
Merge after #1079 and #1080
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
The reviewer executed the new code features at least once and checked the results manually
The code follows the t8code coding guidelines
New source/header files are properly added to the Makefiles
The code is well documented
All function declarations, structs/classes and their members have a proper doxygen documentation
All new algorithms and data structures are sufficiently optimal in terms of memory and runtime (If this should be merged, but there is still potential for optimization, create a new issue)
Tests
Github action
The code compiles without warning in debugging and release mode, with and without MPI (this should be executed automatically in a github action)
All tests pass (in various configurations, this should be executed automatically in a github action)
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.scp
to check the indentation of these files.Licence
doc/
(or already has one)