• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ICohort类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ICohort的典型用法代码示例。如果您正苦于以下问题:C# ICohort类的具体用法?C# ICohort怎么用?C# ICohort使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ICohort类属于命名空间,在下文中一共展示了ICohort类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SetResorbedNallocation

        //---------------------------------------------------------------------
        // Method for setting the available resorbed N for each cohort.
        // Amount of resorbed N must be in units of g N m-2.
        public static void SetResorbedNallocation(ICohort cohort, double resorbedNallocation, ActiveSite site)
        {
            int cohortAddYear = GetAddYear(cohort); 
            //PlugIn.ModelCore.UI.WriteLine("SETResorbedNallocation: year={0}, mo={1}, species={2}, cohortAge={3}, cohortAddYear={4}.", PlugIn.ModelCore.CurrentTime, Century.Month, cohort.Species.Name, cohort.Age, cohortAddYear);
            Dictionary<int, double> cohortDict;
            double oldResorbedNallocation;


            // If the dictionary entry exists for the cohort, overwrite it:
            if (SiteVars.CohortResorbedNallocation[site].TryGetValue(cohort.Species.Index, out cohortDict))
                if (cohortDict.TryGetValue(cohortAddYear, out oldResorbedNallocation))
                {
                    SiteVars.CohortResorbedNallocation[site][cohort.Species.Index][cohortAddYear] = resorbedNallocation;
                    return;
                }

            // If the dictionary does not exist for the cohort, create it:
            Dictionary<int, double> newEntry = new Dictionary<int, double>();
            newEntry.Add(cohortAddYear, resorbedNallocation);

            if (SiteVars.CohortResorbedNallocation[site].ContainsKey(cohort.Species.Index))
            {
                SiteVars.CohortResorbedNallocation[site][cohort.Species.Index].Add(cohortAddYear, resorbedNallocation);
            }
            else
            {
                SiteVars.CohortResorbedNallocation[site].Add(cohort.Species.Index, newEntry);
            }

            //PlugIn.ModelCore.UI.WriteLine("SET ResorbedNallocation: ResorbedNallocation={0:0.00000}.", resorbedNallocation);
            return;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extension-Century-Succession,代码行数:35,代码来源:AvailableN.cs


示例2:

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

        float[] IDisturbance.ReduceOrKillMarkedCohort(ICohort cohort)
        {
            float reduction;
            float[] leafWoodReduction = new float[2]{0F, 0F};
            
            if (reductions[cohort.Species.Index].TryGetValue(cohort.Age, out reduction)) {
            
                leafWoodReduction[0] = cohort.WoodBiomass / (cohort.LeafBiomass + cohort.WoodBiomass) * (float) reduction;
                leafWoodReduction[1] = cohort.LeafBiomass / (cohort.LeafBiomass + cohort.WoodBiomass) * (float) reduction;
                
                SiteVars.BiomassRemoved[currentSite] += (int) reduction;
                SiteVars.CohortsPartiallyDamaged[currentSite]++;

                if (originalStand.LastPrescription.PreventEstablishment)
                {
                    numberCohortsReduced++;
                    capacityReduction += (double)reduction / (double)cohort.Biomass;
                }
                // Record any cohort touched, not just killed:
                BaseHarvest.SiteVars.Stand[currentSite].UpdateDamageTable(cohort.Species.Name);
                
                return leafWoodReduction;
            }
            else
                return leafWoodReduction;
        }
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:28,代码来源:PartialHarvestDisturbance.cs


示例3:

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

        int IDisturbance.ReduceOrKillMarkedCohort(ICohort cohort)
        {
            int reduction;
            if (reductions[cohort.Species.Index].TryGetValue(cohort.Age, out reduction))
            {

                int litter = cohort.ComputeNonWoodyBiomass(currentSite);
                int woody = reduction - litter;

                SiteVars.BiomassRemoved[currentSite] += reduction;
                SiteVars.WoodyDebris[currentSite].Mass += woody;
                SiteVars.Litter[currentSite].Mass += litter;

                SiteVars.CohortsPartiallyDamaged[currentSite]++;

                if (originalStand.LastPrescription.PreventEstablishment)
                {
                    numberCohortsReduced++;
                    capacityReduction += (double) reduction / (double) cohort.Biomass;
                }

                // Record any cohort touched, not just killed:
                BaseHarvest.SiteVars.Stand[currentSite].UpdateDamageTable(cohort.Species.Name);

                BaseHarvest.SiteVars.Stand[currentSite].RecordBiomassRemoved(cohort.Species, reduction);

                return reduction;
            }
            else
                return 0;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Disturbance,代码行数:33,代码来源:PartialHarvestDisturbance.cs


示例4: Damage

 //---------------------------------------------------------------------
 public ushort Damage(ICohort cohort)
 {
     if (ageCohortDisturbance.Damage(cohort))
         return cohort.Biomass;
     else
         return 0;
 }
开发者ID:LANDIS-II-Foundation,项目名称:Library-Biomass-Cohort,代码行数:8,代码来源:WrappedDisturbance.cs


示例5:

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

        int IDisturbance.Damage(ICohort cohort)
        {
            int reduction;
            if (reductions[cohort.Species.Index].TryGetValue(cohort.Age, out reduction))
            {

                //UI.WriteLine("Removing:  {0:0.0}/{1:0.0}.", reduction, cohort.Biomass);

                SiteVars.BiomassRemoved[currentSite] += reduction;

                SiteVars.CohortsPartiallyDamaged[currentSite]++;

                if (originalStand.LastPrescription.PreventEstablishment)
                {
                    numberCohortsReduced++;
                    capacityReduction += (double) reduction / (double) cohort.Biomass;
                }

                // Record any cohort touched, not just killed:
                BaseHarvest.SiteVars.Stand[currentSite].UpdateDamageTable(cohort.Species.Name);

                return reduction;
            }
            else
                return 0;
        }
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:28,代码来源:PartialHarvestDisturbance.cs


示例6: CohortBiomass

 public CohortBiomass(ActiveSite Site, ICohort Cohort, int Index)
 {
     this.cohort = Cohort;
     fRad = 0;
     site = Site;
     spc = Cohort.Species;
 }
开发者ID:LANDIS-II-Foundation,项目名称:Extension-PnET-Succession,代码行数:7,代码来源:CohortBiomass.cs


示例7:

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

            ushort IDisturbance.Damage(ICohort cohort)
            {
                if (5 <= cohort.Age && cohort.Age <= 30)
                    return cohort.Biomass;
                else
                    return 0;
            }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:9,代码来源:CohortDeath_Test.cs


示例8: ReduceCohortGrowth

        //---------------------------------------------------------------------
        // This method replaces the delegate method.  It is called every year when
        // ACT_ANPP is calculated, for each cohort.  Therefore, this method is operating at
        // an ANNUAL time step and separate from the normal extension time step.

        public static double ReduceCohortGrowth(ICohort cohort, ActiveSite site)//, int siteBiomass)
        {
            // PlugIn.ModelCore.UI.WriteLine("   Calculating cohort growth reduction due to insect defoliation...");

            double summaryGrowthReduction = 0.0;

            int sppIndex = cohort.Species.Index;

            foreach(IInsect insect in PlugIn.ManyInsect)
            {
                if(!insect.ActiveOutbreak)
                    continue;

                int suscIndex = insect.SppTable[sppIndex].Susceptibility - 1;
                //if (suscIndex < 0) suscIndex = 0;

                int yearBack = 0;
                double annualDefoliation = 0.0;

                if(insect.HostDefoliationByYear[site].ContainsKey(PlugIn.ModelCore.CurrentTime - yearBack))
                {
                    // PlugIn.ModelCore.UI.WriteLine("Host Defoliation By Year:  Time={0}, suscIndex={1}, spp={2}.", (PlugIn.ModelCore.CurrentTime - yearBack), suscIndex+1, cohort.Species.Name);
                    annualDefoliation += insect.HostDefoliationByYear[site][PlugIn.ModelCore.CurrentTime - yearBack][suscIndex];
                }
                double cumulativeDefoliation = annualDefoliation;

                while(annualDefoliation > 0)
                {
                    yearBack++;
                    annualDefoliation = 0.0;
                    if(insect.HostDefoliationByYear[site].ContainsKey(PlugIn.ModelCore.CurrentTime - yearBack))
                    {
                        // PlugIn.ModelCore.UI.WriteLine("Host Defoliation By Year:  Time={0}, suscIndex={1}, spp={2}.", (PlugIn.ModelCore.CurrentTime - yearBack), suscIndex+1, cohort.Species.Name);
                        annualDefoliation = insect.HostDefoliationByYear[site][PlugIn.ModelCore.CurrentTime - yearBack][suscIndex];
                        cumulativeDefoliation += annualDefoliation;
                    }
                }

                double slope = insect.SppTable[sppIndex].GrowthReduceSlope;
                double intercept = insect.SppTable[sppIndex].GrowthReduceIntercept;


                double growthReduction = 1.0 - (cumulativeDefoliation * slope + intercept);

                summaryGrowthReduction += growthReduction;
                // PlugIn.ModelCore.UI.WriteLine("Time={0}, Spp={1}, SummaryGrowthReduction={2:0.00}.", PlugIn.ModelCore.CurrentTime,cohort.Species.Name, summaryGrowthReduction);

            }
            if (summaryGrowthReduction > 1.0)  // Cannot exceed 100%
                summaryGrowthReduction = 1.0;

            if(summaryGrowthReduction > 1.0 || summaryGrowthReduction < 0)
            {
                 PlugIn.ModelCore.UI.WriteLine("Cohort Total Growth Reduction = {0:0.00}.  Site R/C={1}/{2}.", summaryGrowthReduction, site.Location.Row, site.Location.Column);
                throw new ApplicationException("Error: Total Growth Reduction is not between 1.0 and 0.0");
            }

            return summaryGrowthReduction;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Disturbance,代码行数:64,代码来源:GrowthReduction.cs


示例9: ComputeChange

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

        public int ComputeChange(ICohort    cohort,
                                 ActiveSite site,
                                 int        siteBiomass,
                                 int        prevYearSiteMortality)
        {
            CountCalled++;
            return Change;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:10,代码来源:MockCalculator.cs


示例10: DeathEventArgs

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

        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        public DeathEventArgs(ICohort cohort,
                              ActiveSite site,
                              ExtensionType disturbanceType)
        {
            this.cohort = cohort;
            this.site = site;
            this.disturbanceType = disturbanceType;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:13,代码来源:DeathEventArgs.cs


示例11: Died

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

        /// <summary>
        /// Raises a Cohort.DeathEvent.
        /// </summary>
        public static void Died(object     sender,
                                ICohort    cohort,
                                ActiveSite site,
                                ExtensionType disturbanceType)
        {
            if (DeathEvent != null)
                DeathEvent(sender, new DeathEventArgs(cohort, site, disturbanceType));
        }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:13,代码来源:Cohort.cs


示例12: DefoliateCohort

        //---------------------------------------------------------------------
        // This method replaces the delegate method.  It is called every year when
        // ACT_ANPP is calculated, for each cohort.  Therefore, this method is operating at
        // an ANNUAL time step and separate from the normal extension time step.

        public static double DefoliateCohort(ICohort cohort, ActiveSite site, int siteBiomass)
        {
            // This maintains backwards compatibility with succession versions that don't use Biomass Library
            // but the functions must be sure to provide siteBiomass not cohortBiomass
            double defoliation = Landis.Extension.Insects.Defoliate.DefoliateCohort(site, cohort.Species, cohort.Biomass, siteBiomass);
            return defoliation;
           
        }
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:13,代码来源:Defoliate.cs


示例13: MyCompute

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

        public double MyCompute(ICohort    cohort,
                                ActiveSite site,
                                int        siteBiomass)
        {
            Assert.AreEqual(myCohort, cohort);
            Assert.AreEqual(myActiveSite, site);
            Assert.AreEqual(mySiteBiomass, siteBiomass);
            myComputeCalled = true;
            return myComputeResult;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:12,代码来源:CohortDefoliation_Test.cs


示例14: ReduceOrKillMarkedCohort

 public int ReduceOrKillMarkedCohort(ICohort cohort)
 {
     if (ageCohortDisturbance.MarkCohortForDeath(cohort)) {
         Cohort.KilledByAgeOnlyDisturbance(this, cohort,
                                           ageCohortDisturbance.CurrentSite,
                                           ageCohortDisturbance.Type);
         return (int)cohort.Wood;
     }
     else
         return 0;
 }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:11,代码来源:WrappedDisturbance.cs


示例15: AddResorbedN

        //, int month)
        //---------------------------------------------------------------------
        public static void AddResorbedN(ICohort cohort,  double leafBiomass, ActiveSite site)
        {
            // Resorbed N:  We are assuming that any leaves dropped as a function of normal
            // growth and maintenance (e.g., fall senescence) will involve resorption of leaf N.
            double resorbedN = AvailableN.CalculateResorbedN(site, cohort.Species, leafBiomass); //, month);
            double previouslyResorbedN = GetResorbedNallocation(cohort);

            AvailableN.SetResorbedNallocation(cohort, resorbedN + previouslyResorbedN);

            return;
        }
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:13,代码来源:AvailableN.cs


示例16: Damage

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

        public ushort Damage(ICohort cohort)
        {
            if (ageCohortDisturbance.Damage(cohort)) {
                Cohort.KilledByAgeOnlyDisturbance(this, cohort,
                                                  ageCohortDisturbance.CurrentSite,
                                                  ageCohortDisturbance.Type);
                return cohort.Biomass;
            }
            else
                return 0;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:13,代码来源:WrappedDisturbance.cs


示例17: Record

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

        // Interface method for biomass disturbances

        int IDisturbance.ReduceOrKillMarkedCohort(ICohort cohort)
        {
            int reduction = 0;
            SpecificAgesCohortSelector specificAgeCohortSelector;
            if (partialCohortSelectors.TryGetValue(cohort.Species, out specificAgeCohortSelector))
            {
                Percentage percentage;
                if (specificAgeCohortSelector.Selects(cohort, out percentage))
                    reduction = (int)(percentage * cohort.Biomass);
            }
            Record(reduction, cohort);
            return reduction;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:17,代码来源:BiomassCohortHarvest.cs


示例18: Record

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

        protected override void Record(int     reduction,
                                       ICohort cohort)
        {
            if (SiteLog.Enabled)
            {
                SiteLog.RecordHarvest(cohort.Species, reduction);
                if (isDebugEnabled)
                    log.DebugFormat("    {0}, age {1}, biomass {2} : reduction = {3}",
                                    cohort.Species.Name,
                                    cohort.Age,
                                    cohort.Biomass,
                                    reduction);
            }
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Disturbance,代码行数:16,代码来源:PartialCohortHarvest.cs


示例19: GetResorbedNallocation

        public static Dictionary<int, Dictionary<int, double>> CohortMineralNallocation;  //calculated monthly
        //public static Dictionary<int, Dictionary<int, double>> CohortResorbedNallocation;

        //---------------------------------------------------------------------
        // Method for retrieving the available resorbed N for each cohort.
        // Return amount of resorbed N in g N m-2.
        public static double GetResorbedNallocation(ICohort cohort, ActiveSite site)
        {
            int cohortAddYear = GetAddYear(cohort); 
            //PlugIn.ModelCore.UI.WriteLine("GETResorbedNallocation: year={0}, mo={1}, species={2}, cohortAge={3}, cohortAddYear={4}.", PlugIn.ModelCore.CurrentTime, Century.Month, cohort.Species.Name, cohort.Age, cohortAddYear);
            double resorbedNallocation = 0.0;
            Dictionary<int, double> cohortDict;
            
            if (SiteVars.CohortResorbedNallocation[site].TryGetValue(cohort.Species.Index, out cohortDict))
                cohortDict.TryGetValue(cohortAddYear, out resorbedNallocation);

            //PlugIn.ModelCore.UI.WriteLine("GETResorbedNallocation: year={0}, mo={1}, species={2}, cohortAge={3}, cohortAddYear={4}.", PlugIn.ModelCore.CurrentTime, Century.Month, cohort.Species.Name, cohort.Age, cohortAddYear);

            return resorbedNallocation;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extension-Century-Succession,代码行数:20,代码来源:AvailableN.cs


示例20:

        //---------------------------------------------------------------------
        int IDisturbance.ReduceOrKillMarkedCohort(ICohort cohort)
        {
            int reduction;
            if (reductions[cohort.Species.Index].TryGetValue(cohort.Age, out reduction))
            {

                //SiteVars.BiomassRemoved[currentSite] += reduction;
                //SiteVars.CohortsPartiallyDamaged[currentSite]++;

                return reduction;
            }
            else
            return 0;
        }
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:15,代码来源:PartialDisturbance.cs



注:本文中的ICohort类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ICollection类代码示例发布时间:2022-05-24
下一篇:
C# ICodeWriter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap