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 <cstdint> 9 : #include <iosfwd> 10 : 11 : #include "Utilities/MakeArray.hpp" 12 : 13 : namespace domain { 14 : 15 : /// \brief The topology of a Block or Element in a particular dimension 16 : /// 17 : /// \details The Topology is used to determine the geometry of the Block or 18 : /// Element, which can be used to determine: 19 : /// - Whether there is an interface (with a neighbor or external boundary) in a 20 : /// given direction 21 : /// - The block (element) logical coordinate bounds 22 : /// - The appropriate Basis and Quadrature for a Mesh on an Element 23 : /// - Whether or not h-refinement is allowed in the given dimension 24 : /// - Whether or not the hybrid DG-Subcell scheme can be used 25 : /// 26 : /// \note Choose I1 to represent an open interval \f$[-1, 1]\f$ 27 : /// 28 : /// \note Choose S1 to represent a periodic interval \f$[0, 2 \pi)\f$ 29 : /// 30 : /// \note In consecutive dimensions, choose S2Colatitude and S2Longitude to 31 : /// represent the surface of a sphere 32 : /// 33 : /// \note In consecutive dimensions, choose B2Radial and B2Angular to represent 34 : /// a disk (including the center) or cross-section of a cylinder 35 : /// 36 : /// \note In consecutive dimensions, choose B3Radial, B3Colatitude and 37 : /// B3Longitude to represent a sphere 38 : /// 39 : /// \note Currently h-refinement can only be done in dimensions with 40 : /// Topology::I1 41 : /// 42 : /// \note Currently the hybrid DG-Subcell scheme can be used only in Elements 43 : /// whose topologies are all among I1, B1Radial, CartoonSphere, and 44 : /// CartoonCylinder. Elements with other topologies are automatically treated 45 : /// as DG-only. 46 0 : enum class Topology : uint8_t { 47 : Uninitialized = 0, 48 : I1 = 1, 49 : S1 = 2, 50 : S2Colatitude = 3, 51 : S2Longitude = 4, 52 : B1Radial = 5, 53 : B2Radial = 6, 54 : B2Angular = 7, 55 : B3Radial = 8, 56 : B3Colatitude = 9, 57 : B3Longitude = 10, 58 : CartoonSphere = 11, 59 : CartoonCylinder = 12 60 : }; 61 : 62 : /// Output operator for a Topology. 63 1 : std::ostream& operator<<(std::ostream& os, Topology topology); 64 : 65 0 : namespace topologies { 66 : template <size_t VolumeDim> 67 0 : static constexpr auto hypercube = make_array<VolumeDim>(Topology::I1); 68 : 69 : template <size_t VolumeDim> 70 0 : static constexpr auto hypertorus = make_array<VolumeDim>(Topology::S1); 71 : 72 0 : static constexpr auto annulus = std::array{Topology::I1, Topology::S1}; 73 : 74 0 : static constexpr auto spherical_surface = 75 : std::array{Topology::S2Colatitude, Topology::S2Longitude}; 76 : 77 0 : static constexpr auto disk = 78 : std::array{Topology::B2Radial, Topology::B2Angular}; 79 : 80 0 : static constexpr auto spherical_shell = 81 : std::array{Topology::I1, Topology::S2Colatitude, Topology::S2Longitude}; 82 : 83 0 : static constexpr auto cylindrical_shell = 84 : std::array{Topology::I1, Topology::S1, Topology::I1}; 85 : 86 0 : static constexpr auto full_cylinder = 87 : std::array{Topology::B2Radial, Topology::B2Angular, Topology::I1}; 88 : 89 0 : static constexpr auto full_sphere = std::array{ 90 : Topology::B3Radial, Topology::B3Colatitude, Topology::B3Longitude}; 91 : 92 0 : static constexpr auto cartoon_sphere = 93 : std::array{Topology::I1, Topology::CartoonSphere, Topology::CartoonSphere}; 94 : 95 0 : static constexpr auto cartoon_sphere_inner = std::array{ 96 : Topology::B1Radial, Topology::CartoonSphere, Topology::CartoonSphere}; 97 : 98 0 : static constexpr auto cartoon_cylinder = 99 : std::array{Topology::I1, Topology::I1, Topology::CartoonCylinder}; 100 : 101 0 : static constexpr auto cartoon_cylinder_inner = 102 : std::array{Topology::B1Radial, Topology::I1, Topology::CartoonCylinder}; 103 : } // namespace topologies 104 : 105 : } // namespace domain