![]() |
FireSTARR
|
Contains all the immutable information regarding a simulation that is common between Scenarios. More...
#include <Model.h>
Public Member Functions | |
topo::Cell | cell (const Idx row, const Idx column) const |
Cell at the given row and column. | |
template<class P > | |
constexpr topo::Cell | cell (const Position< P > &position) const |
Cell at the given Location. | |
constexpr Idx | rows () const |
Cell at the Location represented by the given hash. | |
constexpr Idx | columns () const |
Number of columns in extent. | |
constexpr MathSize | cellSize () const |
Cell width and height (m) | |
constexpr const topo::Environment & | environment () const |
Environment simulation is occurring in. | |
constexpr Clock::time_point | runningSince () const |
Time that execution started. | |
constexpr Clock::duration | timeLimit () const |
Maximum amount of time simulation can run for before being stopped. | |
bool | shouldStop () const noexcept |
Whether or not simulation has exceeded any limits that mean it should stop. | |
bool | isOutOfTime () const noexcept |
Whether or not simulation has been running longer than maximum duration. | |
bool | isOverSimulationCountLimit () const noexcept |
Whether or not simulation is over max simulation count. | |
int | year () const noexcept |
What year the weather is for. | |
int | ignitionScenarios () const noexcept |
How many ignition scenarios are being used. | |
int | scenarioCount () const noexcept |
How many Scenarios are in each Iteration. | |
constexpr int | nd (const DurationSize time) const |
Difference between date and the date of minimum foliar moisture content. | |
const char * | outputDirectory () const |
std::chrono::seconds | runTime () const |
Duration that model has run for. | |
ProbabilityMap * | makeProbabilityMap (DurationSize time, DurationSize start_time, int min_value, int low_max, int med_max, int max_value) const |
Create a ProbabilityMap with the same extent as this. | |
Model (const string dir_out, const topo::StartPoint &start_point, topo::Environment *env) | |
Constructor. | |
Model (Model &&rhs) noexcept=delete | |
Model (const Model &rhs)=delete | |
Model & | operator= (Model &&rhs) noexcept=delete |
Model & | operator= (const Model &rhs)=delete |
void | setWeather (const wx::FwiWeather &weather, const Day start_day) |
Set constant weather. | |
void | readWeather (const wx::FwiWeather &yesterday, const MathSize latitude, const string &filename) |
Read weather used for Scenarios. | |
void | makeStarts (Coordinates coordinates, const topo::Point &point, string perim, size_t size) |
Make starts based on desired point and where nearest combustible cells are. | |
Iteration | readScenarios (const topo::StartPoint &start_point, DurationSize start, Day start_day, Day last_date) |
Create an Iteration by initializing Scenarios. | |
BurnedData * | getBurnedVector () const noexcept |
Acquire a BurnedData that has already burnt cells set. | |
void | releaseBurnedVector (BurnedData *has_burned) const noexcept |
Return a BurnedData so it can be used in the future. | |
const wx::FwiWeather * | yesterday () const noexcept |
Static Public Member Functions | |
static int | runScenarios (const string dir_out, const char *weather_input, const wx::FwiWeather &yesterday, const char *raster_root, const topo::StartPoint &start_point, const tm &start_time, const string &perimeter, size_t size) |
Run Scenarios initialized from given inputs. | |
Static Public Attributes | |
static Semaphore | task_limiter {static_cast<int>(std::thread::hardware_concurrency())} |
Semaphore used to limit how many things run at once. | |
Private Member Functions | |
bool | add_statistics (vector< MathSize > *all_sizes, vector< MathSize > *means, vector< MathSize > *pct, const util::SafeVector &sizes) |
Add statistics for completed iterations. | |
map< DurationSize, ProbabilityMap * > | runIterations (const topo::StartPoint &start_point, DurationSize start, Day start_day) |
Run Iterations until confidence is reached. | |
void | findAllStarts () |
Find all Cell(s) that can burn in entire Environment. | |
DurationSize | saveProbabilities (map< DurationSize, ProbabilityMap * > &probabilities, const Day start_day, const bool is_interim) |
void | findStarts (Location location) |
Find Cell(s) that can burn closest to Location. | |
Private Attributes | |
const string | dir_out_ |
mutex | vector_mutex_ |
Mutex for parallel access. | |
tm | start_time_ |
Start time of simulation. | |
vector< unique_ptr< BurnedData > > | vectors_ {} |
Pool of BurnedData that can be reused. | |
array< int, MAX_DAYS > | nd_ {} |
Differences between date and the date of minimum foliar moisture content. | |
map< size_t, shared_ptr< wx::FireWeather > > | wx_ {} |
Map of scenario number to weather stream. | |
map< size_t, shared_ptr< wx::FireWeather > > | wx_daily_ {} |
Map of scenario number to weather stream. | |
vector< shared_ptr< topo::Cell > > | starts_ {} |
Cell(s) that can burn closest to start Location. | |
Clock::time_point | running_since_ |
Time to use for simulation start. | |
Clock::duration | time_limit_ |
Maximum amount of time simulation can run for before being stopped. | |
shared_ptr< topo::Perimeter > | perimeter_ = nullptr |
Initial intensity map based off perimeter. | |
topo::Environment * | env_ |
Environment to use for Model. | |
int | year_ |
What year the weather is for. | |
bool | is_out_of_time_ = false |
If simulation is out of time and should stop. | |
bool | is_over_simulation_count_ = false |
If simulation is over max simulation count. | |
wx::FwiWeather | yesterday_ |
std::chrono::steady_clock::time_point | last_checked_ |
Time when we last checked if simulation should end. | |
MathSize | latitude_ |
Latitude to use for any calcualtions. | |
MathSize | longitude_ |
Longitude to use for any calcualtions. | |
Contains all the immutable information regarding a simulation that is common between Scenarios.
fs::sim::Model::Model | ( | const string | dir_out, |
const topo::StartPoint & | start_point, | ||
topo::Environment * | env ) |
Constructor.
start_point | StartPoint to use for sunrise/sunset times |
env | Environment to run simulations in |
|
nodiscardprivate |
Add statistics for completed iterations.
all_sizes | All sizes that have simulations have produced |
means | Mean sizes per iteration |
pct | 95th percentile sizes per iteration |
cur_sizes | Sizes to add to statistics |
|
inlinenodiscard |
Cell at the given row and column.
row | Row |
column | Column |
|
inlinenodiscardconstexpr |
Cell at the given Location.
location | Location to get Cell for |
|
inlinenodiscardconstexpr |
Cell width and height (m)
|
inlinenodiscardconstexpr |
Number of columns in extent.
|
inlinenodiscardconstexpr |
Environment simulation is occurring in.
|
private |
Find Cell(s) that can burn closest to Location.
location | Location to look for start Cells |
|
nodiscardnoexcept |
Acquire a BurnedData that has already burnt cells set.
|
inlinenodiscardnoexcept |
How many ignition scenarios are being used.
|
nodiscardnoexcept |
Whether or not simulation has been running longer than maximum duration.
|
nodiscardnoexcept |
Whether or not simulation is over max simulation count.
|
nodiscard |
Create a ProbabilityMap with the same extent as this.
time | Time in simulation this ProbabilityMap represents |
start_time | Start time of simulation |
min_value | Lower bound of 'low' intensity range |
low_max | Upper bound of 'low' intensity range |
med_max | Upper bound of 'moderate' intensity range |
max_value | Upper bound of 'high' intensity range |
void fs::sim::Model::makeStarts | ( | Coordinates | coordinates, |
const topo::Point & | point, | ||
string | perim, | ||
size_t | size ) |
Make starts based on desired point and where nearest combustible cells are.
coordinates | Coordinates in the Environment to try starting at |
point | Point Coordinates represent |
perim | Perimeter to start from, if there is one |
size | Size of fire to create if no input Perimeter |
|
inlinenodiscardconstexpr |
Difference between date and the date of minimum foliar moisture content.
time | Date to get value for |
|
nodiscard |
Create an Iteration by initializing Scenarios.
start_point | StartPoint to use for sunrise/sunset |
start | Start time for simulation |
start_day | Start date for simulation |
last_date | End date for simulation |
void fs::sim::Model::readWeather | ( | const wx::FwiWeather & | yesterday, |
const MathSize | latitude, | ||
const string & | filename ) |
Read weather used for Scenarios.
yesterday | FwiWeather for yesterday |
latitude | Latitude to calculate for |
filename | Weather file to read |
|
noexcept |
Return a BurnedData so it can be used in the future.
has_burned | BurnedData to return to pool |
|
inlinenodiscardconstexpr |
Cell at the Location represented by the given hash.
hash_size | Hash size for Location to get Cell for |
Number of rows in extent
|
private |
Run Iterations until confidence is reached.
start_point | StartPoint to use for sunrise/sunset |
start | Start time for simulation |
start_day | Start day for simulation |
|
inlinenodiscardconstexpr |
Time that execution started.
|
staticnodiscard |
Run Scenarios initialized from given inputs.
dir_out | Folder to save outputs to |
weather_input | Name of file to read weather from |
yesterday | FwiWeather yesterday used for startup indices |
raster_root | Directory to read raster inputs from |
start_point | StartPoint to use for sunrise/sunset |
start_time | Start time for simulation |
perimeter | Perimeter to initialize fire from, if there is one |
size | Size to start fire at if no Perimeter |
|
nodiscard |
Duration that model has run for.
|
private |
Save probability rasters
|
inlinenodiscardnoexcept |
void fs::sim::Model::setWeather | ( | const wx::FwiWeather & | weather, |
const Day | start_day ) |
Set constant weather.
weather | FwiWeather to use as constant weather |
|
nodiscardnoexcept |
Whether or not simulation has exceeded any limits that mean it should stop.
|
inlinenodiscardconstexpr |
Maximum amount of time simulation can run for before being stopped.
|
inlinenodiscardnoexcept |
What year the weather is for.
|
inlinenoexcept |
Conditions for yesterday (or constant weather)
|
private |
Initial intensity map based off perimeter.
Perimeter to use for initializing simulations
|
private |
Conditions for yesterday (or constant weather)