Helpers.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// Functions used for adaptive mesh refinement decisions.
6 
7 #pragma once
8 
9 #include <array>
10 #include <cstddef>
11 
12 #include "Domain/Amr/Flag.hpp"
13 
14 /// \cond
15 template <size_t VolumeDim>
16 class Direction;
17 
18 template <size_t VolumeDim>
19 class ElementId;
20 
21 template <size_t VolumeDim>
22 class OrientationMap;
23 /// \endcond
24 
25 namespace amr {
26 /// \ingroup ComputationalDomainGroup
27 /// \brief Computes the desired refinement level of the Element with ElementId
28 /// `id` given the desired amr::Flag%s `flags`
29 template <size_t VolumeDim>
31  const ElementId<VolumeDim>& id,
32  const std::array<amr::Flag, VolumeDim>& flags) noexcept;
33 
34 /// \ingroup ComputationalDomainGroup
35 /// \brief Computes the desired refinement level of a neighboring Element with
36 /// ElementId `neighbor_id` given its desired amr::Flag%s `neighbor_flags`
37 /// taking into account the OrientationMap `orientation` of the neighbor
38 ///
39 /// \details The OrientationMap `orientation` is that from the Element that has
40 /// a neighbor with ElementId `neighbor_id`
41 template <size_t VolumeDim>
43  const ElementId<VolumeDim>& neighbor_id,
44  const std::array<amr::Flag, VolumeDim>& neighbor_flags,
45  const OrientationMap<VolumeDim>& orientation) noexcept;
46 
47 /// \ingroup ComputationalDomainGroup
48 /// \brief Whether or not the Element with `element_id` can have a sibling
49 /// in the given `direction`
50 template <size_t VolumeDim>
51 bool has_potential_sibling(const ElementId<VolumeDim>& element_id,
52  const Direction<VolumeDim>& direction) noexcept;
53 } // namespace amr
An ElementId uniquely labels an Element. It is constructed from the BlockId of the Block to which the...
Definition: ElementId.hpp:36
std::array< size_t, VolumeDim > desired_refinement_levels_of_neighbor(const ElementId< VolumeDim > &neighbor_id, const std::array< amr::Flag, VolumeDim > &neighbor_flags, const OrientationMap< VolumeDim > &orientation) noexcept
Computes the desired refinement level of a neighboring Element with ElementId neighbor_id given its d...
Definition: Helpers.cpp:35
bool has_potential_sibling(const ElementId< VolumeDim > &element_id, const Direction< VolumeDim > &direction) noexcept
Whether or not the Element with element_id can have a sibling in the given direction ...
Definition: Helpers.cpp:59
Items for adaptive mesh refinement.
Definition: Flag.cpp:9
A particular Side along a particular coordinate Axis.
Definition: Direction.hpp:23
Defines enum class amr::Flag.
std::array< size_t, VolumeDim > desired_refinement_levels(const ElementId< VolumeDim > &id, const std::array< amr::Flag, VolumeDim > &flags) noexcept
Computes the desired refinement level of the Element with ElementId id given the desired amr::Flags f...
Definition: Helpers.cpp:16