7#include "debug_settings.h"
11#define _USE_MATH_DEFINES
43#include <unordered_map>
46#include <geo_normalize.h>
87using std::istringstream;
91using std::make_shared;
93using std::make_unique;
99using std::numeric_limits;
102using std::ostringstream;
105using std::runtime_error;
107using std::setprecision;
108using std::shared_ptr;
113using std::string_view;
114using std::stringstream;
116using std::to_wstring;
118using std::uniform_real_distribution;
119using std::unique_ptr;
120using std::unordered_map;
128using HashSize = uint32_t;
132using CellIndex = uint8_t;
137static constexpr CellIndex DIRECTION_NONE = 0b00000000;
138static constexpr CellIndex DIRECTION_W = 0b00000001;
139static constexpr CellIndex DIRECTION_E = 0b00000010;
140static constexpr CellIndex DIRECTION_S = 0b00000100;
141static constexpr CellIndex DIRECTION_N = 0b00001000;
142static constexpr CellIndex DIRECTION_SW = 0b00010000;
143static constexpr CellIndex DIRECTION_NE = 0b00100000;
144static constexpr CellIndex DIRECTION_NW = 0b01000000;
145static constexpr CellIndex DIRECTION_SE = 0b10000000;
153using FullIdx = int64_t;
158using PerimSize = uint8_t;
164using FuelSize = uint16_t;
166using DirectionSize = uint16_t;
167constexpr auto INVALID_DIRECTION = std::numeric_limits<DirectionSize>::max();
171using AspectSize = DirectionSize;
175using ElevationSize = int16_t;
179using SlopeSize = uint16_t;
183using IntensitySize = uint32_t;
188using DistanceSize = double;
195using InnerSize = double;
199using XYSize = double;
205using ThresholdSize = double;
209using DurationSize = double;
210constexpr DurationSize INVALID_TIME = -1;
211constexpr auto NO_INTENSITY =
static_cast<IntensitySize
>(0);
212using ROSSize = MathSize;
213constexpr auto NO_ROS =
static_cast<ROSSize
>(0.0);
218static constexpr Day MAX_DAYS = 366;
222static constexpr Idx MAX_COLUMNS = 4096;
226static constexpr Idx MAX_ROWS = MAX_COLUMNS;
228static constexpr Idx PREFERRED_TILE_WIDTH = 256;
229static constexpr Idx TILE_WIDTH = min(MAX_COLUMNS,
static_cast<Idx
>(PREFERRED_TILE_WIDTH));
233static constexpr auto MAX_ASPECT = 359;
237static constexpr auto MAX_SLOPE_FOR_DISTANCE = 500;
241static constexpr auto INVALID_ANGLE = 361;
245static constexpr auto INVALID_ASPECT = INVALID_ANGLE;
249static constexpr MathSize INVALID_CURING = -1;
253static constexpr auto INVALID_SLOPE = 511;
257static constexpr auto NUMBER_OF_FUELS = 141;
261static constexpr auto M_2_X_PI = 2.0 * M_PI;
265static constexpr auto M_3_X_PI_2 = 3.0 * M_PI_2;
269static constexpr auto M_RADIANS_TO_DEGREES = 180.0 / M_PI;
273static constexpr int DAY_HOURS = 24;
277static constexpr int HOUR_MINUTES = 60;
281static constexpr int MINUTE_SECONDS = 60;
285static constexpr int HOUR_SECONDS = HOUR_MINUTES * MINUTE_SECONDS;
289static constexpr int DAY_MINUTES = DAY_HOURS * HOUR_MINUTES;
293static constexpr int DAY_SECONDS = DAY_MINUTES * MINUTE_SECONDS;
297static constexpr int YEAR_HOURS = MAX_DAYS * DAY_HOURS;
301using SlopeTableArray = array<double, MAX_SLOPE_FOR_DISTANCE + 1>;
305using DegreesSize = uint16_t;
309using AngleTableArray = array<double, 361>;
313using FuelCodeSize = uint8_t;
317using Topo = uint64_t;
321using SubSize = uint16_t;
325using Coordinates = tuple<Idx, Idx, SubSize, SubSize>;
329using FullCoordinates = tuple<FullIdx, FullIdx, SubSize, SubSize>;
333using Clock = std::chrono::steady_clock;