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

Feature element boundary [3/3] #1081

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open

Feature element boundary [3/3] #1081

wants to merge 29 commits into from

Conversation

holke
Copy link
Collaborator

@holke holke commented Jun 5, 2024

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

  • The code is covered in an existing or new test case using Google Test

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):

    • Should this use case be added to the github action?
    • If not, does the specific use case compile and all tests pass (check manually)

Scripts and Wiki

  • If a new directory with source-files is added, it must be covered by the script/find_all_source_files.scp to check the indentation of these files.
  • If this PR introduces a new feature, it must be covered in an example/tutorial and a Wiki article.

Licence

  • The author added a BSD statement to doc/ (or already has one)

@holke holke marked this pull request as draft June 5, 2024 13:30
@lukasdreyer lukasdreyer assigned holke and unassigned lukasdreyer Jun 10, 2024
@holke holke added enhancement Enhances already existing code Follow-up PR labels Jun 19, 2024
@holke holke requested a review from lukasdreyer June 19, 2024 14:23
@holke holke assigned lukasdreyer and unassigned holke Jun 19, 2024
@holke holke marked this pull request as ready for review June 19, 2024 14:23
@holke holke enabled auto-merge June 19, 2024 14:23
@holke
Copy link
Collaborator Author

holke commented Jun 19, 2024

Ready for review - i added a test case.

@lukasdreyer lukasdreyer assigned holke and unassigned lukasdreyer Jun 20, 2024
@holke holke requested a review from lukasdreyer July 18, 2024 14:23
@holke holke assigned lukasdreyer and unassigned holke Jul 18, 2024
@holke
Copy link
Collaborator Author

holke commented Jul 18, 2024

Is now ready for re-review.

Comment on lines +2115 to +2139
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;
}
Copy link
Collaborator

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

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Delete

@lukasdreyer lukasdreyer assigned holke and unassigned lukasdreyer Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhances already existing code Follow-up PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants