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

        /// <summary>
        /// Does cohort reproduction at certain specified sites.
        /// </summary>
        /// <param name="sites">
        /// The sites where cohort reproduction should be done.
        /// </param>
        /// <remarks>
        /// Because this is the last stage of succession during a timestep,
        /// the NextTimeToRun is updated after all the sites are processed.
        /// </remarks>
        public void ReproduceCohorts(IEnumerable <ActiveSite> sites)
        {
            logger.Debug(string.Format("{0:G}", DateTime.Now));
            int maxGeneration = GC.MaxGeneration;

            for (int generation = 0; generation <= maxGeneration; generation++)
            {
                logger.Debug(string.Format("  gen {0}: {1}", generation,
                                           GC.CollectionCount(generation)));
            }

            ProgressBar progressBar = null;

            if (ShowProgress)
            {
                System.Console.WriteLine("Cohort reproduction ...");
                prevSiteDataIndex = null;
                progressBar       = Landis.Model.iui.CreateProgressMeter(Model.Core.Landscape.ActiveSiteCount); // NewProgressBar();
            }

            foreach (ActiveSite site in sites)
            {
                Reproduction.Reproduce(site);

                /*#if WATCH_CHANGING_GC
                 *              bool collectionCountChanged = false;
                 *              for (int generation = 0; generation <= maxGeneration; generation++) {
                 *                  int currentCount = GC.CollectionCount(generation);
                 *                  if (collectionCounts[generation] != currentCount) {
                 *                      collectionCountChanged = true;
                 *                      collectionCounts[generation] = currentCount;
                 *                  }
                 *              }
                 *              if (collectionCountChanged) {
                 *                  logger.Info(string.Format("Site {0}, index = {1}", site.Location, site.DataIndex));
                 *                  for (int generation = 0; generation <= maxGeneration; generation++)
                 *                      logger.Info(string.Format("  gen {0}: {1}", generation, collectionCounts[generation]));
                 *              }
                 #endif*/
                if (ShowProgress)
                {
                    Update(progressBar, site.DataIndex);
                }
            }
            if (ShowProgress)
            {
                CleanUp(progressBar);
            }

            logger.Debug(string.Format("{0:G}", DateTime.Now));
            for (int generation = 0; generation <= maxGeneration; generation++)
            {
                logger.Debug(string.Format("  gen {0}: {1}", generation,
                                           GC.CollectionCount(generation)));
            }
        }
コード例 #2
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Does cohort reproduction at certain specified sites.
        /// </summary>
        /// <param name="sites">
        /// The sites where cohort reproduction should be done.
        /// </param>
        /// <remarks>
        /// Because this is the last stage of succession during a timestep,
        /// the NextTimeToRun is updated after all the sites are processed.
        /// </remarks>
        public void ReproduceCohorts(IEnumerable <ActiveSite> sites)
        {
            logger.Debug(string.Format("{0:G}", DateTime.Now));
            int maxGeneration = GC.MaxGeneration;

            for (int generation = 0; generation <= maxGeneration; generation++)
            {
                logger.Debug(string.Format("  gen {0}: {1}", generation,
                                           GC.CollectionCount(generation)));
            }

            ProgressBar progressBar = null;

            if (ShowProgress)
            {
                System.Console.WriteLine("Cohort reproduction ...");
                prevSiteDataIndex = null;
                progressBar       = Model.Core.UI.CreateProgressMeter(Model.Core.Landscape.ActiveSiteCount); // NewProgressBar();
            }

            foreach (ActiveSite site in sites)
            {
                Reproduction.Reproduce(site);

                if (ShowProgress)
                {
                    Update(progressBar, site.DataIndex);
                }
            }
            if (ShowProgress)
            {
                CleanUp(progressBar);
            }

            logger.Debug(string.Format("{0:G}", DateTime.Now));
            for (int generation = 0; generation <= maxGeneration; generation++)
            {
                logger.Debug(string.Format("  gen {0}: {1}", generation,
                                           GC.CollectionCount(generation)));
            }
        }