UpdateAmrDecision.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <array>
7 #include <cstddef>
8 
9 #include "Domain/Amr/Flag.hpp"
10 
11 /// \cond
12 namespace gsl {
13 template <typename T>
14 class not_null;
15 } // namespace gsl
16 
17 template <size_t VolumeDim>
18 class Element;
19 
20 template <size_t VolumeDim>
21 class ElementId;
22 /// \endcond
23 
24 namespace amr {
25 /// \ingroup ComputationalDomainGroup
26 /// \brief Updates the AMR decisions `my_current_amr_flags` of the Element
27 /// `element` based on the AMR decisions `neighbor_amr_flags` of a neighbor
28 /// Element with ElementId `neighbor_id`.
29 ///
30 /// \details This function is called by each element when it receives the AMR
31 /// decisions of one of its neighbors. If any of its flags are updated, the
32 /// element should send its new decisions to each of its neighbors. The
33 /// following changes are made to the current flags of the element:
34 /// - If the neighbor wants to be two or more refinement levels higher than
35 /// the element, the flag is updated to bring the element to within one level
36 /// - If the element wants to join, and the neighbor is a potential sibling but
37 /// wants to be at a different refinement level in any dimension, the flag is
38 /// updated to not do h-refinement.
39 ///
40 /// \returns true if any flag is changed
41 ///
42 /// \note Modifies `my_current_amr_flags` which are the AMR decisions of
43 /// `element`.
44 template <size_t VolumeDim>
46  gsl::not_null<std::array<amr::Flag, VolumeDim>*> my_current_amr_flags,
47  const Element<VolumeDim>& element, const ElementId<VolumeDim>& neighbor_id,
48  const std::array<amr::Flag, VolumeDim>& neighbor_amr_flags) noexcept;
49 } // namespace amr
Implementations from the Guideline Support Library.
Definition: ConservativeFromPrimitive.hpp:10
An ElementId uniquely labels an Element. It is constructed from the BlockId of the Block to which the...
Definition: ElementId.hpp:36
Items for adaptive mesh refinement.
Definition: Flag.cpp:9
bool update_amr_decision(gsl::not_null< std::array< amr::Flag, VolumeDim > *> my_current_amr_flags, const Element< VolumeDim > &element, const ElementId< VolumeDim > &neighbor_id, const std::array< amr::Flag, VolumeDim > &neighbor_amr_flags) noexcept
Updates the AMR decisions my_current_amr_flags of the Element element based on the AMR decisions neig...
Definition: UpdateAmrDecision.cpp:21
A spectral element with knowledge of its neighbors.
Definition: Element.hpp:29
Defines enum class amr::Flag.
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12