Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <array>
7 : #include <cstddef>
8 :
9 : /// \cond
10 : namespace amr {
11 : enum class Flag;
12 : } // namespace amr
13 : namespace gsl {
14 : template <typename T>
15 : class not_null;
16 : } // namespace gsl
17 :
18 : template <size_t VolumeDim>
19 : class Element;
20 :
21 : template <size_t VolumeDim>
22 : class ElementId;
23 : /// \endcond
24 :
25 : namespace amr {
26 : /// \ingroup AmrGroup
27 : /// \brief Updates the AMR decisions `my_current_amr_flags` of the Element
28 : /// `element` based on the AMR decisions `neighbor_amr_flags` of a neighbor
29 : /// Element with ElementId `neighbor_id`.
30 : ///
31 : /// \details This function is called by each element when it receives the AMR
32 : /// decisions of one of its neighbors. If any of its flags are updated, the
33 : /// element should send its new decisions to each of its neighbors. The
34 : /// following changes are made to the current flags of the element:
35 : /// - If the neighbor wants to be two or more refinement levels higher than
36 : /// the element, the flag is updated to bring the element to within one level
37 : /// (unless this occurs in the direction to the neighbor and
38 : /// `enforce_two_to_one_balance_in_normal_direction` is set to false).
39 : /// - If the element wants to join, and the neighbor is a potential sibling but
40 : /// wants to be at a different refinement level in any dimension, the flag is
41 : /// updated to not do h-refinement.
42 : /// - An Element that is splitting in one dimension is not allowed to join
43 : /// in another dimension. If this is occurs when updating the decision,
44 : /// the decision to join is changed to do nothing.
45 : ///
46 : /// \returns true if any flag is changed
47 : ///
48 : /// \note Modifies `my_current_amr_flags` which are the AMR decisions of
49 : /// `element`.
50 : template <size_t VolumeDim>
51 1 : bool update_amr_decision(
52 : gsl::not_null<std::array<Flag, VolumeDim>*> my_current_amr_flags,
53 : const Element<VolumeDim>& element, const ElementId<VolumeDim>& neighbor_id,
54 : const std::array<Flag, VolumeDim>& neighbor_amr_flags,
55 : bool enforce_two_to_one_balance_in_normal_direction);
56 : } // namespace amr
|