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 <pup.h> 9 : 10 : #include "DataStructures/Variables.hpp" 11 : #include "Domain/Structure/OrientationMapHelpers.hpp" 12 : #include "NumericalAlgorithms/DiscontinuousGalerkin/MortarHelpers.hpp" 13 : #include "Utilities/TMPL.hpp" 14 : #include "Utilities/TaggedTuple.hpp" 15 : 16 : /// \cond 17 : template <size_t Dim> 18 : struct Index; 19 : template <size_t Dim> 20 : struct Mesh; 21 : template <size_t Dim> 22 : struct OrientationMap; 23 : /// \endcond 24 : 25 : namespace dg { 26 : 27 : /*! 28 : * \brief Distinguishes between field data, which can be projected to a mortar, 29 : * and extra data, which will not be projected. 30 : */ 31 : template <typename FieldTags, typename ExtraDataTags = tmpl::list<>> 32 1 : struct SimpleBoundaryData { 33 0 : using field_tags = FieldTags; 34 0 : using extra_data_tags = ExtraDataTags; 35 : 36 : /// Data projected to the mortar mesh 37 1 : Variables<FieldTags> field_data; 38 : 39 : /// Data on the element face that needs no projection to the mortar mesh. 40 : /// This is a `TaggedTuple` to support non-tensor quantities. It also helps 41 : /// supporting an empty list of `ExtraDataTags`. 42 1 : tuples::tagged_tuple_from_typelist<ExtraDataTags> extra_data; 43 : 44 0 : SimpleBoundaryData() = default; 45 0 : SimpleBoundaryData(const SimpleBoundaryData&) = default; 46 0 : SimpleBoundaryData& operator=(const SimpleBoundaryData&) = default; 47 0 : SimpleBoundaryData(SimpleBoundaryData&&) = default; 48 0 : SimpleBoundaryData& operator=(SimpleBoundaryData&&) = default; 49 0 : ~SimpleBoundaryData() = default; 50 : 51 0 : explicit SimpleBoundaryData(const size_t num_points) 52 : : field_data{num_points}, extra_data{} {} 53 : 54 : // NOLINTNEXTLINE(google-runtime-references) 55 0 : void pup(PUP::er& p) { 56 : p | field_data; 57 : p | extra_data; 58 : } 59 : 60 : /// Project the `field_data` to the mortar 61 : /// 62 : /// \see `dg::project_to_mortar` 63 : template <size_t MortarDim> 64 1 : SimpleBoundaryData<FieldTags, ExtraDataTags> project_to_mortar( 65 : const Mesh<MortarDim>& face_mesh, const Mesh<MortarDim>& mortar_mesh, 66 : const MortarSize<MortarDim>& mortar_size) const { 67 : SimpleBoundaryData<FieldTags, ExtraDataTags> projected_data{}; 68 : projected_data.field_data = dg::project_to_mortar( 69 : this->field_data, face_mesh, mortar_mesh, mortar_size); 70 : projected_data.extra_data = this->extra_data; 71 : return projected_data; 72 : } 73 : 74 : /// Orient the `field_data` 75 : /// 76 : /// \see `orient_variables_on_slice` 77 : template <size_t MortarDim> 78 1 : void orient_on_slice( 79 : const Index<MortarDim>& slice_extents, const size_t sliced_dim, 80 : const OrientationMap<MortarDim + 1>& orientation_of_neighbor) { 81 : this->field_data = orient_variables_on_slice( 82 : this->field_data, slice_extents, sliced_dim, orientation_of_neighbor); 83 : } 84 : }; 85 : 86 : } // namespace dg