Line data Source code
1 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/Structure/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 host Block in a particular direction. 22 : /// 23 : /// \tparam VolumeDim the volume dimension. 24 : template <size_t VolumeDim> 25 1 : class BlockNeighbor { 26 : public: 27 0 : BlockNeighbor() = default; 28 : 29 : /// Construct with the Id and orientation of the neighbor relative to the 30 : /// host. 31 : /// 32 : /// \param id the Id of the neighbor. 33 : /// \param orientation This OrientationMap takes objects in the logical 34 : /// coordinate frame of the host Block and maps them to the logical 35 : /// coordinate frame of the neighbor Block. 36 1 : BlockNeighbor(size_t id, OrientationMap<VolumeDim> orientation); 37 0 : ~BlockNeighbor() = default; 38 0 : BlockNeighbor(const BlockNeighbor<VolumeDim>& neighbor) = default; 39 0 : BlockNeighbor(BlockNeighbor<VolumeDim>&&) = default; 40 0 : BlockNeighbor<VolumeDim>& operator=(const BlockNeighbor<VolumeDim>& rhs) = 41 : default; 42 0 : BlockNeighbor<VolumeDim>& operator=(BlockNeighbor<VolumeDim>&&) = default; 43 : 44 0 : size_t id() const { return id_; } 45 : 46 0 : const OrientationMap<VolumeDim>& orientation() const { return orientation_; } 47 : 48 : // Serialization for Charm++ 49 : // NOLINTNEXTLINE(google-runtime-references) 50 0 : void pup(PUP::er& p); 51 : 52 : private: 53 0 : size_t id_{0}; 54 0 : OrientationMap<VolumeDim> orientation_; 55 : }; 56 : 57 : /// Output operator for BlockNeighbor. 58 : template <size_t VolumeDim> 59 1 : std::ostream& operator<<(std::ostream& os, 60 : const BlockNeighbor<VolumeDim>& block_neighbor); 61 : 62 : template <size_t VolumeDim> 63 0 : bool operator==(const BlockNeighbor<VolumeDim>& lhs, 64 : const BlockNeighbor<VolumeDim>& rhs); 65 : 66 : template <size_t VolumeDim> 67 0 : bool operator!=(const BlockNeighbor<VolumeDim>& lhs, 68 : const BlockNeighbor<VolumeDim>& rhs);