Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cstddef> 7 : #include <iosfwd> 8 : 9 : #include "Domain/Structure/Direction.hpp" 10 : #include "Domain/Structure/ElementId.hpp" 11 : 12 : /// \cond 13 : namespace PUP { 14 : class er; 15 : } // namespace PUP 16 : /// \endcond 17 : 18 : /// \brief The ElementId of an Element in a given Direction. 19 : /// 20 : /// \details Used as the key in a DirectionalIdMap 21 : template <size_t VolumeDim> 22 1 : struct DirectionalId { 23 0 : Direction<VolumeDim> direction; 24 0 : ElementId<VolumeDim> id; 25 : 26 : /// Serialization for Charm++ 27 : // NOLINTNEXTLINE(google-runtime-references) 28 1 : void pup(PUP::er& p); 29 : }; 30 : 31 : template <size_t VolumeDim> 32 0 : size_t hash_value(const DirectionalId<VolumeDim>& id); 33 : 34 : namespace std { 35 : template <size_t VolumeDim> 36 : struct hash<DirectionalId<VolumeDim>> { 37 : size_t operator()(const DirectionalId<VolumeDim>& id) const; 38 : }; 39 : } // namespace std 40 : 41 : template <size_t VolumeDim> 42 0 : bool operator==(const DirectionalId<VolumeDim>& lhs, 43 : const DirectionalId<VolumeDim>& rhs); 44 : 45 : template <size_t VolumeDim> 46 0 : bool operator!=(const DirectionalId<VolumeDim>& lhs, 47 : const DirectionalId<VolumeDim>& rhs) { 48 : return not(lhs == rhs); 49 : } 50 : 51 : template <size_t VolumeDim> 52 0 : bool operator<(const DirectionalId<VolumeDim>& lhs, 53 : const DirectionalId<VolumeDim>& rhs); 54 : 55 : /// Output operator for a DirectionalId. 56 : template <size_t VolumeDim> 57 1 : std::ostream& operator<<(std::ostream& os, 58 : const DirectionalId<VolumeDim>& direction); 59 : 60 : template <size_t VolumeDim> 61 0 : DirectionalId(Direction<VolumeDim> direction, ElementId<VolumeDim> id) 62 : -> DirectionalId<VolumeDim>;