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 : #include <optional>
9 : #include <pup.h>
10 : #include <pup_stl.h>
11 :
12 : #include "Evolution/DiscontinuousGalerkin/InterfaceDataPolicy.hpp"
13 : #include "NumericalAlgorithms/DiscontinuousGalerkin/MortarInterpolator.hpp"
14 : #include "NumericalAlgorithms/Spectral/SegmentSize.hpp"
15 : #include "Time/LtsMode.hpp"
16 : #include "Utilities/Serialization/PupStlCpp17.hpp"
17 : #include "Utilities/StdHelpers.hpp"
18 :
19 : namespace evolution::dg {
20 : /// \brief Information about the mortar between two Elements
21 : ///
22 : /// \details The following information is stored:
23 : /// - an optional MortarInterpolator; used by a non-conforming element that has
24 : /// InterfaceDataPolicy::NonconformingSelfInterpolates
25 : /// - the mortar size; for conforming neighbors this is (in each dimension of
26 : /// the mortar) the SegmentSize of the mortar with respect to the face of the
27 : /// host Element
28 : /// - the InterfaceDataPolicy
29 : /// - the time-stepping policy
30 : template <size_t VolumeDim>
31 1 : class MortarInfo {
32 0 : struct MortarInfoData {
33 0 : std::optional<::dg::MortarInterpolator<VolumeDim>> interpolator{
34 : std::nullopt};
35 0 : std::array<Spectral::SegmentSize, VolumeDim - 1> mortar_size{};
36 0 : InterfaceDataPolicy interface_data_policy{
37 : InterfaceDataPolicy::Uninitialized};
38 0 : LtsMode time_stepping_policy{LtsMode::Uninitialized};
39 : // NOLINTNEXTLINE(google-runtime-references)
40 0 : void pup(PUP::er& p);
41 : };
42 :
43 : public:
44 0 : MortarInfo() = default;
45 0 : MortarInfo(const MortarInfo&) = default;
46 0 : MortarInfo(MortarInfo&&) = default;
47 0 : MortarInfo& operator=(const MortarInfo&) = default;
48 0 : MortarInfo& operator=(MortarInfo&&) = default;
49 0 : ~MortarInfo() = default;
50 :
51 0 : explicit MortarInfo(MortarInfoData data);
52 :
53 : /// @{
54 : /// Interpolator used by a non-conforming element that has
55 : /// InterfaceDataPolicy::NonconformingSelfInterpolates
56 1 : const std::optional<::dg::MortarInterpolator<VolumeDim>>& interpolator()
57 : const {
58 : return data_.interpolator;
59 : }
60 1 : std::optional<::dg::MortarInterpolator<VolumeDim>>& interpolator() {
61 : return data_.interpolator;
62 : }
63 : /// @}
64 :
65 : /// For conforming neighbors, the SegmentSize of the mortar with respect to
66 : /// the face of the host Element
67 1 : const std::array<Spectral::SegmentSize, VolumeDim - 1>& mortar_size() const {
68 : return data_.mortar_size;
69 : }
70 :
71 : /// The InterfaceDataPolicy of the host Element for the mortar
72 1 : const InterfaceDataPolicy& interface_data_policy() const {
73 : return data_.interface_data_policy;
74 : }
75 :
76 : /// @{
77 : /// The time-stepping policy of the mortar
78 1 : const LtsMode& time_stepping_policy() const {
79 : return data_.time_stepping_policy;
80 : }
81 1 : LtsMode& time_stepping_policy() { return data_.time_stepping_policy; }
82 : /// @}
83 :
84 : // NOLINTNEXTLINE(google-runtime-references)
85 0 : void pup(PUP::er& p);
86 :
87 : private:
88 0 : MortarInfoData data_;
89 : };
90 :
91 : template <size_t VolumeDim>
92 0 : bool operator==(const MortarInfo<VolumeDim>& lhs,
93 : const MortarInfo<VolumeDim>& rhs);
94 :
95 : template <size_t VolumeDim>
96 0 : bool operator!=(const MortarInfo<VolumeDim>& lhs,
97 : const MortarInfo<VolumeDim>& rhs);
98 :
99 : template <size_t VolumeDim>
100 0 : std::ostream& operator<<(std::ostream& os,
101 : const MortarInfo<VolumeDim>& mortar_info);
102 : } // namespace evolution::dg
|