//--------------------------------------------------------------------- /// <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)); }
//--------------------------------------------------------------------- /// <summary> /// Initializes the instance and its associated site variables. /// </summary> protected void Initialize(int timestep, double[,] establishProbabilities, int startTime, SeedingAlgorithms seedAlg, Reproduction.AddNewCohortMethod addNewCohort) { this.timestep = timestep; this.nextTimeToRun = startTime - 1 + timestep; this.updateNextTimeToRun = false; SiteVars.Initialize(); 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); }