FireSTARR
Loading...
Searching...
No Matches
ConstantWeather.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, 2024-2025. */
3
4/* SPDX-License-Identifier: AGPL-3.0-or-later */
5
6#include "stdafx.h"
7#include "FireWeather.h"
8
9namespace fs::sim
10{
11static vector<const wx::FwiWeather*>* make_constant_weather(const wx::Dc& dc,
12 const wx::Dmc& dmc,
13 const wx::Ffmc& ffmc,
14 const wx::Wind& wind)
15{
16 static constexpr wx::Temperature TEMP(20.0);
17 static constexpr wx::RelativeHumidity RH(30.0);
18 static constexpr wx::Precipitation PREC(0.0);
19 const auto bui = wx::Bui(dmc, dc);
20 auto wx = new vector<const wx::FwiWeather*>{static_cast<size_t>(YEAR_HOURS)};
21 std::generate(wx->begin(),
22 wx->end(),
23 [&wind, &ffmc, &dmc, &dc, &bui]() {
24 return make_unique<wx::FwiWeather>(
25 TEMP,
26 RH,
27 wind,
28 PREC,
29 ffmc,
30 dmc,
31 dc,
32 wx::Isi(wind.speed(), ffmc),
33 bui,
34 wx::Fwi(wx::Isi(wind.speed(), ffmc), bui))
35 .release();
36 });
37 return wx;
38}
42class ConstantWeather final
43 : public wx::FireWeather
44{
45public:
46 ~ConstantWeather() override = default;
47 ConstantWeather(const ConstantWeather& rhs) = delete;
48 ConstantWeather(ConstantWeather&& rhs) = delete;
49 ConstantWeather& operator=(const ConstantWeather& rhs) = delete;
50 ConstantWeather& operator=(ConstantWeather&& rhs) = delete;
62 const Day start_date,
63 const wx::Dc& dc,
64 const wx::Dmc& dmc,
65 const wx::Ffmc& ffmc,
66 const wx::Wind& wind)
67 : ConstantWeather(set<const fuel::FuelType*>{fuel},
68 start_date,
69 dc,
70 dmc,
71 ffmc,
72 wind)
73 {
74 }
75 ConstantWeather(const set<const fuel::FuelType*>& used_fuels,
76 const Day start_date,
77 const wx::Dc& dc,
78 const wx::Dmc& dmc,
79 const wx::Ffmc& ffmc,
80 const wx::Wind& wind)
81 : FireWeather(used_fuels,
82 start_date,
83 MAX_DAYS - 1,
84 make_constant_weather(dc, dmc, ffmc, wind))
85 {
86 }
87};
88}
An FBP fuel type.
Definition FuelType.h:55
A FireWeather stream with the same value for every date and time.
Definition ConstantWeather.h:44
ConstantWeather(const fuel::FuelType *fuel, const Day start_date, const wx::Dc &dc, const wx::Dmc &dmc, const wx::Ffmc &ffmc, const wx::Wind &wind)
A Constant weather stream with only one possible fuel.
Definition ConstantWeather.h:61
Drought Code value.
Definition FWI.h:73
Duff Moisture Code value.
Definition FWI.h:43
Fine Fuel Moisture Code value.
Definition FWI.h:15
A stream of weather that gets used by a Scenario every Iteration.
Definition FireWeather.h:29
FireWeather(FireWeather &&rhs)=default
Move constructor.
Wind with a Speed and Direction.
Definition Weather.h:139