//--------------------------------------------------------------------- /// <summary> /// Combines all young cohorts into a single cohort whose age is the /// succession timestep - 1 and whose biomass is the sum of all the /// biomasses of the young cohorts. /// </summary> /// <remarks> /// The age of the combined cohort is set to the succession timestep - /// 1 so that when the combined cohort undergoes annual growth, its /// age will end up at the succession timestep. /// <p> /// For this method, young cohorts are those whose age is less than or /// equal to the succession timestep. We include the cohort whose age /// is equal to the timestep because such a cohort is generated when /// reproduction occurs during a succession timestep. /// </remarks> public void CombineYoungCohorts() { // Work from the end of cohort data since the array is in old-to- // young order. int youngCount = 0; float totalWoodBiomass = 0; float totalLeafBiomass = 0; for (int i = cohortData.Count - 1; i >= 0; i--) { CohortData data = cohortData[i]; if (data.Age <= Cohorts.SuccessionTimeStep) { youngCount++; totalWoodBiomass += data.WoodBiomass; totalLeafBiomass += data.LeafBiomass; } else { break; } } if (youngCount > 0) { cohortData.RemoveRange(cohortData.Count - youngCount, youngCount); cohortData.Add(new CohortData((ushort)(Cohorts.SuccessionTimeStep - 1), totalWoodBiomass, totalLeafBiomass)); } }
//--------------------------------------------------------------------- public void RemoveCohort(Cohort cohort, ActiveSite site, ExtensionType disturbanceType) { CohortData thisCohortData = cohort.Data; int index = cohortData.IndexOf(thisCohortData); RemoveCohort(index, cohort, site, disturbanceType); }
//--------------------------------------------------------------------- public Cohort(ISpecies species, CohortData cohortData) { this.species = species; this.data = cohortData; }