00001
00002
00003 #ifndef DisturbanceH
00004 #define DisturbanceH
00005
00006 #include "BehaviorBase.h"
00007
00008 class clGridBase;
00009 class clPackage;
00010 class clTree;
00011
00066 class clDisturbance : virtual public clBehaviorBase {
00067
00068 public:
00069
00075 clDisturbance(clSimManager *p_oSimManager);
00076
00080 ~clDisturbance();
00081
00087 void Action();
00088
00093 enum cutType {partial,
00094 gap,
00095 clear};
00100 enum amtType {percentBA,
00101 absBA,
00102 percentDen,
00103 absDen};
00110 int GetNumberOfCutRanges() {return m_iNumAllowedCutRanges;};
00111
00121 void SetNameData(char *cNameString);
00122
00123
00124 protected:
00125 clTreePopulation *mp_oPop;
00192 clGridBase *mp_oMasterCutsGrid;
00193
00225 clGridBase *mp_oCutEventsGrid;
00226
00258 clGridBase *mp_oResultsGrid;
00259
00260
00261
00262
00263
00264 short int m_iMasterTimestepCode;
00265 short int m_iMasterIDCode;
00266 short int *mp_iSpeciesCodes;
00268 short int m_iCutTypeCode;
00269 short int m_iAmountTypeCode;
00270 short int *mp_iRangeMinCodes;
00272 short int *mp_iRangeMaxCodes;
00274 short int *mp_iRangeAmountCodes;
00277
00278 short int m_iCutTimestepCode;
00279 short int m_iCutIDCode;
00281
00282 short int m_iHarvestTypeCode;
00283 short int **mp_iDenCutCodes;
00285 short int **mp_iBaCutCodes;
00288
00289 short int m_iNumAllowedCutRanges;
00290 short int m_iReasonCode;
00292 bool m_bIsHarvest;
00295 struct stcGridList {
00296 clTree *p_oTree;
00297 stcGridList *next;
00298 float fDbh;
00299 short int iX;
00300 short int iY;
00301 };
00302
00307 void ResetResultsGrid();
00308
00316 void GetData(xercesc::DOMDocument *p_oDoc);
00317
00324 void ReadHarvestParameterFileData(xercesc::DOMDocument *p_oDoc);
00325
00332 void ReadMortEpParameterFileData(xercesc::DOMDocument *p_oDoc);
00333
00337 void SetupGrids();
00338
00353 void ValidatePackages();
00354
00362 void CutTrees(clPackage *p_oMasterPackage);
00363
00388 int AssembleCutArea(clPackage *p_oMasterPackage, const int &iNumXCells,
00389 const int &iNumYCells, stcGridList *&p_cutArea, float *p_fLoDbh, float
00390 *p_fHiDbh, float *p_fAmountToRemove, bool *p_bSpeciesCut);
00391
00406 void GetBasalArea(stcGridList *p_cutArea, const short int &iSpecies,
00407 float *p_fTotalBasalArea, float *p_fLoDbh, float *p_fHiDbh);
00408
00421 clTree* GetTallestTreeInCutArea(stcGridList *&p_cutArea,
00422 const short int &iSpecies);
00423
00437 clTree* GetNextTreeInCutArea(stcGridList *&p_cutArea, const short int &iSpecies);
00438
00447 void SetCutFlags(stcGridList *p_cutArea, const int &iCutType);
00448
00449 };
00450
00451 #endif
00452