Domain.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 template Domain.
6 
7 #pragma once
8 
9 #include <array>
10 #include <cstddef>
11 #include <iosfwd>
12 #include <memory>
13 #include <vector>
14 
15 #include "Domain/Block.hpp" // IWYU pragma: keep
16 #include "Domain/DomainHelpers.hpp"
18 
19 namespace Frame {
20 struct Logical;
21 } // namespace Frame
22 namespace PUP {
23 class er;
24 } // namespace PUP
25 /// \cond
26 template <typename SourceFrame, typename TargetFrame, size_t Dim>
27 class CoordinateMapBase;
28 /// \endcond
29 
30 /*!
31  * \ingroup ComputationalDomainGroup
32  * \brief A wrapper around a vector of Blocks that represent the computational
33  * domain.
34  */
35 template <size_t VolumeDim, typename TargetFrame>
36 class Domain {
37  public:
38  explicit Domain(std::vector<Block<VolumeDim, TargetFrame>> blocks) noexcept;
39 
40  /*!
41  * Create a Domain using a corner numbering scheme to encode the Orientations,
42  * with an optional parameter that encodes periodic boundary conditions.
43  *
44  * \details Each element of `corners_of_all_blocks` contains the corner
45  * numbering of that block's corners according to the global corner number
46  * scheme. The details of the corner numbering scheme are described in the
47  * [tutorial](@ref tutorial_orientations). `identifications` is for imposing
48  * periodic boundary conditions on the domain. To identify faces,
49  * `identifications` should contain the PairOfFaces containing the corners of
50  * each pair of faces that you wish to identify with one another. For more
51  * information on setting up domains, see the
52  * [domain creation tutorial](@ref tutorial_domain_creation).
53  *
54  * \requires `maps.size() == corners_of_all_blocks.size()`, and
55  * `identifications.size()` is even.
56  */
59  maps,
60  const std::vector<std::array<size_t, two_to_the(VolumeDim)>>&
61  corners_of_all_blocks,
62  const std::vector<PairOfFaces>& identifications = {}) noexcept;
63 
64  Domain() noexcept = default;
65  ~Domain() = default;
66  Domain(const Domain&) = delete;
67  Domain(Domain&&) = default;
69  const Domain<VolumeDim, TargetFrame>&) = delete;
71  default;
72 
73  const std::vector<Block<VolumeDim, TargetFrame>>& blocks() const noexcept {
74  return blocks_;
75  }
76 
77  //clang-tidy: google-runtime-references
78  void pup(PUP::er& p) noexcept; // NOLINT
79 
80  private:
82 };
83 
84 template <size_t VolumeDim, typename TargetFrame>
85 bool operator==(const Domain<VolumeDim, TargetFrame>& lhs,
86  const Domain<VolumeDim, TargetFrame>& rhs) noexcept;
87 
88 template <size_t VolumeDim, typename TargetFrame>
89 bool operator!=(const Domain<VolumeDim, TargetFrame>& lhs,
90  const Domain<VolumeDim, TargetFrame>& rhs) noexcept;
91 
92 template <size_t VolumeDim, typename TargetFrame>
93 std::ostream& operator<<(std::ostream& os,
94  const Domain<VolumeDim, TargetFrame>& d) noexcept;
Defines DomainHelper functions.
Definition: Strahlkorper.hpp:14
Abstract base class for CoordinateMap.
Definition: CoordinateMap.hpp:49
Indicates the Frame that a TensorIndexType is in.
Definition: IndexType.hpp:36
constexpr T two_to_the(T n)
Compute 2 to the n for integral types.
Definition: ConstantExpressions.hpp:34
Define simple functions for constant expressions.
A wrapper around a vector of Blocks that represent the computational domain.
Definition: Domain.hpp:36
Defines class template Block.
A Block<VolumeDim> is a region of a VolumeDim-dimensional computational domain that defines the root ...
Definition: Block.hpp:42