Madingley.ResponsiveDispersal.CheckDensityDrivenDispersal C# (CSharp) Méthode

CheckDensityDrivenDispersal() private méthode

private CheckDensityDrivenDispersal ( Madingley.ModelGrid gridForDispersal, uint latIndex, uint lonIndex, Madingley.Cohort cohortToDisperse, int functionalGroup, int cohortNumber ) : void
gridForDispersal Madingley.ModelGrid
latIndex uint
lonIndex uint
cohortToDisperse Madingley.Cohort
functionalGroup int
cohortNumber int
Résultat void
        private void CheckDensityDrivenDispersal(ModelGrid gridForDispersal, uint latIndex, uint lonIndex, Cohort cohortToDisperse, int functionalGroup, int cohortNumber)
        {
            // Check the population density
            double NumberOfIndividuals = cohortToDisperse.CohortAbundance;

            // Get the cell area, in kilometres squared
            double CellArea = gridForDispersal.GetCellEnvironment(latIndex, lonIndex)["Cell Area"][0];

            // If below the density threshold
            if ((NumberOfIndividuals / CellArea) < _DensityThresholdScaling / cohortToDisperse.AdultMass)
            {
                // Temporary variables to keep track of directions in which cohorts enter/exit cells during the multiple advection steps per time step
                uint ExitDirection = new uint();
                uint EntryDirection = new uint();
                ExitDirection = 9999;

                // Check to see if it disperses (based on the same movement scaling as used in diffusive movement)
                // Calculate dispersal speed for that cohort
                double DispersalSpeed = CalculateDispersalSpeed(cohortToDisperse.IndividualBodyMass);

                // Cohort tries to disperse
                double[] DispersalArray = CalculateDispersalProbability(gridForDispersal, latIndex, lonIndex, CalculateDispersalSpeed(cohortToDisperse.AdultMass));

                double CohortDispersed = CheckForDispersal(DispersalArray[0]);

                if (CohortDispersed > 0)
                {
                    uint[] DestinationCell = CellToDisperseTo(gridForDispersal, latIndex, lonIndex, DispersalArray, CohortDispersed, DispersalArray[4], DispersalArray[5], ref ExitDirection, ref EntryDirection);

                    // Update the delta array of cells to disperse to, if the cohort moves
                    if (DestinationCell[0] < 999999)
                    {
                        // Update the delta array of cohorts
                        gridForDispersal.DeltaFunctionalGroupDispersalArray[latIndex, lonIndex].Add((uint)functionalGroup);
                        gridForDispersal.DeltaCohortNumberDispersalArray[latIndex, lonIndex].Add((uint)cohortNumber);

                        // Update the delta array of cells to disperse to
                        gridForDispersal.DeltaCellToDisperseToArray[latIndex, lonIndex].Add(DestinationCell);

                        // Update the delta array of exit and entry directions
                        gridForDispersal.DeltaCellExitDirection[latIndex, lonIndex].Add(ExitDirection);
                        gridForDispersal.DeltaCellEntryDirection[latIndex, lonIndex].Add(EntryDirection);
                    }
                }
            }
        }