Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 : #include <iosfwd>
8 : #include <vector>
9 :
10 : #include "DataStructures/DataVector.hpp"
11 : #include "NumericalAlgorithms/Spectral/Mesh.hpp"
12 :
13 : /// \cond
14 : namespace PUP {
15 : class er;
16 : } // namespace PUP
17 : /// \endcond
18 :
19 : namespace evolution::dg {
20 : /// \brief Information sent by a non-conforming Element that interpolates its
21 : /// boundary data to a subset of the points of the Element receiving this
22 : ///
23 : /// \details The following information is sent:
24 : /// - the interpolated data (as a DataVector representing a type-erased
25 : /// Variables)
26 : /// - the Mesh that was used to compute the target points of the boundary face
27 : /// of the receiving Element. This is sent so that the receiving Element can
28 : /// check if the data was interpolated to the correct points.
29 : /// - the offsets of the interpolated data with respect to the target Mesh
30 : template <size_t VolumeDim>
31 1 : class InterpolatedBoundaryData {
32 0 : struct Info {
33 0 : DataVector data{};
34 0 : Mesh<VolumeDim - 1> target_mesh{};
35 0 : std::vector<size_t> offsets{};
36 : // NOLINTNEXTLINE(google-runtime-references)
37 0 : void pup(PUP::er& p);
38 : };
39 :
40 : public:
41 0 : InterpolatedBoundaryData() = default;
42 0 : InterpolatedBoundaryData(const InterpolatedBoundaryData&) = default;
43 0 : InterpolatedBoundaryData(InterpolatedBoundaryData&&) = default;
44 0 : InterpolatedBoundaryData& operator=(const InterpolatedBoundaryData&) =
45 : default;
46 0 : InterpolatedBoundaryData& operator=(InterpolatedBoundaryData&&) = default;
47 0 : ~InterpolatedBoundaryData() = default;
48 :
49 0 : explicit InterpolatedBoundaryData(InterpolatedBoundaryData::Info info);
50 :
51 0 : const DataVector& boundary_data() const { return info_.data; }
52 0 : const Mesh<VolumeDim - 1>& target_mesh() const { return info_.target_mesh; }
53 0 : const std::vector<size_t>& offsets() const { return info_.offsets; }
54 :
55 : // NOLINTNEXTLINE(google-runtime-references)
56 0 : void pup(PUP::er& p);
57 :
58 : private:
59 0 : Info info_;
60 : };
61 :
62 : template <size_t VolumeDim>
63 0 : bool operator==(const InterpolatedBoundaryData<VolumeDim>& lhs,
64 : const InterpolatedBoundaryData<VolumeDim>& rhs);
65 :
66 : template <size_t VolumeDim>
67 0 : bool operator!=(const InterpolatedBoundaryData<VolumeDim>& lhs,
68 : const InterpolatedBoundaryData<VolumeDim>& rhs);
69 :
70 : template <size_t VolumeDim>
71 0 : std::ostream& operator<<(std::ostream& os,
72 : const InterpolatedBoundaryData<VolumeDim>& value);
73 : } // namespace evolution::dg
|