Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
block_key.hpp
Go to the documentation of this file.
1
7#pragma once
8
9#include <array>
10#include <compare>
11#include <cstddef>
12
13namespace uni20
14{
15
20template <std::size_t CoordinateCount> class BlockKey {
21 public:
23 constexpr BlockKey() = default;
24
28 constexpr explicit BlockKey(std::array<std::size_t, CoordinateCount> coordinates) : coordinates_(coordinates) {}
29
31 static constexpr auto size() noexcept -> std::size_t { return CoordinateCount; }
32
36 constexpr auto coordinate(std::size_t axis) const -> std::size_t { return coordinates_[axis]; }
37
39 auto operator<=>(BlockKey const&) const = default;
40
41 private:
42 std::array<std::size_t, CoordinateCount> coordinates_{};
43};
44
45} // namespace uni20
Opaque logical block-selection coordinates in boundary order.
Definition block_key.hpp:20
constexpr auto coordinate(std::size_t axis) const -> std::size_t
Return one factor coordinate.
Definition block_key.hpp:36
constexpr BlockKey()=default
Construct the all-zero coordinate.
auto operator<=>(BlockKey const &) const =default
Compare block coordinates lexicographically.
static constexpr auto size() noexcept -> std::size_t
Return the compile-time number of stored coordinates.
Definition block_key.hpp:31
constexpr BlockKey(std::array< std::size_t, CoordinateCount > coordinates)
Construct from one coordinate per selectable boundary factor.
Definition block_key.hpp:28
Definition qnum.hpp:403
Definition async/async.hpp:26