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