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 vertex ghosts #1353

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Feature vertex ghosts #1353

wants to merge 5 commits into from

Conversation

lukasdreyer
Copy link
Collaborator

Describe your changes here:
Adds the needed vertex functionality for vertex ghosts on a single tree to the scheme interface and implements it for the default quad scheme.

Extends the ghost algorithm, so that vertex ghosts on a single tree coarse mesh can be constructed.

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.

License

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

Tag Label

  • The author added the patch/minor/major label in accordance to semantic versioning.

@Davknapp Davknapp added priority: medium Should be solved within half a year workload: medium Would take a week or less labels Jan 27, 2025
@Davknapp Davknapp self-assigned this Jan 27, 2025
Copy link
Collaborator

@Davknapp Davknapp left a comment

Choose a reason for hiding this comment

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

In general this looks good. But the behaviour of the tutorial is changed in a way such that it doesn't show the balance algorithm anymore. This should not be the case. I think it is a good idea to make a seperate ghost tutorial step showing the differences between Face and vertex ghost. The current step4 can be a follow up step (step5) to show the balance algo again.

@@ -2899,7 +2899,7 @@ t8_forest_set_ghost_ext (t8_forest_t forest, int do_ghost, t8_ghost_type_t ghost
{
T8_ASSERT (t8_forest_is_initialized (forest));
/* We currently only support face ghosts */
SC_CHECK_ABORT (do_ghost == 0 || ghost_type == T8_GHOST_FACES,
SC_CHECK_ABORT (do_ghost == 0 || ghost_type == T8_GHOST_FACES || ghost_type == T8_GHOST_VERTICES,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please update the error-message, too.

@@ -837,6 +837,33 @@ class t8_scheme {
eclass_schemes[tree_class]);
};

inline int
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please document this function.

eclass_schemes[tree_class]);
}

inline void
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please document this function.

eclass_schemes[tree_class]);
}

inline void
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please document this function.

@@ -546,6 +546,60 @@ class t8_default_scheme_quad: public t8_default_scheme_common<t8_default_scheme_
void
element_get_anchor (const t8_element_t *elem, int anchor[3]) const;

inline int
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
inline int
constexpr int

p4est_quadrant_t *elem = (p4est_quadrant_t *) element;
p4est_quadrant_t *desc = (p4est_quadrant_t *) descendant;
p4est_qcoord_t coord_offset = P4EST_QUADRANT_LEN (elem->level) - P4EST_QUADRANT_LEN (level);
desc->x = elem->x + coord_offset * ((vertex & 1 << 0) >> 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
desc->x = elem->x + coord_offset * ((vertex & 1 << 0) >> 0);
desc->x = elem->x + coord_offset * (vertex & 1) ;

@@ -208,7 +186,7 @@ t8_step4_main (int argc, char **argv)
/* Initialize the sc library, has to happen before we initialize t8code. */
sc_init (sc_MPI_COMM_WORLD, 1, 1, NULL, SC_LP_ESSENTIAL);
/* Initialize t8code with log level SC_LP_PRODUCTION. See sc.h for more info on the log levels. */
t8_init (SC_LP_PRODUCTION);
t8_init (SC_LP_DEBUG);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please change it back to SC_LP_PRODUCTION

@@ -230,7 +208,7 @@ t8_step4_main (int argc, char **argv)
t8_global_productionf (" [step4] Creating an adapted forest as in step3.\n");
t8_global_productionf (" [step4] \n");
/* Build a cube cmesh with tet, hex, and prism trees. */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please udpate this commen.t

Comment on lines +226 to +227
forest = t8_forest_new_adapt (forest, t8_refine_first_child, 0, 0, NULL);
forest = t8_forest_new_adapt (forest, t8_refine_first_child, 0, 0, NULL);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
forest = t8_forest_new_adapt (forest, t8_refine_first_child, 0, 0, NULL);
forest = t8_forest_new_adapt (forest, t8_refine_first_child, 0, 0, NULL);
forest = t8_forest_new_adapt (forest, t8_refine_first_child, 0, 0, NULL);

*/
static t8_forest_t
t8_step4_balance (t8_forest_t forest)
int
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is balance removed?
Maybe it is a good idea to make an exampe where one can compare vertex and face ghosts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because the changes in the tutorial were not meant to be reviewed or merged, rather to test stuff out locally.

This feature is not tested at all, and I see that as a bigger priority than fixing tutorials

@Davknapp Davknapp assigned lukasdreyer and unassigned Davknapp Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium Should be solved within half a year workload: medium Would take a week or less
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants