FrustalCloak.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// Defines class FrustalCloak.
6 
7 #pragma once
8 
9 #include <array>
10 #include <cstddef>
11 #include <vector>
12 
13 #include "Domain/Domain.hpp"
14 #include "Options/Options.hpp"
15 #include "Utilities/TMPL.hpp"
16 
17 /// \cond
18 template <size_t Dim, typename Frame>
19 class DomainCreator; // IWYU pragma: keep
20 /// \endcond
21 
22 namespace domain {
23 namespace creators {
24 
25 /// \ingroup DomainCreatorsGroup
26 /// Create a 3D cubical domain with two equal-sized abutting excised cubes in
27 /// the center. This is done by combining ten frusta.
28 template <typename TargetFrame>
29 class FrustalCloak : public DomainCreator<3, TargetFrame> {
30  public:
32  using type = size_t;
33  static constexpr OptionString help = {
34  "Initial refinement level in each dimension."};
35  };
36 
39  static constexpr OptionString help = {
40  "Initial number of grid points in [r,angular]."};
41  };
42 
44  using type = bool;
45  static constexpr OptionString help = {
46  "Use equiangular instead of equidistant coordinates."};
47  static constexpr type default_value() noexcept { return false; }
48  };
49 
51  using type = double;
52  static constexpr OptionString help = {"Grid compression factor."};
53  static constexpr type default_value() noexcept { return 1.0; }
54  };
55 
56  struct LengthInnerCube {
57  using type = double;
58  static constexpr OptionString help = {"Side length of each inner cube."};
59  static constexpr type default_value() noexcept { return 0.0; }
60  };
61 
62  struct LengthOuterCube {
63  using type = double;
64  static constexpr OptionString help = {"Side length of the outer cube."};
65  static constexpr type default_value() noexcept { return 0.0; }
66  };
67 
68  struct OriginPreimage {
70  static constexpr OptionString help = {"The origin preimage in [x,y,z]."};
71  };
72 
73  using options = tmpl::list<InitialRefinement, InitialGridPoints,
76 
77  static constexpr OptionString help{
78  "Creates a cubical domain with two equal-sized abutting excised cubes\n"
79  "in the center. This is done by combining ten frusta. The parameter\n"
80  "`UseEquiangularMap` can be used to apply a tangent mapping to the xi\n"
81  "and eta logical coordinates of each frustum, while the parameter\n"
82  "`ProjectionFactor` can be used to apply a projective map to the zeta\n"
83  "logical coordinate of each frustum. Increasing the\n"
84  "`ProjectionFactor` value can give better gridpoint spacings in the\n"
85  "z direction. The user also specifies values for `LengthInnerCube` and\n"
86  "`LengthOuterCube`. This will create a cubical Domain of side"
87  "length `LengthOuterCube` with the center excised. The size of the\n"
88  "excised region is determined by the value set for `LengthInnerCube`.\n"
89  "`OriginPreimage` moves the blocks such that the origin preimage is\n"
90  "mapped to the origin. Note that the abutting excised cubes share a\n"
91  "face in the x-direction. This Domain is primarily for testing the\n"
92  "frustal cloak in the BinaryCompactObject Domain."};
93 
94  FrustalCloak(typename InitialRefinement::type initial_refinement_level,
95  typename InitialGridPoints::type initial_number_of_grid_points,
96  typename UseEquiangularMap::type use_equiangular_map = false,
97  typename ProjectionFactor::type projection_factor = 1.0,
98  typename LengthInnerCube::type length_inner_cube = 0.0,
99  typename LengthOuterCube::type length_outer_cube = 0.0,
100  typename OriginPreimage::type origin_preimage = {{0.0, 0.0,
101  0.0}},
102  const OptionContext& context = {}) noexcept;
103 
104  FrustalCloak() = default;
105  FrustalCloak(const FrustalCloak&) = delete;
106  FrustalCloak(FrustalCloak&&) noexcept = default;
107  FrustalCloak& operator=(const FrustalCloak&) = delete;
108  FrustalCloak& operator=(FrustalCloak&&) noexcept = default;
109  ~FrustalCloak() noexcept override = default;
110 
111  Domain<3, TargetFrame> create_domain() const noexcept override;
112 
113  std::vector<std::array<size_t, 3>> initial_extents() const noexcept override;
114 
116  noexcept override;
117 
118  private:
119  typename InitialRefinement::type initial_refinement_level_{};
120  typename InitialGridPoints::type initial_number_of_grid_points_{};
121  typename UseEquiangularMap::type use_equiangular_map_ = false;
122  typename ProjectionFactor::type projection_factor_{};
123  typename LengthInnerCube::type length_inner_cube_{0.0};
124  typename LengthOuterCube::type length_outer_cube_{0.0};
125  typename OriginPreimage::type origin_preimage_{{0.0, 0.0, 0.0}};
126 };
127 } // namespace creators
128 } // namespace domain
Definition: BlockId.hpp:16
Defines classes and functions for making classes creatable from input files.
std::vector< std::array< size_t, 3 > > initial_refinement_levels() const noexcept override
Obtain the initial refinement levels of the blocks.
Definition: FrustalCloak.cpp:79
std::vector< std::array< size_t, 3 > > initial_extents() const noexcept override
Obtain the initial grid extents of the block with the given index.
Definition: FrustalCloak.cpp:69
Base class for creating Domains from an option string.
Definition: DomainCreator.hpp:91
Create a 3D cubical domain with two equal-sized abutting excised cubes in the center. This is done by combining ten frusta.
Definition: FrustalCloak.hpp:29
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:27
Defines class template Domain.
Definition: FrustalCloak.hpp:68
A wrapper around a vector of Blocks that represent the computational domain.
Definition: Domain.hpp:38
Information about the nested operations being performed by the parser, for use in printing errors...
Definition: Options.hpp:36
Wraps the template metaprogramming library used (brigand)