7#if __cplusplus >= 202211L
10#if __cpp_constexpr >= 202211L
11#define CONSTEXPR constexpr
15#include "debug_settings.h"
19#define _USE_MATH_DEFINES
51#include <unordered_map>
54#include <geo_normalize.h>
95using std::istringstream;
99using std::make_shared;
100using std::make_tuple;
101using std::make_unique;
107using std::numeric_limits;
110using std::ostringstream;
113using std::runtime_error;
115using std::setprecision;
116using std::shared_ptr;
121using std::string_view;
122using std::stringstream;
124using std::to_wstring;
126using std::uniform_real_distribution;
127using std::unique_ptr;
128using std::unordered_map;
136using HashSize = uint32_t;
140using CellIndex = uint8_t;
145static constexpr CellIndex DIRECTION_NONE = 0b00000000;
146static constexpr CellIndex DIRECTION_W = 0b00000001;
147static constexpr CellIndex DIRECTION_E = 0b00000010;
148static constexpr CellIndex DIRECTION_S = 0b00000100;
149static constexpr CellIndex DIRECTION_N = 0b00001000;
150static constexpr CellIndex DIRECTION_SW = 0b00010000;
151static constexpr CellIndex DIRECTION_NE = 0b00100000;
152static constexpr CellIndex DIRECTION_NW = 0b01000000;
153static constexpr CellIndex DIRECTION_SE = 0b10000000;
161using FullIdx = int64_t;
166using PerimSize = uint8_t;
172using FuelSize = uint16_t;
174using DirectionSize = uint16_t;
175constexpr auto INVALID_DIRECTION = std::numeric_limits<DirectionSize>::max();
179using AspectSize = DirectionSize;
183using ElevationSize = int16_t;
187using SlopeSize = uint16_t;
191using IntensitySize = uint32_t;
196using DistanceSize = double;
203using InnerSize = double;
207using XYSize = double;
213using ThresholdSize = double;
217using DurationSize = double;
218constexpr DurationSize INVALID_TIME = -1;
219constexpr auto NO_INTENSITY =
static_cast<IntensitySize
>(0);
220using ROSSize = MathSize;
221constexpr auto NO_ROS =
static_cast<ROSSize
>(0.0);
226static constexpr Day MAX_DAYS = 366;
230static constexpr Idx MAX_COLUMNS = 4096;
234static constexpr Idx MAX_ROWS = MAX_COLUMNS;
236static constexpr Idx PREFERRED_TILE_WIDTH = 256;
237static constexpr Idx TILE_WIDTH = min(MAX_COLUMNS,
static_cast<Idx
>(PREFERRED_TILE_WIDTH));
241static constexpr auto MAX_ASPECT = 359;
245static constexpr auto MAX_SLOPE_FOR_DISTANCE = 500;
249static constexpr auto INVALID_ANGLE = 361;
253static constexpr auto INVALID_ASPECT = INVALID_ANGLE;
257static constexpr MathSize INVALID_CURING = -1;
261static constexpr auto INVALID_SLOPE = 511;
265static constexpr auto NUMBER_OF_FUELS = 141;
269static constexpr auto M_2_X_PI = 2.0 * M_PI;
273static constexpr auto M_3_X_PI_2 = 3.0 * M_PI_2;
277static constexpr auto M_RADIANS_TO_DEGREES = 180.0 / M_PI;
281static constexpr int DAY_HOURS = 24;
285static constexpr int HOUR_MINUTES = 60;
289static constexpr int MINUTE_SECONDS = 60;
293static constexpr int HOUR_SECONDS = HOUR_MINUTES * MINUTE_SECONDS;
297static constexpr int DAY_MINUTES = DAY_HOURS * HOUR_MINUTES;
301static constexpr int DAY_SECONDS = DAY_MINUTES * MINUTE_SECONDS;
305static constexpr int YEAR_HOURS = MAX_DAYS * DAY_HOURS;
309using SlopeTableArray = array<double, MAX_SLOPE_FOR_DISTANCE + 1>;
313using DegreesSize = uint16_t;
317using AngleTableArray = array<double, 361>;
321using FuelCodeSize = uint8_t;
325using Topo = uint64_t;
329using SubSize = uint16_t;
333using Coordinates = tuple<Idx, Idx, SubSize, SubSize>;
337using FullCoordinates = tuple<FullIdx, FullIdx, SubSize, SubSize>;
341using Clock = std::chrono::steady_clock;