示例#1
0
        //---------------------------------------------------------------------

        public void Do(ActiveSite site,
                       BitArray hasSeeded)
        {
            for (int i = 0; i < Model.Core.Species.Count; i++)
            {
                if (hasSeeded != null && hasSeeded[i])
                {
                    continue;
                }
                ISpecies species = Model.Core.Species[i];
                if (seedingAlgorithm(species, site))
                {
                    Reproduction.AddNewCohort(species, site);
                    if (isDebugEnabled)
                    {
                        log.DebugFormat("site {0}: seeded {1}",
                                        site.Location, species.Name);
                    }
                    if (hasSeeded != null)
                    {
                        hasSeeded[i] = true;
                    }
                }
            }
        }
示例#2
0
        //---------------------------------------------------------------------

        public void Do(ActiveSite site)
        {
            for (int i = 0; i < Model.Species.Count; i++)
            {
                ISpecies species = Model.Species[i];
                if (seedingAlgorithm(species, site))
                {
                    Reproduction.AddNewCohort(species, site);
                }
            }
        }
 public static void Algorithm(//ISpecies   species,
     ActiveSite site)
 {
     foreach (ISpecies species in Model.Core.Species)
     {
         if (Reproduction.SufficientLight(species, site) && Reproduction.Establish(species, site))
         {
             Reproduction.AddNewCohort(species, site);
         }
     }
     //return Reproduction.SufficientLight(species, site) &&
     //       Reproduction.Establish(species, site);
 }
示例#4
0
        //---------------------------------------------------------------------

        public void Do(ActiveSite site)
        {
            for (int i = 0; i < Model.Core.Species.Count; i++)
            {
                ISpecies species = Model.Core.Species[i];
                if (seedingAlgorithm(species, site))
                {
                    Reproduction.AddNewCohort(species, site);
                    if (isDebugEnabled)
                    {
                        log.DebugFormat("site {0}: seeded {1}",
                                        site.Location, species.Name);
                    }
                }
            }
        }
        //---------------------------------------------------------------------

        bool IFormOfReproduction.TryAt(ActiveSite site)
        {
            bool     success = false;
            BitArray selectedSpeciesAtSite = selectedSpecies[site];

            for (int index = 0; index < speciesDataset.Count; ++index)
            {
                if (selectedSpeciesAtSite.Get(index))
                {
                    ISpecies species = speciesDataset[index];
                    if (PreconditionsSatisfied(species, site))
                    {
                        Reproduction.AddNewCohort(species, site);
                        success = true;
                    }
                }
            }

            return(success);
        }
        //---------------------------------------------------------------------

        public static void Algorithm(//ISpecies   species,
            ActiveSite site)
        {
            foreach (RelativeLocationWeighted reloc in Seeding.MaxSeedQuarterNeighborhood)
            {
                double distance = reloc.Weight;

                foreach (ISpecies species in Model.Core.Species)
                {
                    if (species.EffectiveSeedDist == EffectiveSeedDist.Universal)
                    {
                        if (Reproduction.SufficientLight(species, site) &&
                            Reproduction.Establish(species, site))
                        {
                            Reproduction.AddNewCohort(species, site);
                            break;
                        }
                    }


                    int EffD = species.EffectiveSeedDist;
                    int MaxD = species.MaxSeedDist;

                    if (distance > MaxD)
                    {
                        break;                  //Check no further
                    }
                    double dispersalProb = 0.0;
                    if (reloc.Location.Row == 0 && reloc.Location.Column == 0)  //Check seeds on site
                    {
                        if (Reproduction.SufficientLight(species, site) &&
                            Reproduction.Establish(species, site) &&
                            Reproduction.MaturePresent(species, site))
                        {
                            Reproduction.AddNewCohort(species, site);
                            break;
                        }
                    }
                    else
                    {
                        dispersalProb = GetDispersalProbability(EffD, MaxD, distance);

                        //First check the Southeast quadrant:
                        Site neighbor = site.GetNeighbor(reloc.Location);
                        if (neighbor != null && neighbor.IsActive)
                        {
                            if (Reproduction.MaturePresent(species, neighbor))
                            {
                                if (dispersalProb > Landis.Util.Random.GenerateUniform())
                                {
                                    Reproduction.AddNewCohort(species, site);
                                    break;
                                }
                            }
                        }

                        //Next, check all other quadrants:
                        neighbor = site.GetNeighbor(new RelativeLocation(reloc.Location.Row * -1, reloc.Location.Column));
                        if (neighbor != null && neighbor.IsActive)
                        {
                            if (Reproduction.MaturePresent(species, neighbor))
                            {
                                if (dispersalProb > Landis.Util.Random.GenerateUniform())
                                {
                                    Reproduction.AddNewCohort(species, site);
                                    break;
                                }
                            }
                        }

                        neighbor = site.GetNeighbor(new RelativeLocation(reloc.Location.Row, reloc.Location.Column * -1));
                        if (neighbor != null && neighbor.IsActive)
                        {
                            if (Reproduction.MaturePresent(species, neighbor))
                            {
                                if (dispersalProb > Landis.Util.Random.GenerateUniform())
                                {
                                    Reproduction.AddNewCohort(species, site);
                                    break;
                                }
                            }
                        }

                        neighbor = site.GetNeighbor(new RelativeLocation(reloc.Location.Row * -1, reloc.Location.Column * -1));
                        if (neighbor != null && neighbor.IsActive)
                        {
                            if (Reproduction.MaturePresent(species, neighbor))
                            {
                                if (dispersalProb > Landis.Util.Random.GenerateUniform())
                                {
                                    Reproduction.AddNewCohort(species, site);
                                    break;
                                }
                            }
                        }
                    }
                } //end species loop
            }     // end foreach relativelocation

            return;
        }