Exemplo n.º 1
0
        //---------------------------------------------------------------------

        public static void Initialize(double[,]              establishProbabilities,
                                      SeedingAlgorithm seedingAlgorithm,
                                      Delegates.AddNewCohort addNewCohort)
        {
            Reproduction.establishProbabilities = establishProbabilities;
            seeding = new Seeding(seedingAlgorithm);
            Reproduction.addNewCohort = addNewCohort;

            cohorts = Model.Core.SuccessionCohorts as AgeCohort.ILandscapeCohorts;
            if (cohorts == null)
            {
                throw new ApplicationException("The succession plug-in's cohorts don't support age-cohort interface");
            }

            speciesDataset = Model.Core.Species;
            int speciesCount = speciesDataset.Count;

            resprout = Model.Core.Landscape.NewSiteVar <BitArray>();
            serotiny = Model.Core.Landscape.NewSiteVar <BitArray>();
            foreach (ActiveSite site in Model.Core.Landscape.ActiveSites)
            {
                resprout[site] = new BitArray(speciesCount);
                serotiny[site] = new BitArray(speciesCount);
            }

            planting = new Planting();

            trySeeding = new BlockRowBuffer <bool>(Model.Core.Landscape);
            hasSeeded  = new BlockRowBuffer <BitArray>(Model.Core.Landscape);
            for (int col = 1; col <= hasSeeded.Columns; col++)
            {
                hasSeeded[col] = new BitArray(speciesCount);
            }
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Initializes the instance and its associated site variables.
        /// </summary>
        protected void Initialize(PlugIns.ICore modelCore,
                                  double[,]                           establishProbabilities,
                                  SeedingAlgorithms seedAlg,
                                  Reproduction.Delegates.AddNewCohort addNewCohort)
        {
            Model.Core = modelCore;
            SiteVars.Initialize();
            Seeding.InitializeMaxSeedNeighborhood();

            disturbedSites = new DisturbedSiteEnumerator(Model.Core.Landscape,
                                                         SiteVars.Disturbed);

            SeedingAlgorithm algorithm;

            switch (seedAlg)
            {
            case SeedingAlgorithms.NoDispersal:
                algorithm = NoDispersal.Algorithm;
                break;

            case SeedingAlgorithms.UniversalDispersal:
                algorithm = UniversalDispersal.Algorithm;
                break;

            case SeedingAlgorithms.WardSeedDispersal:
                algorithm = WardSeedDispersal.Algorithm;
                break;

            default:
                throw new ArgumentException(string.Format("Unknown seeding algorithm: {0}", seedAlg));
            }
            Reproduction.Initialize(establishProbabilities, algorithm,
                                    addNewCohort == null ? null : new Reproduction.Delegates.AddNewCohort(addNewCohort));
        }
Exemplo n.º 3
0
        //---------------------------------------------------------------------

        public static void Initialize(double[,]          establishProbabilities,
                                      SeedingAlgorithm seedingAlgorithm,
                                      AddNewCohortMethod addNewCohort)
        {
            Reproduction.establishProbabilities = establishProbabilities;
            seeding = new Seeding(seedingAlgorithm);
            Reproduction.addNewCohort = addNewCohort;

            cohorts = Model.Core.SuccessionCohorts as AgeCohort.ILandscapeCohorts;
            if (cohorts == null)
            {
                throw new ApplicationException("The succession plug-in's cohorts don't support age-cohort interface");
            }

            speciesDataset = Model.Core.Species;
            int speciesCount = speciesDataset.Count;

            resprout = Model.Core.Landscape.NewSiteVar <BitArray>();
            serotiny = Model.Core.Landscape.NewSiteVar <BitArray>();
            foreach (ActiveSite site in Model.Core.Landscape.ActiveSites)
            {
                resprout[site] = new BitArray(speciesCount);
                serotiny[site] = new BitArray(speciesCount);
            }
        }
Exemplo n.º 4
0
		//---------------------------------------------------------------------

		public static void Initialize(double[,]          establishProbabilities,
		                              SeedingAlgorithm   seedingAlgorithm,
		                              AddNewCohortMethod addNewCohort)
		{
			Reproduction.establishProbabilities = establishProbabilities;
			seeding = new Seeding(seedingAlgorithm);
			Reproduction.addNewCohort = addNewCohort;
			cohorts = Model.GetSuccession<AgeCohort.ICohort>().Cohorts;

			speciesDataset = Model.Species;
			int speciesCount = speciesDataset.Count;

			resprout = Model.Landscape.NewSiteVar<BitArray>();
			serotiny = Model.Landscape.NewSiteVar<BitArray>();
			foreach (ActiveSite site in Model.Landscape.ActiveSites) {
				resprout[site] = new BitArray(speciesCount);
				serotiny[site] = new BitArray(speciesCount);
			}
		}
        //---------------------------------------------------------------------

        public static void Initialize(double[,]          establishProbabilities,
                                      SeedingAlgorithm   seedingAlgorithm,
                                      AddNewCohortMethod addNewCohort)
        {
            Reproduction.establishProbabilities = establishProbabilities;
            seeding = new Seeding(seedingAlgorithm);
            Reproduction.addNewCohort = addNewCohort;

            cohorts = Model.Core.SuccessionCohorts as AgeCohort.ILandscapeCohorts;
            if (cohorts == null)
                throw new ApplicationException("The succession plug-in's cohorts don't support age-cohort interface");

            speciesDataset = Model.Core.Species;
            int speciesCount = speciesDataset.Count;

            resprout = Model.Core.Landscape.NewSiteVar<BitArray>();
            serotiny = Model.Core.Landscape.NewSiteVar<BitArray>();
            foreach (ActiveSite site in Model.Core.Landscape.ActiveSites) {
                resprout[site] = new BitArray(speciesCount);
                serotiny[site] = new BitArray(speciesCount);
            }
        }
        //---------------------------------------------------------------------

        public static void Initialize(double[,]              establishProbabilities,
                                      SeedingAlgorithm       seedingAlgorithm,
                                      Delegates.AddNewCohort addNewCohort)
        {
            Reproduction.establishProbabilities = establishProbabilities;
            seeding = new Seeding(seedingAlgorithm);
            Reproduction.addNewCohort = addNewCohort;

            cohorts = Model.Core.SuccessionCohorts as AgeCohort.ILandscapeCohorts;
            if (cohorts == null)
                throw new ApplicationException("The succession plug-in's cohorts don't support age-cohort interface");

            speciesDataset = Model.Core.Species;
            int speciesCount = speciesDataset.Count;

            resprout = Model.Core.Landscape.NewSiteVar<BitArray>();
            serotiny = Model.Core.Landscape.NewSiteVar<BitArray>();
            foreach (ActiveSite site in Model.Core.Landscape.ActiveSites) {
                resprout[site] = new BitArray(speciesCount);
                serotiny[site] = new BitArray(speciesCount);
            }

            planting = new Planting();

            trySeeding = new BlockRowBuffer<bool>(Model.Core.Landscape);
            hasSeeded = new BlockRowBuffer<BitArray>(Model.Core.Landscape);
            for (int col = 1; col <= hasSeeded.Columns; col++) {
                hasSeeded[col] = new BitArray(speciesCount);
            }
        }