DomainCreator.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 DomainCreator.
6 
7 #pragma once
8 
9 #include <memory>
10 #include <string>
11 
14 #include "Utilities/MakeArray.hpp"
15 
16 /// \cond
17 template <size_t, typename>
18 class Block;
19 template <typename, typename, size_t>
20 class CoordinateMapBase;
21 template <size_t, typename>
22 class Domain;
23 /// \endcond
24 
25 namespace domain {
26 /// Defines classes that create Domains.
27 namespace creators {
28 /// \cond
29 template <size_t VolumeDim, typename TargetFrame>
30 class AlignedLattice;
31 template <typename TargetFrame>
32 class Brick;
33 template <typename TargetFrame>
34 class Cylinder;
35 template <typename TargetFrame>
36 class Disk;
37 template <typename TargetFrame>
38 class Interval;
39 template <typename TargetFrame>
40 class Rectangle;
41 template <typename TargetFrame>
42 class RotatedBricks;
43 template <typename TargetFrame>
44 class RotatedIntervals;
45 template <typename TargetFrame>
46 class RotatedRectangles;
47 template <typename TargetFrame>
48 class Shell;
49 template <typename TargetFrame>
50 class Sphere;
51 /// \endcond
52 } // namespace creators
53 } // namespace domain
54 
55 namespace DomainCreators_detail {
56 template <size_t>
57 struct domain_creators;
58 
59 template <>
60 struct domain_creators<1> {
61  template <typename Frame>
62  using creators = tmpl::list<domain::creators::AlignedLattice<1, Frame>,
65 };
66 template <>
67 struct domain_creators<2> {
68  template <typename Frame>
69  using creators = tmpl::list<domain::creators::AlignedLattice<2, Frame>,
73 };
74 template <>
75 struct domain_creators<3> {
76  template <typename Frame>
77  using creators = tmpl::list<
82 };
83 } // namespace DomainCreators_detail
84 
85 /// Base class for creating Domains from an option string.
86 template <size_t VolumeDim, typename TargetFrame>
88  public:
89  using creatable_classes = typename DomainCreators_detail::domain_creators<
90  VolumeDim>::template creators<TargetFrame>;
91 
92  DomainCreator() = default;
98  DomainCreator<VolumeDim, TargetFrame>&&) noexcept = default;
99  virtual ~DomainCreator() = default;
100 
101  virtual Domain<VolumeDim, TargetFrame> create_domain() const = 0;
102 
103  /// Obtain the initial grid extents of the block with the given index.
104  virtual std::vector<std::array<size_t, VolumeDim>> initial_extents() const
105  noexcept = 0;
106 
107  /// Obtain the initial refinement levels of the blocks.
108  virtual std::vector<std::array<size_t, VolumeDim>> initial_refinement_levels()
109  const noexcept = 0;
110 };
111 
112 #include "Domain/Creators/AlignedLattice.hpp"
113 #include "Domain/Creators/Brick.hpp"
114 #include "Domain/Creators/Cylinder.hpp"
115 #include "Domain/Creators/Disk.hpp"
118 #include "Domain/Creators/RotatedBricks.hpp"
120 #include "Domain/Creators/RotatedRectangles.hpp"
121 #include "Domain/Creators/Shell.hpp"
122 #include "Domain/Creators/Sphere.hpp"
Defines class RotatedIntervals.
Create a 3D Domain consisting of eight rotated Blocks.
Definition: RotatedBricks.hpp:76
Definition: BlockId.hpp:16
Defines class Rectangle.
Defines class Brick.
Defines function make_array.
Abstract base class for CoordinateMap.
Definition: CoordinateMap.hpp:49
Create a Domain consisting of multiple aligned Blocks arrayed in a lattice.
Definition: AlignedLattice.hpp:33
Base class for creating Domains from an option string.
Definition: DomainCreator.hpp:87
Creates a 3D Domain in the shape of a hollow spherical shell consisting of six wedges.
Definition: Shell.hpp:33
Create a 2D Domain in the shape of a disk from a square surrounded by four wedges.
Definition: Disk.hpp:26
Create a 3D Domain consisting of a single Block.
Definition: Brick.hpp:29
Define simple functions for constant expressions.
Create a 1D Domain consisting of a single Block.
Definition: Interval.hpp:29
A wrapper around a vector of Blocks that represent the computational domain.
Definition: Domain.hpp:36
Definition: DomainCreator.hpp:55
Create a 3D Domain in the shape of a cylinder where the cross-section is a square surrounded by four ...
Definition: Cylinder.hpp:28
Defines class Interval.
Create a 2D Domain consisting of four rotated Blocks.
Definition: RotatedRectangles.hpp:36
Create a 1D Domain consisting of two rotated Blocks. The left block has its logical -axis aligned wit...
Definition: RotatedIntervals.hpp:32
A Block<VolumeDim> is a region of a VolumeDim-dimensional computational domain that defines the root ...
Definition: Block.hpp:42
Create a 3D Domain in the shape of a sphere consisting of six wedges and a central cube...
Definition: Sphere.hpp:32
Create a 2D Domain consisting of a single Block.
Definition: Rectangle.hpp:29
Defines classes representing tensor indices.