public void RemoveMarkedCohorts(ISpeciesCohortsDisturbance disturbance) { foreach (var i in all_species) { i.RemoveMarkedCohorts(disturbance); } }
//--------------------------------------------------------------------- public void DamageBy(ISpeciesCohortsDisturbance disturbance) { // Go through list of species cohorts from back to front so that // a removal does not mess up the loop. for (int i = cohorts.Count - 1; i >= 0; i--) { cohorts[i].DamageBy(disturbance); if (cohorts[i].Count == 0) { cohorts.RemoveAt(i); } } }
//--------------------------------------------------------------------- public virtual void RemoveMarkedCohorts(ISpeciesCohortsDisturbance disturbance) { // Go through list of species cohorts from back to front so that // a removal does not mess up the loop. for (int i = spp_cohorts.Count - 1; i >= 0; i--) { spp_cohorts[i].RemoveCohorts(disturbance); if (spp_cohorts[i].Count == 0) { spp_cohorts.RemoveAt(i); } } }
void ISiteCohorts.RemoveMarkedCohorts(ISpeciesCohortsDisturbance disturbance) { /* * if (AgeOnlyDisturbanceEvent != null) * { * AgeOnlyDisturbanceEvent(this, new Landis.Library.BiomassCohorts.DisturbanceEventArgs(disturbance.CurrentSite, disturbance.Type)); * } */ // Does this only occur when a site is disturbed? //Allocation.ReduceDeadPools(this, disturbance.Type); // Go through list of species cohorts from back to front so that // a removal does not mess up the loop. int totalReduction = 0; List <Cohort> ToRemove = new List <Cohort>(); SpeciesCohortBoolArray isSpeciesCohortDamaged = new SpeciesCohortBoolArray(); foreach (ISpecies spc in cohorts.Keys) { Landis.Library.DensityCohorts.SpeciesCohorts speciescohort = GetSpeciesCohort(cohorts[spc]); isSpeciesCohortDamaged.SetAllFalse(speciescohort.Count); disturbance.MarkCohortsForDeath(speciescohort, isSpeciesCohortDamaged); for (int c = 0; c < isSpeciesCohortDamaged.Count; c++) { if (isSpeciesCohortDamaged[c]) { totalReduction += speciescohort[c].Treenumber; ToRemove.Add(cohorts[spc][c]); // ToRemove.AddRange(cohorts[spc].Where(o => o.Age == speciescohort[c].Age)); } } } foreach (Cohort cohort in ToRemove) { Landis.Library.DensityCohorts.Cohort.KilledByAgeOnlyDisturbance(disturbance, cohort, disturbance.CurrentSite, disturbance.Type); RemoveCohort(cohort, disturbance.Type); } }
//--------------------------------------------------------------------- /// <summary> /// Removes the cohorts which are damaged by a disturbance. /// </summary> public void MarkCohorts(ISpeciesCohortsDisturbance disturbance) { isSpeciesCohortDamaged.SetAllFalse(Count); disturbance.RemoveCohort(this, isSpeciesCohortDamaged); // Go backwards through list of ages, so the removal of an age // doesn't mess up the loop. isMaturePresent = false; for (int i = ages.Count - 1; i >= 0; i--) { if (isSpeciesCohortDamaged[i]) { ICohort cohort = new Cohort(species, ages[i]); ages.RemoveAt(i); Cohort.Died(this, cohort, disturbance.CurrentSite, disturbance.Type); } else if (ages[i] >= species.Maturity) { isMaturePresent = true; } } }
//--------------------------------------------------------------------- /// <summary> /// Removes the cohorts which are damaged by a disturbance. /// </summary> public void RemoveCohorts(ISpeciesCohortsDisturbance disturbance) { isSpeciesCohortDamaged.SetAllFalse(Count); disturbance.MarkCohortsForDeath(this, isSpeciesCohortDamaged); // Go backwards through list of ages, so the removal of an age // doesn't mess up the loop. isMaturePresent = false; for (int i = ages.Count - 1; i >= 0; i--) { if (isSpeciesCohortDamaged[i]) { ICohort cohort = new Cohort(species, ages[i]); ages.RemoveAt(i); Cohort.Died(this, cohort, disturbance.CurrentSite, disturbance.Type); } else if (ages[i] >= species.Maturity) isMaturePresent = true; } }
internal void RemoveMarkedCohorts(ISpeciesCohortsDisturbance disturbance) { throw new NotImplementedException(); }
//--------------------------------------------------------------------- public void MarkCohortsForDeath(ISpeciesCohortsDisturbance disturbance) { // Go through list of species cohorts from back to front so that // a removal does not mess up the loop. for (int i = cohorts.Count - 1; i >= 0; i--) { cohorts[i].MarkCohorts(disturbance); if (cohorts[i].Count == 0) cohorts.RemoveAt(i); } }
//--------------------------------------------------------------------- public virtual void RemoveMarkedCohorts(ISpeciesCohortsDisturbance disturbance) { // Go through list of species cohorts from back to front so that // a removal does not mess up the loop. for (int i = spp_cohorts.Count - 1; i >= 0; i--) { spp_cohorts[i].RemoveCohorts(disturbance); if (spp_cohorts[i].Count == 0) spp_cohorts.RemoveAt(i); } }