Skip to content

Feature: Add dg competence to mesh handle#2321

Open
lenaploetzke wants to merge 15 commits into
mainfrom
trace-face-vector
Open

Feature: Add dg competence to mesh handle#2321
lenaploetzke wants to merge 15 commits into
mainfrom
trace-face-vector

Conversation

@lenaploetzke
Copy link
Copy Markdown
Collaborator

@lenaploetzke lenaploetzke commented May 12, 2026

Closes #2322
Additionally Closes #2096 as the abort is deleted

Describe your changes here:

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. Make sure to add a file documentation for each file!
  • 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 scripts/internal/find_all_source_files.sh 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
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 96.46018% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.71%. Comparing base (7c121bf) to head (2e1a160).

Files with missing lines Patch % Lines
mesh_handle/competences/dg_competences.hxx 96.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2321      +/-   ##
==========================================
+ Coverage   82.57%   82.71%   +0.14%     
==========================================
  Files         116      117       +1     
  Lines       18553    18665     +112     
==========================================
+ Hits        15320    15439     +119     
+ Misses       3233     3226       -7     

☔ 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.

Base automatically changed from new-handle-mesh-competences to main May 13, 2026 09:21
@spenke91 spenke91 self-assigned this May 20, 2026
@spenke91 spenke91 self-requested a review May 20, 2026 13:09
Copy link
Copy Markdown
Collaborator

@spenke91 spenke91 left a comment

Choose a reason for hiding this comment

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

As usual, the code design, its comments etc. are already very good 👍 -- and as usual, I just have some minor remarks and questions.

Comment thread mesh_handle/mesh.hxx
return requires (SelfType& mesh) { mesh.set_rank_vector (); };
}

/** Function that checks if a competence to determine a unique vector if the faces is given.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/** Function that checks if a competence to determine a unique vector if the faces is given.
/** Function that checks if a competence to determine a unique vector of the faces is given.

* = remote rank of that ghost
*/
void
set_rank_vector () const
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I feel like the name set_rank_vector is slightly misleading as it implies a classical setter, meaning we set some member given an argument. How about populate_rank_vector, fill_rank_vector, compute_rank_vector, or build_rank_vector?

int rank = LOCAL_RANK; ///< LOCAL_RANK if owned locally, else MPI rank of owner.
};

/** Class for a face. A face can have multiple \ref face_side s if different elements faces share the same face.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/** Class for a face. A face can have multiple \ref face_side s if different elements faces share the same face.
/** Class for a face. A face can have multiple \ref face_side s if different elements share the same face.

Comment on lines +143 to +150
/** The face sides of different elements adjacent to this face.
* Order conventions for the sides in the vector depend on the face type:
* - BOUNDARY: sides[0] = the single local side
* - CONFORMAL / MPI_CONFORMAL: sides[0] = primary (smaller handle id); sides[1] = secondary.
* For MPI_CONFORMAL the local side is always the primary side with the smaller handle id (local ids < ghost ids).
* - MORTAR / MPI_MORTAR: sides[0] = large side;
* sides[1..N] = small sides (in face-corner order of the large element)
*/
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Kudos for this very helpful comment ;-)

* so the local side is always the one that inserts the face.
* - MORTAR / MPI_MORTAR: the large (coarser) side owns the face and inserts it (also for ghosts).
* The small sides are specified in sides.
* Additionally, a vector is build that holds the face indices for each element.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Additionally, a vector is build that holds the face indices for each element.
* Additionally, a vector is built that holds the face indices for each element.

continue; // local large side will insert the face, so we can skip this.
}

// Check if the ghost is already inserted by another small mortar. If yes, only add the face.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Check if the ghost is already inserted by another small mortar. If yes, only add the face.
// Check if the ghost is already inserted by another small mortar. If yes, only add the face to the neighbor's \a sides array.

Or something like that? I feel like it should be made clearer what is meant by "only add the face"

continue;
}

const int orientation = t8_forest_leaf_face_orientation (
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const int orientation = t8_forest_leaf_face_orientation (
// Add large mortar face (ghost) to \a m_faces and update \a m_element_face_vector.
const int orientation = t8_forest_leaf_face_orientation (

std::vector<int> dual_faces;
auto neighs = elem_first.get_face_neighbors (face.sides[0].local_face_id, dual_faces);
/* --- BOUNDARY --- */
if (face.type == face_type::BOUNDARY) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think a switch-case statement would look cleaner

Suggested change
if (face.type == face_type::BOUNDARY) {
switch (face.type) {
case face_type::BOUNDARY:

etc.

Comment on lines +155 to +159
EXPECT_EQ (face.sides.size (), 1) << "BOUNDARY face must have exactly 1 side.";
EXPECT_EQ (face.sides[0].rank, LOCAL_RANK) << "BOUNDARY side must be local.";
EXPECT_FALSE (elem_first.is_ghost_element ()) << "BOUNDARY side element must be local.";
EXPECT_EQ (neighs.size (), 0) << "BOUNDARY side must not have neighbors.";
EXPECT_EQ (face.orientation,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Big fan of these "extended" EXPECT statements with descriptive messages :+1

<< "MORTAR side must have as many neighbors as small sides of the face.";

for (int ineigh = 0; ineigh < static_cast<int> (neighs.size ()); ++ineigh) {
// The neighbors must not have the same order as the face sides.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// The neighbors must not have the same order as the face sides.
// The neighbors do not necessarily have the same order as the face sides.

@spenke91 spenke91 assigned lenaploetzke and unassigned spenke91 May 27, 2026
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.

Feature: Add dg competence to mesh handle Improvement: Extend mesh handle face neighbors to ghost elements

2 participants