13using SpreadKey = uint32_t;
14using fuel::INVALID_FUEL_CODE;
28 numeric_limits<SlopeSize>::min(),
29 numeric_limits<AspectSize>::min(),
30 numeric_limits<FuelCodeSize>::min())
50 const FuelCodeSize& fuel)
noexcept
54 const auto do_hash_cell = [](
const SlopeSize s,
const AspectSize a,
const FuelCodeSize f) {
60 INVALID_SLOPE ==
slope
61 || INVALID_ASPECT ==
aspect
62 || INVALID_FUEL_CODE == fuel)
64 return do_hash_cell(INVALID_SLOPE, INVALID_ASPECT, INVALID_FUEL_CODE);
73 explicit constexpr Cell(
const Topo hash) noexcept
84 constexpr Cell(
const HashSize hash,
85 const SlopeSize
slope,
87 const FuelCodeSize& fuel) noexcept
103 const SlopeSize
slope,
105 const FuelCodeSize& fuel) noexcept
116 [[nodiscard]]
static constexpr SpreadKey
key(
const Topo value)
noexcept
119 return static_cast<SpreadKey
>(value >>
FuelShift);
126 [[nodiscard]]
static constexpr AspectSize
aspect(
const SpreadKey value)
noexcept
136 [[nodiscard]]
static constexpr FuelCodeSize
fuelCode(
const SpreadKey value)
noexcept
145 [[nodiscard]]
static constexpr SlopeSize
slope(
const SpreadKey value)
noexcept
154 [[nodiscard]]
static constexpr AspectSize
aspect(
const Topo value)
noexcept
164 [[nodiscard]]
static constexpr FuelCodeSize
fuelCode(
const Topo value)
noexcept
173 [[nodiscard]]
static constexpr SlopeSize
slope(
const Topo value)
noexcept
182 [[nodiscard]]
static constexpr Topo
topoHash(
const Topo value)
noexcept
184 return static_cast<Topo
>(value) &
CellMask;
190 [[nodiscard]]
constexpr SpreadKey
key() const noexcept
198 [[nodiscard]]
constexpr AspectSize
aspect() const noexcept
206 [[nodiscard]]
constexpr FuelCodeSize
fuelCode() const noexcept
214 [[nodiscard]]
constexpr SlopeSize
slope() const noexcept
222 [[nodiscard]]
constexpr Topo
topoHash() const noexcept
264 static constexpr uint32_t
FuelBits = std::bit_width<uint32_t>(NUMBER_OF_FUELS);
268 static constexpr Topo
FuelBitMask = util::bit_mask<FuelBits, Topo>();
282 static constexpr uint32_t
AspectBits = std::bit_width<uint32_t>(MAX_ASPECT);
300 static constexpr uint32_t
SlopeBits = std::bit_width<uint32_t>(MAX_SLOPE_FOR_DISTANCE);
305 static constexpr Topo
SlopeBitMask = util::bit_mask<SlopeBits, Topo>();
316 static_assert(
static_cast<size_t>(std::bit_width(std::numeric_limits<Topo>::max())) >=
SlopeBits +
SlopeShift);
324constexpr bool operator<(
const Cell& lhs,
const Cell& rhs)
335struct hash<fs::topo::Cell>
A Position with a Slope, Aspect, and Fuel.
Definition Cell.h:20
static constexpr Topo CellMask
Bitmask for Cell information in Topo.
Definition Cell.h:315
static constexpr AspectSize aspect(const Topo value) noexcept
Aspect (degrees)
Definition Cell.h:154
static constexpr uint32_t SlopeShift
Shift for slope bitmask.
Definition Cell.h:296
constexpr Cell(const HashSize hash, const SlopeSize slope, const AspectSize aspect, const FuelCodeSize &fuel) noexcept
Construct based on given attributes.
Definition Cell.h:84
constexpr Cell(const Topo hash) noexcept
Construct from hash value.
Definition Cell.h:73
constexpr AspectSize aspect() const noexcept
Aspect (degrees)
Definition Cell.h:198
static constexpr AspectSize aspect(const SpreadKey value) noexcept
Aspect (degrees)
Definition Cell.h:126
static constexpr Topo SlopeMask
Bitmask for slope in Topo.
Definition Cell.h:311
static constexpr Topo hashCell(const SlopeSize slope, const AspectSize aspect, const FuelCodeSize &fuel) noexcept
Hash attributes into a Topo value.
Definition Cell.h:48
static constexpr Topo SlopeBitMask
Bitmask for slope in Topo before shift.
Definition Cell.h:305
static constexpr SpreadKey key(const Topo value) noexcept
A key defining Slope, Aspect, and Fuel, used for determining Cells that spread the same.
Definition Cell.h:116
static constexpr uint32_t SlopeBits
Number of bits in slope bitmask.
Definition Cell.h:300
constexpr SpreadKey key() const noexcept
A key defining Slope, Aspect, and Fuel, used for determining Cells that spread the same.
Definition Cell.h:190
constexpr SlopeSize slope() const noexcept
Slope (degrees)
Definition Cell.h:214
static constexpr uint32_t FuelBits
Number of bits in fuel bitmask.
Definition Cell.h:264
static constexpr Topo topoHash(const Topo value) noexcept
Topo that contains Cell data.
Definition Cell.h:182
static constexpr Topo AspectBitMask
Bitmask for aspect in Topo before shift.
Definition Cell.h:286
constexpr Topo topoHash() const noexcept
Topo that contains Cell data.
Definition Cell.h:222
static constexpr uint32_t AspectBits
Number of bits in aspect bitmask.
Definition Cell.h:282
static constexpr SlopeSize slope(const Topo value) noexcept
Slope (degrees)
Definition Cell.h:173
constexpr Cell(const Idx row, const Idx column, const SlopeSize slope, const AspectSize aspect, const FuelCodeSize &fuel) noexcept
Constructor.
Definition Cell.h:101
static constexpr FuelCodeSize fuelCode(const Topo value) noexcept
Fuel.
Definition Cell.h:164
static constexpr FuelCodeSize fuelCode(const SpreadKey value) noexcept
Fuel.
Definition Cell.h:136
static constexpr Topo FuelMask
Bitmask for fuel information in Topo.
Definition Cell.h:274
constexpr FuelCodeSize fuelCode() const noexcept
Fuel.
Definition Cell.h:206
static constexpr Topo AspectMask
Bitmask for aspect in Topo.
Definition Cell.h:292
static constexpr Topo FuelBitMask
Bitmask for fuel information in Topo before shift.
Definition Cell.h:268
static constexpr uint32_t AspectShift
Shift for aspect bitmask.
Definition Cell.h:278
static constexpr SlopeSize slope(const SpreadKey value) noexcept
Slope (degrees)
Definition Cell.h:145
constexpr Topo fullHash() const
Full stored hash that may contain data from subclasses.
Definition Cell.h:37
static constexpr uint32_t FuelShift
Shift for fuel bitmask.
Definition Cell.h:258
constexpr Cell() noexcept
Default constructor.
Definition Cell.h:25
A Position with a row and column.
Definition Location.h:57
static constexpr Topo HashMask
Definition Location.h:133
Topo topo_data_
Definition Location.h:115
constexpr Idx column() const noexcept
Definition Location.h:72
static constexpr HashSize doHash(const Idx row, const Idx column) noexcept
Definition Location.h:150
std::size_t operator()(const fs::topo::Cell &k) const noexcept
Provides hash for Cell objects.
Definition Cell.h:342