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

C# ICommunity类代码示例

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

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



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

示例1: SiteConditions

        public SiteConditions(ActiveSite site, ICommunity initialCommunity)
        {
            cohorts = new SiteCohorts();

            canopy = new Canopy();
            if (PlugIn.HasSiteOutput[site] == true)
            {
                siteoutput = new SiteOutput(site);
                estoutput = new EstablishmentOutput(site);
            }

            this.site = site;

            foreach (ISpecies spc in PlugIn.modelCore.Species)
            {
                deadcohortages[spc] = new List<int>();
            }

            uint key = ComputeKey(initialCommunity.MapCode, PlugIn.ModelCore.Ecoregion[site].MapCode);

            SiteConditions s = GetFromKey(key);

            if (s != null) return;

            //  If we don't have a sorted list of age cohorts for the initial
            //  community, make the list

            List<Landis.Library.AgeOnlyCohorts.ICohort> sortedAgeCohorts;
            if (!sortedCohorts.TryGetValue(initialCommunity.MapCode, out sortedAgeCohorts))
            {
                sortedAgeCohorts = PlugIn.RankCohortAgesOldToYoung(initialCommunity.Cohorts);
                sortedCohorts[initialCommunity.MapCode] = sortedAgeCohorts;
            }
            hydrology = new Hydrology(PlugIn.modelCore.Ecoregion[site]);
            forestfloor = new ForestFloor();
            cohorts = new SiteCohorts();
            establishment = new EstablishmentProbability(site);

            if (sortedAgeCohorts.Count == 0) return;

            //PlugIn.ModelCore.UI.WriteLine("Making Biomass Cohorts "+ site);
            BiomassSpinUp(sortedAgeCohorts, site);

            initialSites[key] = this;
            return;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extension-PnET-Succession,代码行数:46,代码来源:SiteConditions.cs


示例2: DefineConference

 private static Conference DefineConference(ICommunity community, Catalog catalog, string name, string imageUrl, DateTime startDate, DateTime endDate, string city)
 {
     var conference = community.AddFact(new Conference());
     var header = community.AddFact(new ConferenceHeader(catalog, conference));
     header.Name = name;
     header.ImageUrl = imageUrl;
     header.StartDate = startDate;
     header.EndDate = endDate;
     header.City = city;
     header.Address = "111 Main Street";
     header.HomePageUrl = "awesomefest.com";
     header.Description.SetString(
         "Awesomeness!! Go to AwesomeFest!!!",
         value => header.Description = value,
         community);
     return conference;
 }
开发者ID:michaellperry,项目名称:MyCon,代码行数:17,代码来源:ConferenceViewModelFactory.cs


示例3: Create

        public static ConferenceListViewModel Create(string environment, ICommunity community, ConferenceSelection conferenceSelection)
        {
            var catalog = community.AddFact(new Catalog(environment));

            if (LoadSampleData && !catalog.ConferenceHeaders.Ensure().Any())
            {
                DefineConference(
                    community,
                    catalog,
                    "Cowtown Code Camp 2013",
                    "http://cdn.marketplaceimages.windowsphone.com/v8/images/2a24b5e4-d79a-448e-8818-4040ff0d51a6?imageType=ws_icon_large",
                    new DateTime(2013, 3, 17),
                    new DateTime(2013, 3, 17),
                    "Fort Worth, TX");
                DefineConference(
                    community,
                    catalog,
                    "AwesomeFest 2014",
                    "http://files.g4tv.com/ImageDb3/284724_S/darth-vader-rock-guitarist.jpg",
                    new DateTime(2014, 2, 27),
                    new DateTime(2014, 2, 28),
                    "Allen, TX");
                var conference = DefineConference(
                    community,
                    catalog,
                    "That Conference 2013",
                    "http://www.thatconference.com/Images/mainLogo.png",
                    new DateTime(2013, 8, 16),
                    new DateTime(2013, 8, 19),
                    "Wisconsin Dells, WI");
                DefineConferenceSessions(community, conference);
            }

            Func<ConferenceHeader, ConferenceHeaderViewModel> makeConferenceHeaderViewModel =
                conferenceHeader =>
                    new ConferenceHeaderViewModel(conferenceHeader);

            return new ConferenceListViewModel(catalog, conferenceSelection, makeConferenceHeaderViewModel);
        }
开发者ID:michaellperry,项目名称:MyCon,代码行数:39,代码来源:ConferenceViewModelFactory.cs


示例4: DefineConferenceSessions

        private static void DefineConferenceSessions(ICommunity community, Conference conference)
        {
            var developer = community.AddFact(new Track(conference));
            developer.Name = "Developer";

            var michael = community.AddFact(new Speaker(conference));
            michael.Name = "Michael L Perry";
            michael.ImageUrl = "http://qedcode.com/extras/Perry_Headshot_Medium.jpg";
            michael.Contact = "@michaellperry";
            michael.Bio.SetString(
                "Software is math. Michael L Perry has built upon the works of mathematicians like Bertrand Meyer, James Rumbaugh, and Donald Knuth to develop a mathematical system for software development. He has captured this system in a set of open source projects, Update Controls and Correspondence. As a Principal Consultant at Improving Enterprises, he applies mathematical concepts to building scalable and robust enterprise systems. You can find out more at qedcode.com.",
                v => michael.Bio = v,
                community);

            var provable = community.AddFact(new Session(michael));
            provable.Title = "4 Ways to Prevent Code Abuse";
            provable.Description.SetString(
                "Your code is right. Other people are just using it wrong!" +
                "Learn 4 simple techniques to prevent people from using your code incorrectly. We'll apply those techniques to a class in the .NET Framework that is really easy to get wrong. By the time we're done, you'll have to try really hard to mess it up." +
                "Some APIs will throw exceptions when you get something wrong. That's not helpful! I'll show you how to write an API that guides you toward correct code. It won't even compile unless you get it right." +
                "These 4 techniques are built into the C# language today, so take advantage of them! Everybody on your team will thank you. And you'll spend less time fixing their bugs.",
                v => provable.Description = v,
                community);

            community.AddFact(new SessionTrack(provable, developer, new List<SessionTrack>()));

            var eight = community.AddFact(new Time(conference));
            eight.StartTime = new DateTime(2013, 7, 12, 8, 0, 0, DateTimeKind.Local);

            var room100 = community.AddFact(new Room(conference));
            room100.RoomNumber = "100";

            var room100AtEight = community.AddFact(new Slot(eight, room100));

            community.AddFact(new SessionSlot(provable, room100AtEight, new List<SessionSlot>()));
        }
开发者ID:michaellperry,项目名称:MyCon,代码行数:36,代码来源:ConferenceViewModelFactory.cs


示例5: InitializeSite

 //---------------------------------------------------------------------
 protected override void InitializeSite(ActiveSite site,
     ICommunity initialCommunity)
 {
     cohorts[site] = new SiteCohorts(initialCommunity.Cohorts);
 }
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:6,代码来源:PlugIn.cs


示例6: InitializeSite

        //---------------------------------------------------------------------
        protected override void InitializeSite(ActiveSite site,
                                               ICommunity initialCommunity)
        {
            InitialBiomass initialBiomass = InitialBiomass.Compute(site, initialCommunity);
            SiteVars.Cohorts[site] = InitialBiomass.Clone(initialBiomass.Cohorts); //.Clone();

            SiteVars.SurfaceDeadWood[site]       = initialBiomass.SurfaceDeadWood.Clone();
            SiteVars.SurfaceStructural[site]     = initialBiomass.SurfaceStructural.Clone();
            SiteVars.SurfaceMetabolic[site]      = initialBiomass.SurfaceMetabolic.Clone();

            SiteVars.SoilDeadWood[site]          = initialBiomass.SoilDeadWood.Clone();
            SiteVars.SoilStructural[site]        = initialBiomass.SoilStructural.Clone();
            SiteVars.SoilMetabolic[site]         = initialBiomass.SoilMetabolic.Clone();

            SiteVars.SOM1surface[site]           = initialBiomass.SOM1surface.Clone();
            SiteVars.SOM1soil[site]              = initialBiomass.SOM1soil.Clone();
            SiteVars.SOM2[site]                  = initialBiomass.SOM2.Clone();
            SiteVars.SOM3[site]                  = initialBiomass.SOM3.Clone();

            SiteVars.MineralN[site]              = initialBiomass.MineralN;
            SiteVars.CohortLeafC[site]           = initialBiomass.CohortLeafC;
            SiteVars.CohortLeafN[site]           = initialBiomass.CohortLeafN;
            SiteVars.CohortWoodC[site]           = initialBiomass.CohortWoodC;
            SiteVars.CohortWoodN[site]           = initialBiomass.CohortWoodN;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:26,代码来源:PlugIn.cs


示例7: InitializeSite

 //---------------------------------------------------------------------
 protected override void InitializeSite(ActiveSite site,
                                        ICommunity initialCommunity)
 {
     siteconditions[site] = new SiteConditions(site, initialCommunity);
 }
开发者ID:LANDIS-II-Foundation,项目名称:Extension-PnET-Succession,代码行数:6,代码来源:PlugIn.cs


示例8: InitializeSite

 //---------------------------------------------------------------------
 protected override void InitializeSite(ActiveSite site,
     ICommunity initialCommunity)
 {
     InitialBiomass initialBiomass = InitialBiomass.Compute(site, initialCommunity);
     cohorts[site] = initialBiomass.Cohorts.Clone();
     Dead.Pools.Woody[site] = initialBiomass.DeadWoodyPool;
     Dead.Pools.NonWoody[site] = initialBiomass.DeadNonWoodyPool;
 }
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:9,代码来源:PlugIn.cs


示例9: InitializeSite

        //---------------------------------------------------------------------
        protected override void InitializeSite(ActiveSite site,
                                               ICommunity initialCommunity)
        {
            InitialBiomass initialBiomass = InitialBiomass.Compute(site, initialCommunity);

            SiteVars.Cohorts[site] = initialBiomass.Cohorts.Clone();
            SiteVars.WoodyDebris[site] = initialBiomass.DeadWoodyPool.Clone();
            SiteVars.Litter[site] = initialBiomass.DeadNonWoodyPool.Clone();
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:10,代码来源:PlugIn.cs


示例10: Compute

        //---------------------------------------------------------------------
        /// <summary>
        /// Computes the initial biomass at a site.
        /// </summary>
        /// <param name="site">
        /// The selected site.
        /// </param>
        /// <param name="initialCommunity">
        /// The initial community of age cohorts at the site.
        /// </param>
        public static InitialBiomass Compute(ActiveSite site,
            ICommunity initialCommunity)
        {
            IEcoregion ecoregion = Model.Core.Ecoregion[site];
            uint key = ComputeKey(initialCommunity.MapCode, ecoregion.MapCode);
            InitialBiomass initialBiomass;
            if (initialSites.TryGetValue(key, out initialBiomass))
                return initialBiomass;

            //  If we don't have a sorted list of age cohorts for the initial
            //  community, make the list
            List<AgeCohort.ICohort> sortedAgeCohorts;
            if (! sortedCohorts.TryGetValue(initialCommunity.MapCode, out sortedAgeCohorts)) {
                sortedAgeCohorts = SortCohorts(initialCommunity.Cohorts);
                sortedCohorts[initialCommunity.MapCode] = sortedAgeCohorts;
            }

            SiteCohorts cohorts = MakeBiomassCohorts(sortedAgeCohorts, site);
            initialBiomass = new InitialBiomass(cohorts,
                                                Dead.Pools.Woody[site],
                                                Dead.Pools.NonWoody[site]);
            initialSites[key] = initialBiomass;
            return initialBiomass;
        }
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:34,代码来源:InitialBiomass.cs


示例11: InitializeSite

 //---------------------------------------------------------------------
 protected override void InitializeSite(ActiveSite site,
     ICommunity initialCommunity)
 {
     SiteVars.Cohorts[site] = new SiteCohorts(initialCommunity.Cohorts);
     /*if (SiteVars.Cohorts[site].HasAge())
     {
         //UI.WriteLine("System Error");
         throw new System.InvalidOperationException("Incompatible extensions given in the scenario file:  Age data required for this extension to operate.");
     }*/
 }
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:11,代码来源:PlugIn.cs


示例12: InitializeSite

        protected override void InitializeSite(ActiveSite site,
                                               ICommunity initialCommunity)
        {
            if (m == null)
            {
                m = new MyClock(PlugIn.ModelCore.Landscape.ActiveSiteCount);
            }

            m.Next();
            m.WriteUpdate();

            //float EstimatedTotalTime = (float)(100.0 / Percentage * (sw.ElapsedMilliseconds / 1000.0));
            //Console.Write("\rInitialization progress {0}% Elapsed time {1} Estimated total time {2}   ", System.String.Format("{0:0.00}", Percentage), Math.Round(sw.ElapsedMilliseconds / 1000F, 0), Math.Round(EstimatedTotalTime, 0));

            SiteCohorts identicalsitecohort = GetFromKey(initialCommunity.MapCode, PlugIn.ModelCore.Ecoregion[site].MapCode, site);

            // Create new sitecohorts
            if(SiteOutputNames.ContainsKey(site))
            {
                sitecohorts[site] = new SiteCohorts(StartDate,
                                                   site,
                                                   initialCommunity,
                                                    SiteOutputNames[site]);

            }
            else if (identicalsitecohort != null)
            {
                // Copy existing site data
                sitecohorts[site] = new SiteCohorts(identicalsitecohort, site);
            }
            // Create new sitecohorts
            else
            {
                sitecohorts[site] = new SiteCohorts(StartDate,
                                                    site,
                                                    initialCommunity);

            }
            CanopyLAImax[site] = sitecohorts[site].CanopyLAImax;
            WoodyDebris[site] = sitecohorts[site].WoodyDebris;
            Litter[site] = sitecohorts[site].Litter;
            SubCanopyParMaxGrowingSeason[site] = sitecohorts[site].SubCanopyParMAX;
            WaterMaxGrowingSeason[site] = sitecohorts[site].WaterMAX;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extension-PnET-Succession,代码行数:44,代码来源:PlugIn.cs


示例13: ComputeInitialBiomass

        //---------------------------------------------------------------------
        /// <summary>
        /// Computes the initial biomass at a site.
        /// </summary>
        /// <param name="site">
        /// The selected site.
        /// </param>
        /// <param name="initialCommunity">
        /// The initial community of age cohorts at the site.
        /// </param>
        public static InitialBiomass ComputeInitialBiomass(ActiveSite site,
                                             ICommunity initialCommunity)
        {
            InitialBiomass initialBiomass;

            IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];
            uint key = ComputeKey(initialCommunity.MapCode, ecoregion.MapCode);

            if (initialSites.TryGetValue(key, out initialBiomass) && HasSiteOutput[site]==false)
            {
                CanopyBiomass.CanopyLAImax[site] = initialBiomass.canopylaimax;
                CanopyBiomass.CanopyLAI[site] = initialBiomass.canopylai;
                Hydrology.Water[site] = initialBiomass.water;
                Hydrology.AnnualTranspiration[site] = initialBiomass.annualtrans;
                CanopyBiomass.SubCanopyPAR[site] = initialBiomass.subcanopypar;
                return initialBiomass;
            }

            //  If we don't have a sorted list of age cohorts for the initial
            //  community, make the list

            List<Landis.Library.AgeOnlyCohorts.ICohort> sortedAgeCohorts;
            if (!sortedCohorts.TryGetValue(initialCommunity.MapCode, out sortedAgeCohorts))
            {
                sortedAgeCohorts = PlugIn.RankCohortAgesOldToYoung(initialCommunity.Cohorts);
                sortedCohorts[initialCommunity.MapCode] = sortedAgeCohorts;
            }

            if (sortedAgeCohorts.Count == 0) return null;

            ISiteCohorts cohorts = MakeBiomassCohorts(sortedAgeCohorts, site);

            initialBiomass = new InitialBiomass(cohorts,
                                                ForestFloor.WoodyDebris[site],
                                                ForestFloor.Litter[site],
                                                Hydrology.Water[site],
                                                Hydrology.AnnualTranspiration[site],
                                                CanopyBiomass.CanopyLAI[site],
                                                CanopyBiomass.CanopyLAImax[site],
                                                CanopyBiomass.SubCanopyPAR[site]);

            initialSites[key] = initialBiomass;
            return initialBiomass;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extension-PnET-Succession,代码行数:54,代码来源:InitialBiomass.cs


示例14: Add

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

        public void Add(ICommunity community)
        {
            communities.Add(community.MapCode, community);
        }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:6,代码来源:Dataset.cs


示例15: InitializeSite

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

        protected override void InitializeSite(ActiveSite site,
                                               ICommunity initialCommunity)
        {
        }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:6,代码来源:NullSuccession.cs


示例16: Add

 //---------------------------------------------------------------------
 public void Add(ICommunity community)
 {
     communities.Add(community);
 }
开发者ID:LANDIS-II-Foundation,项目名称:Library-Succession,代码行数:5,代码来源:Dataset.cs


示例17: InitializeSite

 //---------------------------------------------------------------------
 /// <summary>
 /// Initializes an active site's cohorts using a specific initial
 /// community.
 /// </summary>
 protected abstract void InitializeSite(ActiveSite site,
     ICommunity initialCommunity);
开发者ID:LANDIS-II-Foundation,项目名称:Library-Succession,代码行数:7,代码来源:PlugIn.cs


示例18: InitializeSite

        //---------------------------------------------------------------------
        protected override void InitializeSite(ActiveSite site,
            ICommunity initialCommunity)
        {
            InitialBiomass initialBiomass = InitialBiomass.Compute(site, initialCommunity);

            //Clone initial cohorts
            SiteVars.Cohorts[site] = initialBiomass.InitialCohorts.Clone();

            //Clone initial coarse roots to all sites
            SiteVars.CoarseRoots[site].Mass = initialBiomass.CoarseRootsPool.Mass;
            SiteVars.CoarseRoots[site].ContentC = initialBiomass.CoarseRootsPool.ContentC;
            SiteVars.CoarseRoots[site].ContentN = initialBiomass.CoarseRootsPool.ContentN;
            SiteVars.CoarseRoots[site].ContentP = initialBiomass.CoarseRootsPool.ContentP;

            //Clone initial fine roots to all sites
            SiteVars.FineRoots[site].Mass = initialBiomass.FineRootsPool.Mass;
            SiteVars.FineRoots[site].ContentC = initialBiomass.FineRootsPool.ContentC;
            SiteVars.FineRoots[site].ContentN = initialBiomass.FineRootsPool.ContentN;
            SiteVars.FineRoots[site].ContentP = initialBiomass.FineRootsPool.ContentP;

            //Clone initial woody debris to all sites
            SiteVars.WoodyDebris[site].Mass = initialBiomass.WoodyDebrisPool.Mass;
            SiteVars.WoodyDebris[site].ContentC = initialBiomass.WoodyDebrisPool.ContentC;
            SiteVars.WoodyDebris[site].ContentN = initialBiomass.WoodyDebrisPool.ContentN;
            SiteVars.WoodyDebris[site].ContentP = initialBiomass.WoodyDebrisPool.ContentP;
            SiteVars.WoodyDebris[site].DecayValue = initialBiomass.WoodyDebrisPool.DecayValue;

            //Clone initial litter to all sites
            if (SiteVars.Litter[site].Count == 0)
            {
                foreach (PoolD litter in initialBiomass.LitterPool)
                {
                    PoolD litterAdd = new PoolD();
                    litterAdd.Mass = litter.Mass;
                    litterAdd.ContentC = litter.ContentC;
                    litterAdd.ContentN = litter.ContentN;
                    litterAdd.ContentP = litter.ContentP;
                    litterAdd.DecayValue = litter.DecayValue;
                    litterAdd.InitialMass = litter.InitialMass;
                    litterAdd.LimitValue = litter.LimitValue;
                    SiteVars.Litter[site].Add(litterAdd);
                }
            }

            //Clone initial dead fine roots to all sites
            if (SiteVars.DeadFineRoots[site].Count == 0)
            {
                foreach (PoolD litter in initialBiomass.DeadFRootsPool)
                {
                    PoolD litterAdd = new PoolD();
                    litterAdd.Mass = litter.Mass;
                    litterAdd.ContentC = litter.ContentC;
                    litterAdd.ContentN = litter.ContentN;
                    litterAdd.ContentP = litter.ContentP;
                    litterAdd.DecayValue = litter.DecayValue;
                    litterAdd.InitialMass = litter.InitialMass;
                    litterAdd.LimitValue = litter.LimitValue;
                    SiteVars.DeadFineRoots[site].Add(litterAdd);
                }
            }

            //Clone initial charcoal to all sites
            SiteVars.Charcoal[site].ContentC = initialBiomass.CharcoalPool.ContentC;
            SiteVars.Charcoal[site].ContentN = initialBiomass.CharcoalPool.ContentN;
            SiteVars.Charcoal[site].ContentP = initialBiomass.CharcoalPool.ContentP;
        }
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:67,代码来源:PlugIn.cs


示例19: Compute

        //---------------------------------------------------------------------
        /// <summary>
        /// Computes the initial biomass at a site.
        /// </summary>
        /// <param name="site">
        /// The selected site.
        /// </param>
        /// <param name="initialCommunity">
        /// The initial community of age cohorts at the site.
        /// </param>
        public static InitialBiomass Compute(ActiveSite site,
            ICommunity initialCommunity)
        {
            IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];
            uint key = ComputeKey(initialCommunity.MapCode, ecoregion.MapCode);
            InitialBiomass initialBiomass;
            if (initialSites.TryGetValue(key, out initialBiomass))
                return initialBiomass;

            //  If we don't have a sorted list of age cohorts for the initial
            //  community, make the list
            List<Landis.Library.AgeOnlyCohorts.ICohort> sortedAgeCohorts;
            if (! sortedCohorts.TryGetValue(initialCommunity.MapCode, out sortedAgeCohorts)) {
                sortedAgeCohorts = SortCohorts(initialCommunity.Cohorts);
                sortedCohorts[initialCommunity.MapCode] = sortedAgeCohorts;
            }

            ISiteCohorts cohorts = MakeBiomassCohorts(sortedAgeCohorts, site);
            initialBiomass = new InitialBiomass(
                        cohorts,

                        SiteVars.SurfaceDeadWood[site],
                        SiteVars.SurfaceStructural[site],
                        SiteVars.SurfaceMetabolic[site],

                        SiteVars.SoilDeadWood[site],
                        SiteVars.SoilStructural[site],
                        SiteVars.SoilMetabolic[site],

                        SiteVars.SOM1surface[site],
                        SiteVars.SOM1soil[site],
                        SiteVars.SOM2[site],
                        SiteVars.SOM3[site],

                        SiteVars.MineralN[site],
                        SiteVars.CohortLeafC[site],
                        SiteVars.CohortLeafN[site],
                        SiteVars.CohortWoodC[site],
                        SiteVars.CohortWoodN[site]
                        );

            initialSites[key] = initialBiomass;
            return initialBiomass;
        }
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:54,代码来源:InitialBiomass.cs


示例20: Compute

        //---------------------------------------------------------------------
        /// <summary>
        /// Computes the initial biomass at a site.
        /// </summary>
        /// <param name="site">
        /// The selected site.
        /// </param>
        /// <param name="initialCommunity">
        /// The initial community of age cohorts at the site.
        /// </param>
        public static InitialBiomass Compute(ActiveSite site,
            ICommunity initialCommunity)
        {
            IEcoregion ecoregion = PlugIn.ModelCore.Ecoregion[site];

            if (!ecoregion.Active)
            {
                string mesg = string.Format("Initial community {0} is located on a non-active ecoregion {1}", initialCommunity.MapCode, ecoregion.Name);
                throw new System.ApplicationException(mesg);
            }

            uint key = ComputeKey(initialCommunity.MapCode, ecoregion.MapCode);
            InitialBiomass initialBiomass;
            if (initialSites.TryGetValue(key, out initialBiomass))
                return initialBiomass;

            //  If we don't have a sorted list of age cohorts for the initial
            //  community, make the list
            List<Landis.Library.AgeOnlyCohorts.ICohort> sortedAgeCohorts;
            if (! sortedCohorts.TryGetValue(initialCommunity.MapCode, out sortedAgeCohorts)) {
                sortedAgeCohorts = SortCohorts(initialCommunity.Cohorts);
                sortedCohorts[initialCommunity.MapCode] = sortedAgeCohorts;
            }

            ISiteCohorts cohorts = MakeBiomassCohorts(sortedAgeCohorts, site);
            initialBiomass = new InitialBiomass(
                        cohorts,

                        SiteVars.SurfaceDeadWood[site],
                        SiteVars.SurfaceStructural[site],
                        SiteVars.SurfaceMetabolic[site],

                        SiteVars.SoilDeadWood[site],
                        SiteVars.SoilStructural[site],
                        SiteVars.SoilMetabolic[site],

                        SiteVars.SOM1surface[site],
                        SiteVars.SOM1soil[site],
                        SiteVars.SOM2[site],
                        SiteVars.SOM3[site],

                        SiteVars.MineralN[site],
                        SiteVars.CohortLeafC[site],
                        SiteVars.CohortFRootC[site],
                        SiteVars.CohortLeafN[site],
                        SiteVars.CohortFRootN[site],
                        SiteVars.CohortWoodC[site],
                         SiteVars.CohortCRootC[site],
                        SiteVars.CohortWoodN[site],
                        SiteVars.CohortCRootN[site]
                        );

            initialSites[key] = initialBiomass;
            return initialBiomass;
        }
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:65,代码来源:InitialBiomass.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IComparable类代码示例发布时间:2022-05-24
下一篇:
C# ICommunicationContext类代码示例发布时间: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