BlockNeighbor.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 BlockNeighbor.
6 
7 #pragma once
8 
9 #include <cstddef>
10 #include <iosfwd>
11 
12 #include "Domain/OrientationMap.hpp"
13 
14 /// \cond
15 namespace PUP {
16 class er;
17 } // namespace PUP
18 /// \endcond
19 
20 /// \ingroup ComputationalDomainGroup
21 /// Information about the neighbor of a Block in a particular direction.
22 ///
23 /// \tparam VolumeDim the volume dimension.
24 template <size_t VolumeDim>
26  public:
27  BlockNeighbor() = default;
28 
29  /// Construct with the Id and orientation of the neighbor.
30  ///
31  /// \param id the Id of the neighbor.
32  /// \param orientation the OrientationMap of the neighbor.
33  BlockNeighbor(size_t id, OrientationMap<VolumeDim> orientation) noexcept;
34  ~BlockNeighbor() = default;
35  BlockNeighbor(const BlockNeighbor<VolumeDim>& neighbor) = default;
36  BlockNeighbor(BlockNeighbor<VolumeDim>&&) noexcept = default;
37  BlockNeighbor<VolumeDim>& operator=(const BlockNeighbor<VolumeDim>& rhs) =
38  default;
39  BlockNeighbor<VolumeDim>& operator=(BlockNeighbor<VolumeDim>&&) noexcept =
40  default;
41 
42  size_t id() const noexcept { return id_; }
43 
44  const OrientationMap<VolumeDim>& orientation() const noexcept {
45  return orientation_;
46  }
47 
48  // Serialization for Charm++
49  void pup(PUP::er& p) noexcept; // NOLINT
50 
51  private:
52  size_t id_{0};
53  OrientationMap<VolumeDim> orientation_;
54 };
55 
56 /// Output operator for BlockNeighbor.
57 template <size_t VolumeDim>
59  std::ostream& os, const BlockNeighbor<VolumeDim>& block_neighbor) noexcept;
60 
61 template <size_t VolumeDim>
62 bool operator==(const BlockNeighbor<VolumeDim>& lhs,
63  const BlockNeighbor<VolumeDim>& rhs) noexcept;
64 
65 template <size_t VolumeDim>
66 bool operator!=(const BlockNeighbor<VolumeDim>& lhs,
67  const BlockNeighbor<VolumeDim>& rhs) noexcept;
Definition: Strahlkorper.hpp:14
Information about the neighbor of a Block in a particular direction.
Definition: BlockNeighbor.hpp:25
std::ostream & operator<<(std::ostream &os, const BlockNeighbor< VolumeDim > &block_neighbor) noexcept
Output operator for BlockNeighbor.
Definition: BlockNeighbor.cpp:22