Skip to content

Feature: Add interpolate data functionality to mesh handle - #2382

Open
lenaploetzke wants to merge 26 commits into
mainfrom
handle-interpolate-data
Open

Feature: Add interpolate data functionality to mesh handle#2382
lenaploetzke wants to merge 26 commits into
mainfrom
handle-interpolate-data

Conversation

@lenaploetzke

@lenaploetzke lenaploetzke commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Closes #2383
This also Closes #2115 as we dont need this functionality for the feature (expected before) and also PR #2248 is not needed anymore.
I think we can also
Closes #1654
as this completes the core functionality.

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

@lenaploetzke
lenaploetzke marked this pull request as draft August 3, 2026 06:17
@lenaploetzke
lenaploetzke marked this pull request as ready for review August 6, 2026 10:17
@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.51852% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.44%. Comparing base (85c9c9d) to head (2e67660).

Files with missing lines Patch % Lines
mesh_handle/internal/interpolate.hxx 91.17% 3 Missing ⚠️
mesh_handle/element.hxx 89.47% 2 Missing ⚠️
mesh_handle/mesh.hxx 93.54% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2382      +/-   ##
==========================================
+ Coverage   82.36%   82.44%   +0.08%     
==========================================
  Files         125      126       +1     
  Lines       20708    20806      +98     
==========================================
+ Hits        17056    17154      +98     
  Misses       3652     3652              

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

@spenke91 spenke91 self-assigned this Aug 10, 2026
@spenke91
spenke91 self-requested a review August 10, 2026 13:31

@spenke91 spenke91 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.

Well, that was a nice dive into modern C++ template magic! 🪄
Took some time to get it, but I think the code is quite well designed. Great work @lenaploetzke !

I only have a bunch of small remarks and questions. To avoid spamming, I mostly refrained from adding hyphen-related comments; instead I would suggest the following replacements

user defined -> user-defined
index based -> index-based
span based -> span-based
element data handling -> element-data handling

But enough of being picky! Great feature, thanks a lot! 🙂
``

Comment thread src/t8_vtk/t8_vtk.h Outdated
Comment thread mesh_handle/mesh.hxx Outdated
Comment thread mesh_handle/competences/element_data_competences.hxx Outdated
Comment thread mesh_handle/competences/element_data_competences.hxx Outdated
Comment thread mesh_handle/mesh.hxx Outdated
Comment thread mesh_handle/competences/element_data_competences.hxx Outdated
Comment thread mesh_handle/mesh.hxx Outdated
Comment thread mesh_handle/mesh.hxx Outdated
Comment on lines +531 to +536
t8_global_infof ("No interpolation context set.\n");
}
}
else {
t8_global_infof ("The element data was not interpolated during adaptation. Use set_element_data() to provide "
"new data or use the mesh competence interpolate_element_data_mesh_competence.\n");

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.

Should this even be errors?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Maybe a user prefers to set new element data via set_element_data instead of using the competence? But yes, if we use the competence and do not provide a callback, i will throw an error.

Comment thread mesh_handle/mesh.hxx
Comment on lines +557 to +565
/** Function that checks if a competence for the interpolation of element data is given.
* \return true if mesh has the competence, false otherwise.
*/
static constexpr bool
has_interpolate_data_competence ()
{
return requires (SelfType& mesh) { mesh.set_partition_called (); };
}

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.

Is this really a clean way of checking it has the competence? Seems strange and weird to maintain to me 🤔

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes i finally found a way better solution!

static std::unordered_map<t8_forest_t, std::unique_ptr<mesh_interpolate_context_base>>&
get_map ()
{
static std::unordered_map<t8_forest_t, std::unique_ptr<mesh_interpolate_context_base>> map;

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.

The whole std::unorder_map construct seems a little over-engineered to me. Out of curiosity: Do we already know whether we might ever register more than one forest-context pair at a time? If not, maybe we could make this whole registry more lightweight. On the other hand, I also don't mind having it a little too generic and flexible...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Maybe we have two meshes at the same time in an example and because of the static, they use the same registry. I think for this, the unordered map is maybe necessary

@spenke91 spenke91 assigned lenaploetzke and unassigned spenke91 Sep 1, 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 interpolate data functionality to mesh handle Mesh handle: Add set_new_element_data routine Add an unstructured mesh interface

2 participants