Skip to content

Feature: Added Element Methods (get_reference_coordinates, element_is_equal, t8_forest_leaf_face_orientation)#2360

Open
Vyp3er wants to merge 11 commits into
DLR-AMR:mainfrom
Vyp3er:element_methods
Open

Feature: Added Element Methods (get_reference_coordinates, element_is_equal, t8_forest_leaf_face_orientation)#2360
Vyp3er wants to merge 11 commits into
DLR-AMR:mainfrom
Vyp3er:element_methods

Conversation

@Vyp3er

@Vyp3er Vyp3er commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

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!
  • README.md files are updated if necessary.
  • 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).

@Vyp3er
Vyp3er marked this pull request as ready for review July 3, 2026 12:57
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.28%. Comparing base (610eda1) to head (9faa3b1).
⚠️ Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2360      +/-   ##
==========================================
- Coverage   82.30%   82.28%   -0.02%     
==========================================
  Files         125      125              
  Lines       20559    20711     +152     
==========================================
+ Hits        16922    17043     +121     
- Misses       3637     3668      +31     

☔ View full report in Codecov by Harness.
📢 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.

Comment thread src/t8_forest/t8_forest.cxx Outdated
Co-authored-by: lenaploetzke <70579874+lenaploetzke@users.noreply.github.com>
@lenaploetzke

Copy link
Copy Markdown
Collaborator

Please clean up the PR and remove changes in files that are not relevant here :)

@lenaploetzke lenaploetzke assigned lenaploetzke and unassigned Vyp3er Jul 21, 2026

@lenaploetzke lenaploetzke left a comment

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.

Very cool addition, thank you :)

Comment thread doc/author_schmitt.txt
@@ -0,0 +1 @@
I place my contributions to t8code under the FreeBSD license. Vincent Schmitt (vinz@vincent-schmitt.de) No newline at end of file

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.

Could you merge main? :)

Comment thread mesh_handle/element.hxx
return m_is_ghost_element;
}

// get_reference_coordinates

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
// get_reference_coordinates

We do not have titles in the remaining code, please also adapt for other functions

Comment thread mesh_handle/element.hxx
}

// get_reference_coordinates
/** Function to convert points in reference space of an element to points of the

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.

There are several sections in this file, maybe this should be placed at "Functionality of the 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.

same with the orientation. I think is equal is fine here

Comment thread mesh_handle/element.hxx
* \param [out] tree_ref_coords Pointer to the reference coordinates of the tree.
*/
void
get_reference_coordinates (const double* ref_coords, std::size_t num_coords, double* tree_ref_coords) 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.

Could you use t8_3D_vec instead of double* here? :) I also find it more intuitive if tree_ref_coords is the return.

Comment thread mesh_handle/element.hxx
}

// element_is_equal
/** Check if two elements are equal.

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 find it unituitive that two elements are compared inside the element class. I think we either should compare the element to another (so only with one arument which is the element to be compared with) OR should place this function outside of the class definition. I think i prefer the first way

Comment thread mesh_handle/element.hxx
* \return The orientation of the face with respect to its neighbor. Returns 0 if the face has no neighbor.
*/
int
get_face_orientation (int face) 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.

Very cool function, could you maybe use this one in dg_competences.hxx?

Comment thread mesh_handle/element.hxx
/** Compute the orientation of a face of an element with respect to its neighbor.
* \param [in] face The index of the face for which the orientation should be computed.
* \return The orientation of the face with respect to its neighbor. Returns 0 if the face has no neighbor.
*/

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
*/
*/

Could you please check that the comments have the correct indentation?

// --- Compare elements. ---
EXPECT_EQ (mesh_iterator->get_local_tree_id (), itree);
EXPECT_EQ (mesh_iterator->get_local_element_id (), ielem);
EXPECT_EQ (mesh_iterator->is_equal (*mesh_iterator, *mesh_iterator),

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 for this we can just check EXPECT_TRUE :) This has nothing to do with the forest. And i think it may be cool to also add a test case where this is false.

// --- Compare elements. ---
EXPECT_EQ (mesh_iterator->get_local_tree_id (), itree);
EXPECT_EQ (mesh_iterator->get_local_element_id (), ielem);
EXPECT_EQ (mesh_iterator->is_equal (*mesh_iterator, *mesh_iterator),

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.

We also need this functios to be tested for ghost cells, see t8_gtest_ghost.cxx

@lenaploetzke lenaploetzke assigned Vyp3er and unassigned lenaploetzke Jul 22, 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.

2 participants