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 "Evolution/DiscontinuousGalerkin/TimeSteppingPolicy.hpp" 14 : #include "NumericalAlgorithms/DiscontinuousGalerkin/MortarInterpolator.hpp" 15 : #include "NumericalAlgorithms/Spectral/SegmentSize.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 TimeSteppingPolicy 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 : TimeSteppingPolicy time_stepping_policy{TimeSteppingPolicy::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 TimeSteppingPolicy of the mortar 78 1 : const TimeSteppingPolicy& time_stepping_policy() const { 79 : return data_.time_stepping_policy; 80 : } 81 1 : TimeSteppingPolicy& time_stepping_policy() { 82 : return data_.time_stepping_policy; 83 : } 84 : /// @} 85 : 86 : // NOLINTNEXTLINE(google-runtime-references) 87 0 : void pup(PUP::er& p); 88 : 89 : private: 90 0 : MortarInfoData data_; 91 : }; 92 : 93 : template <size_t VolumeDim> 94 0 : bool operator==(const MortarInfo<VolumeDim>& lhs, 95 : const MortarInfo<VolumeDim>& rhs); 96 : 97 : template <size_t VolumeDim> 98 0 : bool operator!=(const MortarInfo<VolumeDim>& lhs, 99 : const MortarInfo<VolumeDim>& rhs); 100 : 101 : template <size_t VolumeDim> 102 0 : std::ostream& operator<<(std::ostream& os, 103 : const MortarInfo<VolumeDim>& mortar_info); 104 : } // namespace evolution::dg