@@ -16,6 +16,17 @@ struct SlopeMetaData
1616 }
1717};
1818
19+ struct WindMetaData
20+ {
21+ int direction_difference_;
22+ double wind_speed_;
23+ bool operator ==(const WindMetaData &rhs) const
24+ {
25+ return direction_difference_ == rhs.direction_difference_ &&
26+ wind_speed_ == rhs.wind_speed_ ;
27+ }
28+ };
29+
1930template <>
2031struct std ::hash<SlopeMetaData>
2132{
@@ -27,32 +38,45 @@ struct std::hash<SlopeMetaData>
2738 }
2839};
2940
41+
42+ template <>
43+ struct std ::hash<WindMetaData>
44+ {
45+ std::size_t operator ()(const WindMetaData &key) const
46+ {
47+ size_t h1 = std::hash<int >()(key.direction_difference_ );
48+ size_t h2 = std::hash<int >()(key.wind_speed_ );
49+ return h1 ^ (h2 << 1 );
50+ }
51+ };
52+
3053class Math
3154{
3255private:
33-
3456public:
3557 Math ();
36- // virtual double calculateKoef(float windSpeed, double slopeAngleRad) const = 0;
37- // virtual double calculateWindKoef(const cell* c, directions InvestigatedDirection) const = 0;
38- virtual bool willSpread (const cell* c, directions InvestigatedDirection, int altitudeDifference) const = 0;
39- virtual bool willSpreadThroughOne (const cell* c, directions InvestigatedDirection, int altitudeDifference) const = 0;
58+ // virtual double calculateKoef(float windSpeed, double slopeAngleRad) const = 0;
59+ // virtual double calculateWindKoef(const cell* c, directions InvestigatedDirection) const = 0;
60+ virtual bool willSpread (const cell * c, directions InvestigatedDirection, int altitudeDifference) const = 0;
61+ virtual bool willSpreadThroughOne (const cell * c, directions InvestigatedDirection, int altitudeDifference) const = 0;
4062 ~Math ();
4163};
4264
43- constexpr int ignitionPercentage (){
65+ constexpr int ignitionPercentage ()
66+ {
4467 return 50 ; // in formula there is smth wrong I suppose
4568}
4669
47- constexpr int throughPercentage (){
70+ constexpr int throughPercentage ()
71+ {
4872 return 100 ; // in formula there is smth wrong I suppose
4973}
5074
5175// / @brief by now is from
52- // / "Aildland fire spread modelling using cellular
53- // / automata: evolution in large-scale spatially heterogeneous environments
76+ // / "Aildland fire spread modelling using cellular
77+ // / automata: evolution in large-scale spatially heterogeneous environments
5478// / under fire suppression tactics"
55- class Math1 final : public Math
79+ class Math1 final : public Math
5680{
5781private:
5882 mutable std::unordered_map<SlopeMetaData, int > slope_counter_;
@@ -62,12 +86,12 @@ class Math1 final: public Math
6286 mutable clock_t slope_timer;
6387 mutable int slope_counter;
6488 double calculateKoef (float windSpeed, double slopeAngleRad) const ;
65- double calculateWindKoef (const cell* c, directions InvestigatedDirection) const ;
89+ double calculateWindKoef (const cell * c, directions InvestigatedDirection) const ;
6690 double calculateGroundSlopeKoef (directions InvestigatedDirection, int altitudeDifference) const ;
91+
6792public:
68- bool willSpread (const cell* c, directions InvestigatedDirection, int altitudeDifference) const override ;
69- bool willSpreadThroughOne (const cell* c, directions InvestigatedDirection, int altitudeDifference) const override ;
93+ bool willSpread (const cell * c, directions InvestigatedDirection, int altitudeDifference) const override ;
94+ bool willSpreadThroughOne (const cell * c, directions InvestigatedDirection, int altitudeDifference) const override ;
7095 Math1 ();
7196 ~Math1 ();
7297};
73-
0 commit comments