Skip to content

Commit a2b2fd3

Browse files
authored
Merge pull request #2 from OroraTech/trigger-resolution
feat: implement trigger for resolution
2 parents 29d7a15 + 5d3698e commit a2b2fd3

5 files changed

Lines changed: 48 additions & 2 deletions

File tree

src/Command.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,6 +2003,44 @@ namespace libforefire
20032003
return normal;
20042004
}
20052005
}
2006+
if (tmpArgs[0] == "resolution")
2007+
{
2008+
double newPerimRes = getFloat("perimeterResolution", arg);
2009+
double newSpatialInc = getFloat("spatialIncrement", arg);
2010+
2011+
bool valid = true;
2012+
2013+
if (newPerimRes != FLOATERROR && newPerimRes <= 0.0) {
2014+
cout << "Error: perimeterResolution must be greater than 0." << endl;
2015+
valid = false;
2016+
}
2017+
if (newSpatialInc != FLOATERROR && newSpatialInc <= 0.0) {
2018+
cout << "Error: spatialIncrement must be greater than 0." << endl;
2019+
valid = false;
2020+
}
2021+
if (!valid) return error;
2022+
2023+
FireDomain* domain = getDomain();
2024+
if (domain != nullptr)
2025+
{
2026+
if (newPerimRes != FLOATERROR)
2027+
{
2028+
domain->setPerimeterResolution(newPerimRes);
2029+
cout << "Updated perimeterResolution to " << newPerimRes << endl;
2030+
}
2031+
if (newSpatialInc != FLOATERROR)
2032+
{
2033+
domain->setSpatialIncrement(newSpatialInc);
2034+
cout << "Updated spatialIncrement to " << newSpatialInc << endl;
2035+
}
2036+
return normal;
2037+
}
2038+
else
2039+
{
2040+
cout << "Error: No FireDomain available to update resolution parameters." << endl;
2041+
return error;
2042+
}
2043+
}
20062044
return error;
20072045
}
20082046
int Command::include(const string &arg, size_t &numTabs)

src/DataBroker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ namespace libforefire
12641264

12651265
if (varName == "altitude" && domain->getDomainID() == 0)
12661266
{
1267-
cout << "HHHHHHHHHHHHHHH read Altitude " << domain->getDomainID() << endl;
1267+
cout << "Reading Altitude " << domain->getDomainID() << endl;
12681268
auto altLayer = constructXYZTLayer(currentVar, SWCorner, spatialExtent, timeOrigin, Lt, -1);
12691269
registerLayer(varName, altLayer);
12701270
}

src/FireDomain.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,12 @@
412412
}
413413
return buffer.st_size;
414414
}
415+
void FireDomain::setPerimeterResolution(double res) {
416+
this->perimeterResolution = res;
417+
}
418+
void FireDomain::setSpatialIncrement(double inc) {
419+
this->spatialIncrement = inc;
420+
}
415421
void FireDomain::pushMultiDomainMetadataInList(size_t id, double lastTime, size_t atmoNX, size_t atmoNY, double nswx, double nswy, double nnex, double nney) {
416422
distributedDomainInfo *currentInfo = new distributedDomainInfo;
417423
currentInfo->ID = id;

src/FireDomain.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,9 @@ class FireDomain: public ForeFireAtom, Visitable {
326326

327327
size_t getFreeFluxModelIndex();
328328

329+
void setPerimeterResolution(double res);
330+
void setSpatialIncrement(double inc);
331+
329332
// Getter for the reference latitude.
330333
double getRefLatitude() ;
331334

src/SimulationParameters.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ std::string landCoverIndexedCSV = R"(Index;Rhod;Rhol;Md;Ml;sd;sl;e;Sigmad;Sigmal
370370
parameters.insert(make_pair("spatialCFLmax", "0.3"));
371371
parameters.insert(make_pair("spatialIncrement", "2"));
372372
parameters.insert(make_pair("spatialCFLmax", "0.3"));
373-
parameters.insert(make_pair("spatialIncrement", "2"));
374373
parameters.insert(make_pair("watchedProc", "-2"));
375374
parameters.insert(make_pair("CommandOutputs", "0"));
376375
parameters.insert(make_pair("FireDomainOutputs", "0"));

0 commit comments

Comments
 (0)