//---------------------------------------------------------------------

        /// <summary>
        /// Computes how much a disturbance damages the cohorts by reducing
        /// their biomass.
        /// </summary>
        /// <returns>
        /// The total of all the cohorts' biomass reductions.
        /// </returns>
        public int DamageBy(IDisturbance disturbance)
        {
            //  Go backwards through list of cohort data, so the removal of an
            //  item doesn't mess up the loop.
            isMaturePresent = false;
            int totalReduction = 0;

            for (int i = cohortData.Count - 1; i >= 0; i--)
            {
                Cohort cohort    = new Cohort(species, cohortData[i]);
                ushort reduction = disturbance.Damage(cohort);
                if (reduction > 0)
                {
                    totalReduction += reduction;
                    if (reduction < cohort.Biomass)
                    {
                        cohort.ChangeBiomass(-reduction);
                        cohortData[i] = cohort.Data;
                    }
                    else
                    {
                        RemoveCohort(i, cohort, disturbance.CurrentSite,
                                     disturbance.Type);
                        cohort = null;
                    }
                }
                if (cohort != null && cohort.Age >= species.Maturity)
                {
                    isMaturePresent = true;
                }
            }
            return(totalReduction);
        }
        //---------------------------------------------------------------------

        /// <summary>
        /// Grows an individual cohort for a year, incrementing its age by 1
        /// and updating its biomass for annual growth and mortality.
        /// </summary>
        /// <param name="index">
        /// The index of the cohort to grow; it must be between 0 and Count - 1.
        /// </param>
        /// <param name="site">
        /// The site where the species' cohorts are located.
        /// </param>
        /// <param name="siteBiomass">
        /// The total biomass at the site.  This parameter is changed by the
        /// same amount as the current cohort's biomass.
        /// </param>
        /// <param name="prevYearSiteMortality">
        /// The total mortality at the site during the previous year.
        /// </param>
        /// <param name="cohortMortality">
        /// The total mortality (excluding annual leaf litter) for the current
        /// cohort.
        /// </param>
        /// <returns>
        /// The index of the next younger cohort.  Note this may be the same
        /// as the index passed in if that cohort dies due to senescence.
        /// </returns>
        public int GrowCohort(int index,
                              ActiveSite site,
                              ref int siteBiomass,
                              int prevYearSiteMortality,
                              out int cohortMortality)
        {
            Debug.Assert(0 <= index && index <= cohortData.Count);
            Debug.Assert(site != null);

            Cohort cohort = new Cohort(species, cohortData[index]);

            Debug.Assert(cohort.Biomass <= siteBiomass);

            if (isDebugEnabled)
            {
                log.DebugFormat("  grow cohort: {0}, {1} yrs, {2} Mg/ha",
                                cohort.Species.Name, cohort.Age, cohort.Biomass);
            }

            //  Check for senescence
            if (cohort.Age >= species.Longevity)
            {
                siteBiomass    -= cohort.Biomass;
                cohortMortality = cohort.Biomass;
                RemoveCohort(index, cohort, site, null);
                return(index);
            }

            cohort.IncrementAge();
            int biomassChange = (int)Cohorts.BiomassCalculator.ComputeChange(cohort, site, siteBiomass, prevYearSiteMortality);

            //UI.WriteLine("B={0:0.00}, Age={1}, delta={2}", cohort.Biomass, cohort.Age, biomassChange);

            Debug.Assert(-(cohort.Biomass) <= biomassChange);  // Cohort can't loss more biomass than it has

            cohort.ChangeBiomass(biomassChange);
            siteBiomass += biomassChange;

            if (isDebugEnabled)
            {
                log.DebugFormat("    biomass: change = {0}, cohort = {1}, site = {2}",
                                biomassChange, cohort.Biomass, siteBiomass);
            }

            cohortMortality = Cohorts.BiomassCalculator.MortalityWithoutLeafLitter;
            if (cohort.Biomass > 0)
            {
                cohortData[index] = cohort.Data;
                return(index + 1);
            }
            else
            {
                RemoveCohort(index, cohort, site, null);
                return(index);
            }
        }
        //---------------------------------------------------------------------

        /// <summary>
        /// Grows an individual cohort for a year, incrementing its age by 1
        /// and updating its biomass for annual growth and mortality.
        /// </summary>
        /// <param name="index">
        /// The index of the cohort to grow; it must be between 0 and Count - 1.
        /// </param>
        /// <param name="site">
        /// The site where the species' cohorts are located.
        /// </param>
        /// <param name="siteBiomass">
        /// The total biomass at the site.  This parameter is changed by the
        /// same amount as the current cohort's biomass.
        /// </param>
        /// <param name="prevYearSiteMortality">
        /// The total mortality at the site during the previous year.
        /// </param>
        /// <param name="cohortMortality">
        /// The total mortality (excluding annual leaf litter) for the current
        /// cohort.
        /// </param>
        /// <returns>
        /// The index of the next younger cohort.  Note this may be the same
        /// as the index passed in if that cohort dies due to senescence.
        /// </returns>
        public int GrowCohort(int index,
                              ActiveSite site,
                              ref int siteBiomass,
                              int prevYearSiteMortality,
                              out int cohortMortality)
        {
            Debug.Assert(0 <= index && index <= cohortData.Count);
            Debug.Assert(site != null);

            Cohort cohort = new Cohort(species, cohortData[index]);

            //  Check for senescence
            if (cohort.Age >= species.Longevity)
            {
                siteBiomass    -= cohort.Biomass;
                cohortMortality = cohort.Biomass;
                cohortData.RemoveAt(index);
                Cohorts.CohortDeath(cohort, site);
                return(index);
            }

            cohort.IncrementAge();
            int biomassChange = Cohorts.BiomassCalculator.ComputeChange(cohort, site, siteBiomass, prevYearSiteMortality);

            cohort.ChangeBiomass(biomassChange);
            siteBiomass    += biomassChange;
            cohortMortality = Cohorts.BiomassCalculator.MortalityWithoutLeafLitter;
            if (cohort.Biomass > 0)
            {
                cohortData[index] = cohort.Data;
                return(index + 1);
            }
            else
            {
                cohortData.RemoveAt(index);
                Cohorts.CohortDeath(cohort, site);
                return(index);
            }
        }