Adaptive mesh refinement algorithm.
Public Member Functions | |
| node * | find (amr_node_idx n) noexcept |
| Finds a node in a sorted node_data container using binary search. | |
| node const * | find (amr_node_idx n) const noexcept |
| Finds a node in a sorted node_data container using binary search. | |
| node_data const & | data () const noexcept |
| Returns the node data (useful for visualizing/debugging) | |
| template<typename Action > | |
| void | compute_actions (Action &&action) |
| Computes the actions on every node and sorts them. | |
| bool | enforce_2_to_1_ratio_step () |
| Enforces 2:1 across all neighbor directions (single step) More... | |
| template<typename AfterIt = std::function<void()>> | |
| int | enforce_2_to_1_ratio (AfterIt &&after_it=[](){}) |
| Enforces 2:1 across all neighbor directions. More... | |
| auto | apply () |
| Applies the refinement and coarsening to the target's grid. | |
| template<typename Action , typename AfterIt = std::function<void()>> | |
| bool | adapt (Action &&action, AfterIt &&after_it=[](){}) |
Adapts the target t. | |
| bool hm3::amr::state< Target >::enforce_2_to_1_ratio_step | ( | ) |
Enforces 2:1 across all neighbor directions (single step)
Step 1: Remove coarsening flags (sibling group local):
are marked for coarsening Can be coarsened (set them to nothing otherwise)
Step 2: Remove coarsening flags (between sibling groups):
note: if a node is marked for coarsening here, all its siblings are marked for coarsening too due to Step 1
Or if any of the siblings is at a level greater than the node but not marked for coarsening
Step 3: Balance future refined nodes Every neighbor of a marked-for-refinement node that it is located at its parent level must also be marked for refinement to ensure 2:1
| int hm3::amr::state< Target >::enforce_2_to_1_ratio | ( | AfterIt && | after_it = []() {} | ) |
Enforces 2:1 across all neighbor directions.
This is an iterative process