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 <memory> 8 : #include <string> 9 : #include <unordered_map> 10 : 11 : #include "DataStructures/DataBox/Tag.hpp" 12 : #include "DataStructures/Tensor/TypeAliases.hpp" 13 : #include "Domain/CoordinateMaps/CoordinateMap.hpp" 14 : #include "Domain/FunctionsOfTime/Tags.hpp" 15 : #include "Evolution/DgSubcell/Tags/Mesh.hpp" 16 : #include "NumericalAlgorithms/Spectral/LogicalCoordinates.hpp" 17 : #include "Utilities/GetOutput.hpp" 18 : #include "Utilities/TMPL.hpp" 19 : 20 : /// \cond 21 : class DataVector; 22 : template <size_t Dim> 23 : class Mesh; 24 : namespace Tags { 25 : struct Time; 26 : } // namespace Tags 27 : namespace gsl { 28 : template <typename> 29 : struct not_null; 30 : } // namespace gsl 31 : namespace domain::FunctionsOfTime { 32 : class FunctionOfTime; 33 : } // namespace domain::FunctionsOfTime 34 : /// \endcond 35 : 36 : namespace evolution::dg::subcell::Tags { 37 : /// The coordinates in a given frame. 38 : template <size_t Dim, typename Frame> 39 1 : struct Coordinates : db::SimpleTag { 40 0 : static std::string name() { return get_output(Frame{}) + "Coordinates"; } 41 0 : using type = tnsr::I<DataVector, Dim, Frame>; 42 : }; 43 : 44 : /// The element logical coordinates on the subcell grid 45 : template <size_t VolumeDim> 46 1 : struct LogicalCoordinatesCompute 47 : : Coordinates<VolumeDim, Frame::ElementLogical>, 48 : db::ComputeTag { 49 0 : using base = Coordinates<VolumeDim, Frame::ElementLogical>; 50 0 : using return_type = typename base::type; 51 0 : using argument_tags = tmpl::list<Mesh<VolumeDim>>; 52 0 : static constexpr auto function = static_cast<void (*)( 53 : gsl::not_null<return_type*>, const ::Mesh<VolumeDim>&)>( 54 : &logical_coordinates<VolumeDim>); 55 : }; 56 : 57 : /// The inertial coordinates on the subcell grid 58 : template <typename MapTagGridToInertial> 59 1 : struct InertialCoordinatesCompute 60 : : Coordinates<MapTagGridToInertial::dim, Frame::Inertial>, 61 : db::ComputeTag { 62 0 : static constexpr size_t dim = MapTagGridToInertial::dim; 63 0 : using base = Coordinates<dim, Frame::Inertial>; 64 0 : using return_type = typename base::type; 65 0 : using argument_tags = 66 : tmpl::list<MapTagGridToInertial, Tags::Coordinates<dim, Frame::Grid>, 67 : ::Tags::Time, ::domain::Tags::FunctionsOfTime>; 68 0 : static void function( 69 : const gsl::not_null<return_type*> inertial_coords, 70 : const ::domain::CoordinateMapBase<Frame::Grid, Frame::Inertial, dim>& 71 : grid_to_inertial_map, 72 : const tnsr::I<DataVector, dim, Frame::Grid>& grid_coords, 73 : const double time, 74 : const std::unordered_map< 75 : std::string, 76 : std::unique_ptr<::domain::FunctionsOfTime::FunctionOfTime>>& 77 : functions_of_time) { 78 : *inertial_coords = 79 : grid_to_inertial_map(grid_coords, time, functions_of_time); 80 : } 81 : }; 82 : } // namespace evolution::dg::subcell::Tags