コード例 #1
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Grows the current cohort for one year.
        /// </summary>
        /// <param name="site">
        /// The site where the cohort is 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="prevYearMortality">
        /// The total mortality at the site during the previous year.
        /// </param>
        /// <returns>
        /// The total mortality (excluding annual leaf litter) for the current
        /// cohort.
        /// </returns>
        public int GrowCurrentCohort(ActiveSite site,
                                     ref int siteBiomass,
                                     int prevYearMortality)
        {
            if (currentCohortAge == 0)
            {
                throw new InvalidOperationException("Iterator has no current cohort");
            }

            int cohortMortality;

            nextIndex = cohorts.GrowCohort(index, site, ref siteBiomass,
                                           prevYearMortality, out cohortMortality);
            return(cohortMortality);
        }
コード例 #2
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Grows the current cohort for one year.
        /// </summary>
        /// <param name="site">
        /// The site where the cohort is 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="prevYearMortality">
        /// The total mortality at the site during the previous year.
        /// </param>
        /// <returns>
        /// The total mortality (excluding annual leaf litter) for the current
        /// cohort.
        /// </returns>
        public int GrowCurrentCohort(ActiveSite site,
                                     ref int siteBiomass,
                                     int prevYearMortality)
        {
            if (!index.HasValue)
            {
                throw NoCurrentCohortException();
            }

            int cohortMortality;

            nextIndex = cohorts.GrowCohort(index.Value, site, ref siteBiomass,
                                           prevYearMortality, out cohortMortality);
            currentCohortDied = (nextIndex == index.Value);
            return(cohortMortality);
        }