@@ -30,7 +30,8 @@ double Math1::calculateWindKoef(const cell *c, directions InvestigatedDirection)
3030 {
3131 return double (1 );
3232 }
33- WindMetaData meta = {abs (static_cast <int >(wind->getWindDirection ()) - static_cast <int >(InvestigatedDirection)), wind->getWindSpeed ()};
33+
34+ WindMetaData meta = {wind->directionDifference (InvestigatedDirection), wind->getWindSpeed ()};
3435 auto a = wind_result_[meta];
3536 if (a != 0 ){
3637 clock_t per_iteration = clock () - start;
@@ -56,14 +57,17 @@ double Math1::calculateGroundSlopeKoef(directions InvestigatedDirection, int alt
5657
5758 SlopeMetaData meta = {bool (static_cast <int >(InvestigatedDirection) / int (2 )), altitudeDifference};
5859
59- // auto a = slope_result_[meta];
60- // if (a != 0)
61- // {
62- // clock_t per_iteration = clock() - start;
63- // slope_timer = per_iteration+slope_timer;
64- // slope_counter++;
65- // return a;
66- // }
60+ auto a = slope_result_[meta];
61+ if (a != 0 )
62+ {
63+ clock_t per_iteration = clock () - start;
64+ slope_timer = per_iteration+slope_timer;
65+ slope_counter++;
66+ slope_counter_[meta]++;
67+ slope_result_[meta] = a;
68+ result_slope_[a]++;
69+ return a;
70+ }
6771
6872 double coef = 0 ;
6973 if (InvestigatedDirection == directions::North || InvestigatedDirection == directions::West ||
@@ -133,9 +137,9 @@ bool Math1::willSpread(const cell *c, directions InvestigatedDirection, int alti
133137 double slopeKoeff = calculateGroundSlopeKoef (InvestigatedDirection, altitudeDifference);
134138 double biomassKoeff = calculateBiomassKoef (c);
135139 double moistureKoeff = calculateMoistureKoeff (c->getWind ().get ()->getMoistureCoeff ());
136- int result = fireKoeff * slopeKoeff * biomassKoeff * moistureKoeff * 100 - 40 ;
140+ int result = fireKoeff * slopeKoeff * biomassKoeff * moistureKoeff * 100 / 2 ;
137141 result_overall[result]++;
138- return result + (rand () % 100 ) > ignitionPercentage ( );
142+ return result > (rand () % 100 );
139143}
140144
141145bool Math1::willSpreadThroughOne (const cell *c, directions InvestigatedDirection, int altitudeDifference) const
0 commit comments