Skip to content

Conversation

@holke
Copy link
Collaborator

@holke holke commented Nov 18, 2025

Closes #1977

Describe your changes here:

Currently this looks like more than it acutally is, since it contains the large changes from #1736.
Merge #1736 first.

Only reordering of files, no source code added except includes.

forest.cxx is overloaded with functions.
I cleaned it up a little by moving all face neighbor related functions into 2 separate headers/source files.
One for element (i.e. same level) face neighbor and one for leaf face neighbor.

All these boxes must be checked by the AUTHOR before requesting review:

  • The PR is small enough to be reviewed easily. If not, consider splitting up the changes in multiple PRs.
  • The title starts with one of the following prefixes: Documentation:, Bugfix:, Feature:, Improvement: or Other:.
  • If the PR is related to an issue, make sure to link it.
  • The author made sure that, as a reviewer, he/she would check all boxes below.

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 CMake files.
  • The code is well documented. In particular, 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.
  • The code coverage of the project (reported in the CI) should not decrease. If coverage is decreased, make sure that this is reasonable and acceptable.
  • Valgrind doesn't find any bugs in the new code. This script can be used to check for errors; see also this wiki article.

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 or tutorial and a Wiki article.

License

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

@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 86.24031% with 71 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.69%. Comparing base (a1a32bd) to head (df4ec94).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
...8_forest_neighbor/t8_forest_leaf_face_neighbor.cxx 83.40% 37 Missing ⚠️
src/t8_forest/t8_forest_ghost.cxx 25.80% 23 Missing ⚠️
...orest_neighbor/t8_forest_element_face_neighbor.cxx 91.17% 6 Missing ⚠️
src/t8_forest/t8_forest_private.cxx 94.44% 2 Missing ⚠️
src/t8_schemes/t8_scheme_helpers.hxx 89.47% 2 Missing ⚠️
src/t8_data/t8_containers.cxx 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1976      +/-   ##
==========================================
+ Coverage   75.66%   76.69%   +1.02%     
==========================================
  Files         105      107       +2     
  Lines       18646    18852     +206     
==========================================
+ Hits        14109    14459     +350     
+ Misses       4537     4393     -144     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@holke holke changed the base branch from main to feature-extend_lfn_to_ghosts November 24, 2025 14:24
@Davknapp Davknapp self-assigned this Dec 15, 2025
t8code is a C library to manage a collection (a forest) of multiple
connected adaptive space-trees of general element classes in parallel.

Copyright (C) 2024 the developers
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
Copyright (C) 2024 the developers
Copyright (C) 2025 the developers

parts. In that case, process boundary elements will have 0 neighbors.
*/
t8_gloidx_t
t8_forest_element_face_neighbor (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *elem, t8_element_t *neigh,
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
t8_forest_element_face_neighbor (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *elem, t8_element_t *neigh,
t8_forest_element_face_neighbor (const t8_forest_t forest, cosnt t8_locidx_t ltreeid, const t8_element_t *elem, t8_element_t *neigh,

*/
t8_gloidx_t
t8_forest_element_face_neighbor (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *elem, t8_element_t *neigh,
const t8_eclass_t neigh_eclass, int face, int *neigh_face)
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
const t8_eclass_t neigh_eclass, int face, int *neigh_face)
const t8_eclass_t neigh_eclass, const int face, int *neigh_face)


/* This function is declared in t8_forest_private.h */
t8_gloidx_t
t8_forest_element_half_face_neighbors (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *elem,
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
t8_forest_element_half_face_neighbors (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *elem,
t8_forest_element_half_face_neighbors (const t8_forest_t forest, const t8_locidx_t ltreeid, const t8_element_t *elem,

/* This function is declared in t8_forest_private.h */
t8_gloidx_t
t8_forest_element_half_face_neighbors (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *elem,
t8_element_t *neighs[], t8_eclass_t neigh_class, int face, int num_neighs,
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
t8_element_t *neighs[], t8_eclass_t neigh_class, int face, int num_neighs,
t8_element_t *neighs[], const t8_eclass_t neigh_class, const int face, const int num_neighs,

t8code is a C library to manage a collection (a forest) of multiple
connected adaptive space-trees of general element classes in parallel.

Copyright (C) 2024 the developers
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
Copyright (C) 2024 the developers
Copyright (C) 2025 the developers

* After the search the entries of the buffer are used and the
* search can start again with a clean buffer.
*/
struct t8_lfn_user_data
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
struct t8_lfn_user_data
typedef struct

std::vector<t8_locidx_t> element_indices; /**< Element indices of the found neighbors. */
std::vector<int> dual_faces; /**< Dual faces of the found neighbors. */
std::vector<const t8_element_t *> neighbors; /**< Pointers to the actual neighbor elements. */
};
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
};
} t8_lfn_user_data ;

const t8_locidx_t adjusted_tree_id = !is_ghost_tree ? ltreeid : ltreeid - t8_forest_get_num_local_trees (forest);
T8_ASSERT (t8_forest_element_is_leaf_or_ghost (forest, element, adjusted_tree_id, is_ghost_tree));

struct t8_lfn_user_data *lfn_data = reinterpret_cast<struct t8_lfn_user_data *> (user_data);
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
struct t8_lfn_user_data *lfn_data = reinterpret_cast<struct t8_lfn_user_data *> (user_data);
t8_lfn_user_data *lfn_data = reinterpret_cast<t8_lfn_user_data *> (user_data);

}
}

struct t8_lfn_user_data user_data;
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
struct t8_lfn_user_data user_data;
t8_lfn_user_data user_data;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improvement: own header and source file for forest face neighbor functions

6 participants