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 namespace domain {
27 template <typename SourceFrame, typename TargetFrame, size_t Dim>
28 class CoordinateMapBase;
29 } // namespace domain
30 /// \endcond
31 
32 /*!
33  * \ingroup ComputationalDomainGroup
34  * \brief A wrapper around a vector of Blocks that represent the computational
35  * domain.
36  */
37 template <size_t VolumeDim, typename TargetFrame>
38 class Domain {
39  public:
40  explicit Domain(std::vector<Block<VolumeDim, TargetFrame>> blocks) noexcept;
41 
42  /*!
43  * Create a Domain using a corner numbering scheme to encode the Orientations,
44  * with an optional parameter that encodes periodic boundary conditions.
45  *
46  * \details Each element of `corners_of_all_blocks` contains the corner
47  * numbering of that block's corners according to the global corner number
48  * scheme. The details of the corner numbering scheme are described in the
49  * [tutorial](@ref tutorial_orientations). `identifications` is for imposing
50  * periodic boundary conditions on the domain. To identify faces,
51  * `identifications` should contain the PairOfFaces containing the corners of
52  * each pair of faces that you wish to identify with one another. For more
53  * information on setting up domains, see the
54  * [domain creation tutorial](@ref tutorial_domain_creation).
55  *
56  * \requires `maps.size() == corners_of_all_blocks.size()`, and
57  * `identifications.size()` is even.
58  */
61  maps,
62  const std::vector<std::array<size_t, two_to_the(VolumeDim)>>&
63  corners_of_all_blocks,
64  const std::vector<PairOfFaces>& identifications = {}) noexcept;
65 
66  Domain() noexcept = default;
67  ~Domain() = default;
68  Domain(const Domain&) = delete;
69  Domain(Domain&&) = default;
71  const Domain<VolumeDim, TargetFrame>&) = delete;
73  default;
74 
75  const std::vector<Block<VolumeDim, TargetFrame>>& blocks() const noexcept {
76  return blocks_;
77  }
78 
79  //clang-tidy: google-runtime-references
80  void pup(PUP::er& p) noexcept; // NOLINT
81 
82  private:
84 };
85 
86 template <size_t VolumeDim, typename TargetFrame>
87 bool operator==(const Domain<VolumeDim, TargetFrame>& lhs,
88  const Domain<VolumeDim, TargetFrame>& rhs) noexcept;
89 
90 template <size_t VolumeDim, typename TargetFrame>
91 bool operator!=(const Domain<VolumeDim, TargetFrame>& lhs,
92  const Domain<VolumeDim, TargetFrame>& rhs) noexcept;
93 
94 template <size_t VolumeDim, typename TargetFrame>
95 std::ostream& operator<<(std::ostream& os,
96  const Domain<VolumeDim, TargetFrame>& d) noexcept;
Defines DomainHelper functions.
Definition: Strahlkorper.hpp:14
Definition: BlockId.hpp:16
Abstract base class for CoordinateMap.
Definition: CoordinateMap.hpp:50
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:38
Defines class template Block.
A Block<VolumeDim> is a region of a VolumeDim-dimensional computational domain that defines the root ...
Definition: Block.hpp:42