Line data Source code
1 1 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : /// \file
5 : /// Defines enum class Side.
6 :
7 : #pragma once
8 :
9 : #include <cstdint>
10 : #include <iosfwd>
11 :
12 : namespace detail {
13 : constexpr uint8_t side_shift = 2;
14 : } // namespace detail
15 :
16 : /// \ingroup ComputationalDomainGroup
17 : /// A label for the side of a manifold.
18 : ///
19 : /// Lower and Upper are with respect to the logical coordinate whose axis is
20 : /// normal to the side, i.e. beyond the Upper (Lower) side, the logical
21 : /// coordinate is increasing (decreasing).
22 : ///
23 : /// `Self` is used to mark when an `ElementId` does not have a direction.
24 : ///
25 : /// Currently `Direction` assumes this enum uses no more than 2 bits.
26 0 : enum class Side : uint8_t {
27 : Uninitialized = 0 << detail::side_shift,
28 : Lower = 1 << detail::side_shift,
29 : Upper = 2 << detail::side_shift,
30 : Self = 3 << detail::side_shift
31 : };
32 :
33 : /// The opposite side (Side::Self is its own opposite)
34 1 : Side opposite(Side side);
35 :
36 : /// Output operator for a Side.
37 1 : std::ostream& operator<<(std::ostream& os, const Side& side);
|