Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/FireDomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,14 @@

// Computing the propagation speed of a given firenode
double FireDomain::getPropagationSpeed(FireNode* fn) {
if ( propagativeLayer == nullptr ){
// A domain built without loadData: pick the model as loadData does
string propagationModel = params->getParameter("propagationModel");
if ( !addPropagativeLayer(propagationModel) ){
cout<<"PROBLEM: Unable to retrieve propagation model "<<propagationModel<<endl;
return 0.;
}
}
int modelIndex = propagativeLayer->getModelIndexAt(fn);

return propModelsTable[modelIndex]->getSpeedForNode(fn) * propagationSpeedAdjustmentFactor;
Expand Down
18 changes: 18 additions & 0 deletions tests/unit/test_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,24 @@ TEST_CASE("plot writes arrival times as an ASCII grid, north row first") {
CHECK(inexact == 0);
}

TEST_CASE("a domain built without a propagation layer spreads with the propagationModel parameter") {
// loadData picks the model from the propagationModel parameter, but a
// bare FireDomain[...] had no propagation layer and goTo segfaulted.
Command executor;
run(executor, "clear[]");
run(executor, "setParameter[propagationModel=Iso]");
run(executor, "FireDomain[sw=(0,0,0);ne=(1000,1000,0);t=0]");
REQUIRE(Command::getDomain() != nullptr);
run(executor, "startFire[loc=(500,500,0)]");
run(executor, "goTo[t=100]");

size_t burnt = 0;
for (const auto& column : Command::getDomain()->getDataMatrix("arrival_time"))
for (double t : column)
if (std::isfinite(t)) burnt++;
CHECK(burnt > 0);
}

TEST_CASE("a front that reaches the edge on sloping ground leaves the far side unburnt") {
Command executor;
run(executor, "clear[]");
Expand Down
Loading