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 <boost/functional/hash.hpp> 8 : #include <cstddef> 9 : #include <memory> 10 : #include <utility> 11 : 12 : #include "DataStructures/DataBox/Prefixes.hpp" 13 : #include "DataStructures/FixedHashMap.hpp" 14 : #include "DataStructures/Tensor/TypeAliases.hpp" 15 : #include "DataStructures/VariablesTag.hpp" 16 : #include "Domain/Structure/Element.hpp" 17 : #include "Domain/Structure/MaxNumberOfNeighbors.hpp" 18 : #include "Domain/Tags.hpp" 19 : #include "Evolution/DgSubcell/Tags/GhostDataForReconstruction.hpp" 20 : #include "Evolution/DgSubcell/Tags/Mesh.hpp" 21 : #include "Evolution/Systems/ScalarAdvection/FiniteDifference/Reconstructor.hpp" 22 : #include "Evolution/Systems/ScalarAdvection/Tags.hpp" 23 : #include "Options/String.hpp" 24 : #include "Utilities/TMPL.hpp" 25 : 26 : /// \cond 27 : class DataVector; 28 : template <size_t Dim> 29 : class Direction; 30 : template <size_t Dim> 31 : class Element; 32 : template <size_t Dim> 33 : class ElementId; 34 : template <size_t Dim> 35 : class Mesh; 36 : template <typename TagsList> 37 : class Variables; 38 : namespace gsl { 39 : template <typename> 40 : class not_null; 41 : } // namespace gsl 42 : namespace PUP { 43 : class er; 44 : } // namespace PUP 45 : namespace evolution::dg::subcell { 46 : class GhostData; 47 : } // namespace evolution::dg::subcell 48 : /// \endcond 49 : 50 : namespace ScalarAdvection::fd { 51 : /*! 52 : * \brief Monotonised central reconstruction. See 53 : * ::fd::reconstruction::monotonised_central() for details. 54 : */ 55 : template <size_t Dim> 56 1 : class MonotonisedCentral : public Reconstructor<Dim> { 57 : private: 58 0 : using volume_vars_tags = tmpl::list<Tags::U>; 59 : 60 : public: 61 0 : using options = tmpl::list<>; 62 0 : static constexpr Options::String help{ 63 : "Monotonised central reconstruction scheme."}; 64 : 65 0 : MonotonisedCentral() = default; 66 0 : MonotonisedCentral(MonotonisedCentral&&) = default; 67 0 : MonotonisedCentral& operator=(MonotonisedCentral&&) = default; 68 0 : MonotonisedCentral(const MonotonisedCentral&) = default; 69 0 : MonotonisedCentral& operator=(const MonotonisedCentral&) = default; 70 0 : ~MonotonisedCentral() override = default; 71 : 72 0 : void pup(PUP::er& p) override; 73 : 74 : /// \cond 75 : explicit MonotonisedCentral(CkMigrateMessage* msg); 76 : WRAPPED_PUPable_decl_base_template(Reconstructor<Dim>, MonotonisedCentral); 77 : /// \endcond 78 : 79 0 : auto get_clone() const -> std::unique_ptr<Reconstructor<Dim>> override; 80 : 81 0 : size_t ghost_zone_size() const override { return 2; } 82 : 83 0 : using reconstruction_argument_tags = 84 : tmpl::list<::Tags::Variables<volume_vars_tags>, 85 : domain::Tags::Element<Dim>, 86 : evolution::dg::subcell::Tags::GhostDataForReconstruction<Dim>, 87 : evolution::dg::subcell::Tags::Mesh<Dim>>; 88 : 89 : template <typename TagsList> 90 0 : void reconstruct( 91 : gsl::not_null<std::array<Variables<TagsList>, Dim>*> vars_on_lower_face, 92 : gsl::not_null<std::array<Variables<TagsList>, Dim>*> vars_on_upper_face, 93 : const Variables<tmpl::list<Tags::U>>& volume_vars, 94 : const Element<Dim>& element, 95 : const FixedHashMap< 96 : maximum_number_of_neighbors(Dim), 97 : std::pair<Direction<Dim>, ElementId<Dim>>, 98 : evolution::dg::subcell::GhostData, 99 : boost::hash<std::pair<Direction<Dim>, ElementId<Dim>>>>& ghost_data, 100 : const Mesh<Dim>& subcell_mesh) const; 101 : 102 : template <typename TagsList> 103 0 : void reconstruct_fd_neighbor( 104 : gsl::not_null<Variables<TagsList>*> vars_on_face, 105 : const Variables<tmpl::list<Tags::U>>& volume_vars, 106 : const Element<Dim>& element, 107 : const FixedHashMap< 108 : maximum_number_of_neighbors(Dim), 109 : std::pair<Direction<Dim>, ElementId<Dim>>, 110 : evolution::dg::subcell::GhostData, 111 : boost::hash<std::pair<Direction<Dim>, ElementId<Dim>>>>& ghost_data, 112 : const Mesh<Dim>& subcell_mesh, 113 : const Direction<Dim> direction_to_reconstruct) const; 114 : }; 115 : 116 : template <size_t Dim> 117 0 : bool operator==(const MonotonisedCentral<Dim>& /*lhs*/, 118 : const MonotonisedCentral<Dim>& /*rhs*/); 119 : 120 : template <size_t Dim> 121 0 : bool operator!=(const MonotonisedCentral<Dim>& lhs, 122 : const MonotonisedCentral<Dim>& rhs); 123 : } // namespace ScalarAdvection::fd