FireSTARR
Loading...
Searching...
No Matches
src
cpp
fs
BurnedData.h
1
/* SPDX-License-Identifier: AGPL-3.0-or-later */
2
#ifndef FS_BURNEDDATA_H
3
#define FS_BURNEDDATA_H
4
#include "stdafx.h"
5
#include "ConstantGrid.h"
6
#include "Location.h"
7
namespace
fs
8
{
9
class
BurnedData
10
{
11
public
:
12
BurnedData
(
const
CellGrid
& cells)
noexcept
;
13
BurnedData
(
const
FuelGrid
& fuel)
noexcept
;
14
bool
at(
const
XYIdx
& h)
const
noexcept
;
15
void
set(
const
XYIdx
& h)
noexcept
;
16
void
clear()
noexcept
;
17
BurnedData
()
noexcept
=
default
;
18
BurnedData
(
const
BurnedData
& rhs)
noexcept
;
19
BurnedData
(
BurnedData
&& rhs)
noexcept
;
20
BurnedData
& operator=(
const
BurnedData
& rhs)
noexcept
;
21
BurnedData
& operator=(
BurnedData
&& rhs)
noexcept
;
22
[[nodiscard]]
constexpr
Idx height()
const
noexcept
{
return
height_; }
23
[[nodiscard]]
constexpr
Idx width()
const
noexcept
{
return
width_; }
28
[[nodiscard]] MathSize
fireSize
() const noexcept
29
{
30
// we know that every cell is a key, so we convert that to hectares
31
const
MathSize per_width = (cell_size_ / 100.0);
32
// size of fire is number of bits set * cell size
33
return
static_cast<
MathSize
>
(data_->count() - unburnable_) * per_width * per_width;
34
}
35
36
private
:
37
// std::bitset doesn't heap allocate
38
using
dtype = std::bitset<static_cast<size_t>(MAX_HEIGHT) * MAX_WIDTH>;
39
uptr<dtype> data_{
nullptr
};
40
static
uptr<dtype> from_grid(
auto
& grid,
auto
fct);
41
MathSize cell_size_{-1};
42
size_t
unburnable_{0};
43
Idx height_{};
44
Idx width_{};
45
};
46
}
47
#endif
fs::BurnedData
Definition
BurnedData.h:10
fs::BurnedData::fireSize
MathSize fireSize() const noexcept
Calculate area for cells that have a value (ha)
Definition
BurnedData.h:28
fs::ConstantGrid< Cell, SpreadKey >
fs::XYIdx
Definition
Location.h:81
Generated by
1.12.0