FireSTARR
Loading...
Searching...
No Matches
Event.h
1/* Copyright (c) Queen's Printer for Ontario, 2020. */
2/* Copyright (c) His Majesty the King in Right of Canada as represented by the Minister of Natural Resources, 2025. */
3
4/* SPDX-License-Identifier: AGPL-3.0-or-later */
5
6#pragma once
7#include "stdafx.h"
8#include "Cell.h"
9#include "FireSpread.h"
10
11namespace fs::sim
12{
13using topo::Cell;
18class Event
19{
20public:
24 static constexpr Cell NoLocation{};
25 // HACK: use type, so we can sort without having to give different times to them
29 enum Type
30 {
31 SAVE,
32 END_SIMULATION,
33 NEW_FIRE,
34 FIRE_SPREAD,
35 };
36 [[nodiscard]] static Event makeEvent(
37 const DurationSize time,
38 const Cell& cell,
39 const Type type)
40 {
41 return {
42 time,
43 cell,
44 0,
45 type,
46 0,
47 0,
48 Direction::Invalid,
49 0};
50 }
56 [[nodiscard]] static Event makeEnd(const DurationSize time)
57 {
58 return makeEvent(
59 time,
61 END_SIMULATION);
62 }
69 [[nodiscard]] static Event makeNewFire(
70 const DurationSize time,
71 const Cell& cell)
72 {
73 return makeEvent(
74 time,
75 cell,
76 NEW_FIRE);
77 }
83 [[nodiscard]] static Event makeSave(const DurationSize time)
84 {
85 return makeEvent(
86 time,
88 SAVE);
89 }
95 [[nodiscard]] static Event makeFireSpread(const DurationSize time)
96 {
97 return makeEvent(
98 time,
100 FIRE_SPREAD);
101 }
108 [[nodiscard]] static Event makeFireSpread(
109 const DurationSize time,
110 const IntensitySize intensity,
111 const ROSSize ros,
112 const Direction raz)
113 {
114 return makeFireSpread(time, intensity, ros, raz, NoLocation);
115 }
123 [[nodiscard]] static Event makeFireSpread(
124 const DurationSize time,
125 const IntensitySize intensity,
126 const ROSSize ros,
127 const Direction raz,
128 const Cell& cell)
129 {
130 return makeFireSpread(time, intensity, ros, raz, cell, 254);
131 }
139 [[nodiscard]] static Event makeFireSpread(
140 const DurationSize time,
141 const IntensitySize intensity,
142 const ROSSize ros,
143 const Direction raz,
144 const Cell& cell,
145 const CellIndex source)
146 {
147 return {time, cell, source, FIRE_SPREAD, intensity, ros, raz, 0};
148 }
149 ~Event() = default;
154 Event(Event&& rhs) noexcept = default;
159 Event(const Event& rhs) = delete;
165 Event& operator=(Event&& rhs) noexcept = default;
171 Event& operator=(const Event& rhs) = delete;
176 [[nodiscard]] constexpr DurationSize time() const
177 {
178 return time_;
179 }
184 [[nodiscard]] constexpr Type type() const
185 {
186 return type_;
187 }
192 [[nodiscard]] constexpr DurationSize timeAtLocation() const
193 {
194 return time_at_location_;
195 }
200 [[nodiscard]] constexpr IntensitySize intensity() const
201 {
202 return intensity_;
203 }
208 [[nodiscard]] constexpr wx::Direction raz() const
209 {
210 return raz_;
211 }
216 [[nodiscard]] constexpr ROSSize ros() const
217 {
218 return ros_;
219 }
224 [[nodiscard]] constexpr const Cell& cell() const
225 {
226 return cell_;
227 }
232 [[nodiscard]] constexpr CellIndex source() const
233 {
234 return source_;
235 }
236private:
246 constexpr Event(const DurationSize time,
247 const Cell& cell,
248 const CellIndex source,
249 const Type type,
250 const IntensitySize intensity,
251 const ROSSize ros,
252 const Direction raz,
253 const DurationSize time_at_location)
254 : time_(time),
255 time_at_location_(time_at_location),
256 cell_(cell),
257 type_(type),
258 intensity_(intensity),
259 ros_(ros),
260 raz_(raz),
262 {
263 }
267 DurationSize time_;
271 DurationSize time_at_location_;
280 IntensitySize intensity_;
281 ROSSize ros_;
282 Direction raz_;
283 // /**
284 // * \brief Spread information at time and place of event
285 // */
286 // const SpreadInfo* spread_info_;
290 CellIndex source_;
291};
292}
A specific Event scheduled in a specific Scenario.
Definition Event.h:19
static Event makeFireSpread(const DurationSize time, const IntensitySize intensity, const ROSSize ros, const Direction raz, const Cell &cell)
Make fire spread event.
Definition Event.h:123
static Event makeFireSpread(const DurationSize time, const IntensitySize intensity, const ROSSize ros, const Direction raz)
Make fire spread event.
Definition Event.h:108
constexpr DurationSize timeAtLocation() const
Duration that Event Cell has been burning (decimal days)
Definition Event.h:192
constexpr DurationSize time() const
Time of Event (decimal days)
Definition Event.h:176
Event(const Event &rhs)=delete
Copy constructor.
constexpr Event(const DurationSize time, const Cell &cell, const CellIndex source, const Type type, const IntensitySize intensity, const ROSSize ros, const Direction raz, const DurationSize time_at_location)
Constructor.
Definition Event.h:246
constexpr const Cell & cell() const
Cell Event takes place in.
Definition Event.h:224
CellIndex source_
Spread information at time and place of event.
Definition Event.h:290
constexpr Type type() const
Type of Event.
Definition Event.h:184
Type
Type of Event.
Definition Event.h:30
DurationSize time_
Time to schedule for.
Definition Event.h:267
Cell cell_
Cell to spread in.
Definition Event.h:275
Event & operator=(Event &&rhs) noexcept=default
Move assignment.
static Event makeNewFire(const DurationSize time, const Cell &cell)
Make new fire event.
Definition Event.h:69
constexpr CellIndex source() const
CellIndex for relative Cell that spread into from.
Definition Event.h:232
Type type_
Type of Event.
Definition Event.h:279
Event & operator=(const Event &rhs)=delete
Copy assignment.
constexpr IntensitySize intensity() const
Burn Intensity (kW/m)
Definition Event.h:200
Event(Event &&rhs) noexcept=default
Move constructor.
static constexpr Cell NoLocation
Cell representing no location.
Definition Event.h:24
static Event makeSave(const DurationSize time)
Make simulation save event.
Definition Event.h:83
constexpr wx::Direction raz() const
Head fire spread direction.
Definition Event.h:208
static Event makeFireSpread(const DurationSize time)
Make fire spread event.
Definition Event.h:95
static Event makeFireSpread(const DurationSize time, const IntensitySize intensity, const ROSSize ros, const Direction raz, const Cell &cell, const CellIndex source)
Make fire spread event.
Definition Event.h:139
static Event makeEnd(const DurationSize time)
Make simulation end event.
Definition Event.h:56
constexpr ROSSize ros() const
Head fire rate of spread (m/min)
Definition Event.h:216
DurationSize time_at_location_
Duration that Event Cell has been burning (decimal days)
Definition Event.h:271
A Position with a Slope, Aspect, and Fuel.
Definition Cell.h:20
Direction with access to degrees or radians.
Definition Weather.h:64