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 : /// - If the element wants to join, and the neighbor is a potential sibling but 38 : /// wants to be at a different refinement level in any dimension, the flag is 39 : /// updated to not do h-refinement. 40 : /// - An Element that is splitting in one dimension is not allowed to join 41 : /// in another dimension. If this is occurs when updating the decision, 42 : /// the decision to join is changed to do nothing. 43 : /// 44 : /// \returns true if any flag is changed 45 : /// 46 : /// \note Modifies `my_current_amr_flags` which are the AMR decisions of 47 : /// `element`. 48 : template <size_t VolumeDim> 49 1 : bool update_amr_decision( 50 : gsl::not_null<std::array<Flag, VolumeDim>*> my_current_amr_flags, 51 : const Element<VolumeDim>& element, const ElementId<VolumeDim>& neighbor_id, 52 : const std::array<Flag, VolumeDim>& neighbor_amr_flags); 53 : } // namespace amr