//--------------------------------------------------------------------- /// <summary> /// Try planting and if needed serotiny and resprouting at a site. /// </summary> /// <returns> /// True if at least one species reproduced by planting, serotiny or /// resprouting. False if no species reproduced by any of those 3 /// reproductive means. /// </returns> public static bool TryPlantingThenSerotinyAndResprouting(ActiveSite site) { bool plantingOccurred = planting.TryAt(site); bool sufficientLight; bool serotinyOccurred = false; if (!plantingOccurred) { for (int index = 0; index < speciesDataset.Count; ++index) { if (serotiny[site].Get(index)) { ISpecies species = speciesDataset[index]; sufficientLight = SufficientLight(species, site); if (sufficientLight && Establish(species, site)) { AddNewCohort(species, site); serotinyOccurred = true; if (isDebugEnabled) { log.DebugFormat("site {0}: {1} post-fire regenerated", site.Location, species.Name); } } else { if (isDebugEnabled) { log.DebugFormat("site {0}: {1} post-fire regen failed: {2}", site.Location, species.Name, !sufficientLight ? "insufficient light" : "didn't establish"); } } } } } serotiny[site].SetAll(false); bool speciesResprouted = false; if (!serotinyOccurred) { for (int index = 0; index < speciesDataset.Count; ++index) { if (resprout[site].Get(index)) { ISpecies species = speciesDataset[index]; sufficientLight = SufficientLight(species, site); if (sufficientLight && (Util.Random.GenerateUniform() < species.VegReprodProb)) { AddNewCohort(species, site); speciesResprouted = true; if (isDebugEnabled) { log.DebugFormat("site {0}: {1} resprouted", site.Location, species.Name); } } else { if (isDebugEnabled) { log.DebugFormat("site {0}: {1} resprouting failed: {2}", site.Location, species.Name, !sufficientLight ? "insufficient light" : "random # >= probability"); } } } } } resprout[site].SetAll(false); return(plantingOccurred || serotinyOccurred || speciesResprouted); }
//--------------------------------------------------------------------- /// <summary> /// Does the appropriate forms of reproduction at a site. /// </summary> public static void Reproduce(ActiveSite site) { if (noEstablish[site]) { return; } bool plantingOccurred = planting.TryAt(site); //bool plantingOccurred = false; //for (int index = 0; index < speciesDataset.Count; ++index) //{ // if (planting[site].Get(index)) // { // ISpecies species = speciesDataset[index]; // if (PlantingEstablish(species, site)) // { // AddNewCohort(species, site); // plantingOccurred = true; // } // } //} bool sufficientLight; bool serotinyOccurred = false; if (!plantingOccurred) { for (int index = 0; index < speciesDataset.Count; ++index) { if (serotiny[site].Get(index)) { ISpecies species = speciesDataset[index]; sufficientLight = SufficientResources(species, site); if (sufficientLight && Establish(species, site)) { AddNewCohort(species, site); serotinyOccurred = true; if (isDebugEnabled) { log.DebugFormat("site {0}: {1} post-fire regenerated", site.Location, species.Name); } } else { if (isDebugEnabled) { log.DebugFormat("site {0}: {1} post-fire regen failed: {2}", site.Location, species.Name, !sufficientLight ? "insufficient light" : "didn't establish"); } } } } } serotiny[site].SetAll(false); bool speciesResprouted = false; if (!serotinyOccurred) { for (int index = 0; index < speciesDataset.Count; ++index) { if (resprout[site].Get(index)) { ISpecies species = speciesDataset[index]; sufficientLight = SufficientResources(species, site); if (sufficientLight && (Model.Core.GenerateUniform() < species.VegReprodProb)) { AddNewCohort(species, site); speciesResprouted = true; if (isDebugEnabled) { log.DebugFormat("site {0}: {1} resprouted", site.Location, species.Name); } } else { if (isDebugEnabled) { log.DebugFormat("site {0}: {1} resprouting failed: {2}", site.Location, species.Name, !sufficientLight ? "insufficient light" : "random # >= probability"); } } } } } resprout[site].SetAll(false); if (!plantingOccurred && !serotinyOccurred && !speciesResprouted) { seeding.Do(site); } }