@@ -49,10 +49,11 @@ std::unordered_map<int, std::vector<int>> HarvestedCells;
49
49
std::vector<int > NFTypesCells;
50
50
std::unordered_map<int , int > IgnitionHistory;
51
51
std::unordered_map<int , std::string> WeatherHistory;
52
- std::unordered_map<int , std::vector<float >> Statistics ;
52
+ std::unordered_map<int , std::vector<float >> StatisticsPerCell ;
53
53
std::unordered_map<int , float > meanSurfaceFlameLength;
54
54
std::unordered_map<int , float > meanCrownFlameLength;
55
55
std::unordered_map<int , float > meanMaxFlameLength;
56
+ std::unordered_map<int , std::vector<float >> StatisticsPerSim;
56
57
57
58
/* *****************************************************************************
58
59
Utils
@@ -1824,37 +1825,55 @@ Cell2Fire::Results()
1824
1825
this ->rows , this ->cols , this ->xllcorner , this ->yllcorner , this ->cellSide , this ->maxFlameLengths );
1825
1826
}
1826
1827
1827
- // Flame Length Statistics
1828
+ // Flame Length StatisticsPerCell
1828
1829
// This will be used to store accumulated flame lengths across simulations
1829
1830
if (this ->args .Stats )
1830
1831
{
1831
-
1832
+ float totalCrown = 0 ;
1833
+ float totalSurface = 0 ;
1834
+ float maxPerSim = 0 ;
1835
+ std::vector<float > simStats;
1832
1836
for (int cell : this ->burntCells )
1833
1837
{
1834
- std::vector<float > flameLengthMeans ;
1838
+ std::vector<float > cellFlameLengthMeans ;
1835
1839
1836
1840
float surfaceFlameLength = this ->surfaceFlameLengths [cell] / args.TotalSims ;
1837
1841
meanSurfaceFlameLength[cell] += surfaceFlameLength;
1838
- flameLengthMeans.push_back (meanSurfaceFlameLength[cell]);
1842
+ cellFlameLengthMeans.push_back (meanSurfaceFlameLength[cell]);
1843
+ totalSurface += this ->surfaceFlameLengths [cell];
1844
+ maxPerSim = max (maxPerSim, this ->surfaceFlameLengths [cell]);
1839
1845
1840
1846
if ((this ->args .AllowCROS ) && (this ->args .Simulator != " C" ))
1841
1847
{
1842
1848
float crownFlameLength = this ->crownFlameLengths [cell] / args.TotalSims ;
1843
1849
float maxFlameLength = this ->maxFlameLengths [cell] / args.TotalSims ;
1844
1850
meanCrownFlameLength[cell] += crownFlameLength;
1845
1851
meanMaxFlameLength[cell] += maxFlameLength;
1846
- flameLengthMeans.push_back (meanCrownFlameLength[cell]);
1847
- flameLengthMeans.push_back (meanMaxFlameLength[cell]);
1852
+ cellFlameLengthMeans.push_back (meanCrownFlameLength[cell]);
1853
+ cellFlameLengthMeans.push_back (meanMaxFlameLength[cell]);
1854
+ totalCrown += this ->maxFlameLengths [cell];
1855
+ maxPerSim = max (maxPerSim, this ->crownFlameLengths [cell]);
1848
1856
}
1849
-
1850
- Statistics[cell] = { flameLengthMeans };
1857
+ StatisticsPerCell[cell] = { cellFlameLengthMeans };
1858
+ }
1859
+ simStats.push_back (totalSurface / BCells);
1860
+ if ((this ->args .AllowCROS ) && (this ->args .Simulator != " C" ))
1861
+ {
1862
+ simStats.push_back (totalCrown / BCells);
1851
1863
}
1864
+ simStats.push_back (maxPerSim);
1865
+
1866
+ StatisticsPerSim[this ->sim ] = { simStats };
1867
+ std::ostringstream oss;
1868
+ std::string Stats = this ->statsFolder + " statisticsPerSim" + oss.str () + " .csv" ;
1869
+ CSVWriter simStatsFile (Stats);
1870
+ simStatsFile.printStats (StatisticsPerSim, " sim" , (this ->args .AllowCROS ) && (this ->args .Simulator != " C" ));
1852
1871
if (currentSim == args.TotalSims )
1853
1872
{
1854
1873
std::ostringstream oss;
1855
- std::string Statsname = this ->statsFolder + " statistics " + oss.str () + " .csv" ;
1874
+ std::string Statsname = this ->statsFolder + " statisticsPerCell " + oss.str () + " .csv" ;
1856
1875
CSVWriter statsFile (Statsname);
1857
- statsFile.printStats (Statistics );
1876
+ statsFile.printStats (StatisticsPerCell, " cell " , ( this -> args . AllowCROS ) && ( this -> args . Simulator != " C " ) );
1858
1877
}
1859
1878
}
1860
1879
0 commit comments