Feature: Add subelement scheme for quad and triangle hanging node resolution - #2395
Feature: Add subelement scheme for quad and triangle hanging node resolution#2395lenaploetzke wants to merge 37 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2395 +/- ##
==========================================
+ Coverage 82.28% 82.35% +0.07%
==========================================
Files 125 131 +6
Lines 20703 21352 +649
==========================================
+ Hits 17035 17584 +549
- Misses 3668 3768 +100 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
spenke91
left a comment
There was a problem hiding this comment.
Thanks a lot @lenaploetzke for this great feature! I'm glad to see the subelement concept being molded into an actual implementation 👍
I like the overall code design and think it is great that we barely have to change the interface of the normal schemes. As you will see in one of the comments, I feel like we might be missing one layer of inheritance between "a subelement scheme for triangles" and "a subelement schemes for triangles that resolves haning nodes".
Aside from that, most of my comments are minor suggestion and remarks, as usual :-)
| if ((t8_forest_get_tree_element_offset (forest_from, which_tree) + lelement_id) % 2 == 0) { | ||
| return 1; | ||
| } | ||
| return 0; |
| } | ||
|
|
||
| int | ||
| t8_test_adapt_even_global_id ([[maybe_unused]] t8_forest_t forest, t8_forest_t forest_from, t8_locidx_t which_tree, |
There was a problem hiding this comment.
| t8_test_adapt_even_global_id ([[maybe_unused]] t8_forest_t forest, t8_forest_t forest_from, t8_locidx_t which_tree, | |
| t8_test_adapt_even_local_id ([[maybe_unused]] t8_forest_t forest, t8_forest_t forest_from, t8_locidx_t which_tree, |
| * \param [in] elements Pointers to a family or, if \a is_family is zero, pointer to one element. | ||
| */ | ||
| int | ||
| t8_test_adapt_even_global_id (t8_forest_t forest, t8_forest_t forest_from, t8_locidx_t which_tree, t8_eclass_t eclass, |
There was a problem hiding this comment.
| t8_test_adapt_even_global_id (t8_forest_t forest, t8_forest_t forest_from, t8_locidx_t which_tree, t8_eclass_t eclass, | |
| t8_test_adapt_even_local_id (t8_forest_t forest, t8_forest_t forest_from, t8_locidx_t which_tree, t8_eclass_t eclass, |
There was a problem hiding this comment.
I'd suggest to use the callback refine_every_nth_element_callback I recently added 🙂
(which is adjusted to global elements in #2415 )
| @@ -0,0 +1,25 @@ | |||
| # t8_subelement | |||
|
|
|||
| This folder provides **subelement schemes**. Subelements are inserted *after* the standard recursive refinement and enable one additional refinement level that uses a different scheme. | |||
There was a problem hiding this comment.
| This folder provides **subelement schemes**. Subelements are inserted *after* the standard recursive refinement and enable one additional refinement level that uses a different scheme. | |
| This folder provides **subelement schemes**. Subelements are inserted *after* the standard recursive refinement and enable one additional refinement step that uses a different scheme. |
I think we should not call it level to avoid confusion 🤔
| void *scheme_context; /**< Anonymous implementation context. */ | ||
|
|
||
| public: | ||
| // #################################____Constructor & Destructor...____############################################### |
There was a problem hiding this comment.
Is there a specific reason the constructor above is not sorted into this category?
| * \param[in] forest Forest to be adapted. | ||
| */ | ||
| t8_forest_t | ||
| t8_adapt_forest_2and (t8_forest_t forest) |
There was a problem hiding this comment.
| t8_adapt_forest_2and (t8_forest_t forest) | |
| t8_adapt_forest_2nd (t8_forest_t forest) |
?
| prefix_removed_sub); | ||
|
|
||
| /* --- Second cycle: adapt around the larger circle. --- */ | ||
| forest = t8_adapt_forest_2and (forest); |
There was a problem hiding this comment.
| forest = t8_adapt_forest_2and (forest); | |
| forest = t8_adapt_forest_2nd (forest); |
| struct t8_adapt_data adapt_data = { | ||
| { 0, 1, 0 }, /* Center of the circle. */ | ||
| 0.6, /* Radius */ | ||
| 0.1, /* Delta (transition band width) */ | ||
| 2, /* Minlevel */ | ||
| 6 /* Maxlevel */ | ||
| }; | ||
|
|
There was a problem hiding this comment.
Wouldn't it be easier to define the whole adapt_data somewhere accessible from main and just adjust the radius then via adapt_data.radius?
Then we could also get rid of these two adapt wrappers. However, both is fine.
| /* --- Adapt the forest: refine near the first circle, creating hanging nodes. --- */ | ||
| forest = t8_adapt_forest (forest); | ||
| std::cout << "Subelements before removing: " << t8_forest_has_global_subelements (forest) << std::endl; | ||
| prefix = "t8_adapted1"; |
There was a problem hiding this comment.
Might be convenient to adjust the naming because Paraview otherwise shows the two t8_adapted ptvu files as series in the open-file menu. Not a big problem, but maybe it would be nice to avoid it, e.g.,
| prefix = "t8_adapted1"; | |
| prefix = "t8_adapted_1st"; |
| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /** \file t8_scheme_tri.hxx |
There was a problem hiding this comment.
I would suggest to use more descriptive names for these two files. I know the context is clear from the path, but the path is often not shown, e.g., in vs code. So maybe something like t8_subelement_scheme_tri.hxx or t8_scheme_hanging_nodes_tri.hxx?

Closes #2396
Describe your changes here:
This PR adds a general subelement scheme with specializations for quad and triangle hanging node resolution. It also provides two examples and one test.
I implemented only the functions necessary for the visualization. Next steps are all functions necessary for simulations. This means for example neighbors.
All these boxes must be checked by the AUTHOR before requesting review:
Documentation:,Bugfix:,Feature:,Improvement:orOther:.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
Tests
If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):
Scripts and Wiki
scripts/internal/find_all_source_files.shto check the indentation of these files.License
doc/(or already has one).