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 type,
45 0};
46 }
52 [[nodiscard]] static Event makeEnd(const DurationSize time)
53 {
54 return makeEvent(
55 time,
57 END_SIMULATION);
58 }
65 [[nodiscard]] static Event makeNewFire(
66 const DurationSize time,
67 const Cell& cell)
68 {
69 return makeEvent(
70 time,
71 cell,
72 NEW_FIRE);
73 }
79 [[nodiscard]] static Event makeSave(const DurationSize time)
80 {
81 return makeEvent(
82 time,
84 SAVE);
85 }
91 [[nodiscard]] static Event makeFireSpread(const DurationSize time)
92 {
93 return makeEvent(
94 time,
96 FIRE_SPREAD);
97 }
105 [[nodiscard]] static Event makeFireSpread(
106 const DurationSize time,
107 const Cell& cell)
108 {
109 return {
110 time,
111 cell,
112 FIRE_SPREAD,
113 0};
114 }
115 ~Event() = default;
120 Event(Event&& rhs) noexcept = default;
125 Event(const Event& rhs) = delete;
131 Event& operator=(Event&& rhs) noexcept = default;
137 Event& operator=(const Event& rhs) = delete;
142 [[nodiscard]] constexpr DurationSize time() const
143 {
144 return time_;
145 }
150 [[nodiscard]] constexpr Type type() const
151 {
152 return type_;
153 }
158 [[nodiscard]] constexpr DurationSize timeAtLocation() const
159 {
160 return time_at_location_;
161 }
166 [[nodiscard]] constexpr const Cell& cell() const
167 {
168 return cell_;
169 }
170private:
180 constexpr Event(const DurationSize time,
181 const Cell& cell,
182 const Type type,
183 const DurationSize time_at_location)
184 : time_(time),
185 time_at_location_(time_at_location),
186 cell_(cell),
187 type_(type)
188 {
189 }
193 DurationSize time_;
197 DurationSize time_at_location_;
206};
207}
A specific Event scheduled in a specific Scenario.
Definition Event.h:19
static Event makeFireSpread(const DurationSize time, const Cell &cell)
Make fire spread event.
Definition Event.h:105
constexpr DurationSize timeAtLocation() const
Duration that Event Cell has been burning (decimal days)
Definition Event.h:158
constexpr DurationSize time() const
Time of Event (decimal days)
Definition Event.h:142
Event(const Event &rhs)=delete
Copy constructor.
constexpr Event(const DurationSize time, const Cell &cell, const Type type, const DurationSize time_at_location)
Constructor.
Definition Event.h:180
constexpr const Cell & cell() const
Cell Event takes place in.
Definition Event.h:166
constexpr Type type() const
Type of Event.
Definition Event.h:150
Type
Type of Event.
Definition Event.h:30
DurationSize time_
Time to schedule for.
Definition Event.h:193
Cell cell_
Cell to spread in.
Definition Event.h:201
Event & operator=(Event &&rhs) noexcept=default
Move assignment.
static Event makeNewFire(const DurationSize time, const Cell &cell)
Make new fire event.
Definition Event.h:65
Type type_
Type of Event.
Definition Event.h:205
Event & operator=(const Event &rhs)=delete
Copy assignment.
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:79
static Event makeFireSpread(const DurationSize time)
Make fire spread event.
Definition Event.h:91
static Event makeEnd(const DurationSize time)
Make simulation end event.
Definition Event.h:52
DurationSize time_at_location_
Duration that Event Cell has been burning (decimal days)
Definition Event.h:197
A Position with a Slope, Aspect, and Fuel.
Definition Cell.h:20
Direction with access to degrees or radians.
Definition Weather.h:64