00001 //--------------------------------------------------------------------------- 00002 00003 #ifndef DensityLightH 00004 #define DensityLightH 00005 //--------------------------------------------------------------------------- 00006 #include "LightBase.h" 00007 #include <math.h> 00008 00009 class clSimManager; 00010 class clGridBase; 00011 class clTreePopulation; 00012 00062 class clDensityLight : virtual public clLightBase { 00063 00064 public: 00065 00071 clDensityLight(clSimManager *p_oSimManager); 00072 00073 //~clDensityLight(); use default constructor 00074 00089 void DoShellSetup(xercesc::DOMDocument *p_oDoc); 00090 00094 void TimestepCleanup() {m_bGridUpdated = false;}; 00095 00103 float CalcLightValue(clTree *p_oTree, clTreePopulation *p_oPop); 00104 00111 inline float GetMeanGLI(const int &iDensity) { 00112 float fTemp = m_fA / (1 + pow(iDensity / m_fC, m_fB)); 00113 fTemp = fTemp >= 0 ? fTemp : 0; 00114 return fTemp <= 100 ? fTemp : 100; 00115 }; 00116 00117 protected: 00118 00126 clGridBase *mp_oLightGrid; 00127 00129 float m_fA; 00130 00132 float m_fB; 00133 00135 float m_fC; 00136 00138 float m_fSigma; 00139 00141 float m_fMinDbh; 00142 00145 int m_iChangeThreshold; 00146 00148 short int m_iGridLightCode; 00149 00151 short int m_iGridCountCode; 00152 00154 bool m_bGridUpdated; 00155 00164 void UpdateGridValues(clTreePopulation * p_oPop); 00165 }; 00166 //--------------------------------------------------------------------------- 00167 #endif