![]() |
ALMaSS
1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
|
The class for base Aphid using subpopulation method. More...
#include <Aphid.h>
Public Member Functions | |
Aphid (int p_x, int p_y, int p_w, int p_h, Landscape *p_L, Aphid_Population_Manager *p_NPM, bool a_empty_flag, double *p_suitability, double *p_weight_density, int number, int a_index_x, int a_index_y, int a_SpeciesID=919, TTypesOfLandscapeElement p_winter_landscape_host=tole_Foobar, TTypesOfLandscapeElement p_summer_landscape_host=tole_Foobar, bool p_farm_flag=false) | |
Aphid constructor. More... | |
virtual bool | OnFarmEvent (FarmToDo event) |
Must be reimplemented if used in descendent classes. Sets the action on a management event. More... | |
virtual void | calPopuDensity (void) |
Function to calculate the weighted population density for the cell. More... | |
virtual void | calSuitability (void) |
Function to calculate the suitability for the cell. More... | |
void | calSuitabilityShared (void) |
virtual void | doReproduction (void) |
virtual void | doMovement (void) |
virtual double | calCellRelatedMortalityWeight (void) |
This function is used to calculate the cell realted weight to multiply with the temperature and age based mortality rate. In this base class, it always return 1. More... | |
virtual double | calBioticMortalityRate (int a_life_stage) |
The function to calculate the biotic mortalit rate. More... | |
double | calBioticMortalityRateShared (int a_life_stage) |
void | killAllPopulation () |
The function to kill all aphids in the cell due to e.g. pesticide applications. More... | |
virtual void | killByPredator (double a_num) |
The function to kill the aphids by the given number. More... | |
void | killPopulationByProportion (double a_proportion) |
The function to kill the aphids by the given proportion. More... | |
virtual void | BeginStep (void) |
BeingStep behaviour - must be implemented in descendent classes. More... | |
![]() | |
SubPopulation (int p_x, int p_y, Landscape *p_L, SubPopulation_Population_Manager *p_NPM, bool a_empty_flag, int a_index_x, int a_index_y, double *p_suitability=NULL, double *p_weight_density=NULL, int number=-1, int a_SpeciesID=999, TTypesOfLandscapeElement p_winter_landscape_host=tole_Foobar, TTypesOfLandscapeElement p_summer_landscape_host=tole_Foobar, bool p_farm_flag=false) | |
Subpopulation constructor. More... | |
virtual | ~SubPopulation ()=default |
unsigned | getSpeciesID () |
A typical interface function - this one returns the SpeciesID number as an unsigned integer. More... | |
void | setSpeciesID (unsigned a_spID) |
A typical interface function - this one returns the SpeciesID number as an unsigned integer. More... | |
double | getNumforOneLifeStage (int source_type) |
Return the number of animals in a specific life stage in the cell. More... | |
double | getTotalSubpopulation (void) |
Return totalpopulation in the cell. More... | |
void | addAnimalNumGivenStageColumn (int source_type, int a_column, double a_num) |
Add animal number for the given life stage at specific column (age) in the animal number array. More... | |
void | addAnimalNumGivenStage (int source_type, blitz::Array< double, 1 > *a_animal_num_array) |
Add animal number for the given life stage. More... | |
void | removeAnimalNumGivenStage (int source_type) |
Function to remove one life stage completely. More... | |
double | removeAnimalPortionGivenStageColumn (int source_type, int a_column, double a_prop) |
Remove propotion of animals for the given species and age. More... | |
void | addAnimalFromAnotherCell (int source_type, int a_column, double a_num) |
Add the number of animal at the given source and column that moved from another grid. More... | |
blitz::Array< double, 1 > | getArrayForOneLifeStage (int life_stage) |
Get the numbers of the given life stage at different ages. More... | |
virtual void | Step () |
Step behaviour - must be implemented in descendent classes. More... | |
virtual void | doDevelopment () |
virtual void | doDropingWings () |
For some specices, they drop the wings at some situation. More... | |
virtual void | doMortality () |
blitz::Array< double, 1 > | getFlyingArray (int ind) |
Supply the flying array for flying. More... | |
double | getFlyingNum (int ind) |
Supply the number of winged ones that want to fly away,. More... | |
void | setWinterHostPeriod (int start_month, int end_month) |
Set the available period for winter landscape host. More... | |
void | setSummerHostPeriod (int start_month, int end_month) |
Set the available period for summer landscape host. More... | |
virtual void | setParasitoidNum (double a_num) |
The function to set the parasitoid number. More... | |
virtual void | setParasitoidEggNum (double a_num) |
The function to set the parasitoid egg number. More... | |
virtual void | giveBirthParasitoidEgg (double a_egg_num) |
The function to give birth of parasitiod eggs. More... | |
virtual void | killByParasitoid () |
The function to kill subpopulation by parasitoid. More... | |
virtual void | hatchParasitoidEggs () |
The function to hatch parasitoid eggs. More... | |
double | getPrasitoidNum () |
The function to supply the parasitoid number. More... | |
double | getPrasitoidEggNum () |
int | supplySuitability () |
void | setFlyLocalMovFlag (bool a_flag) |
The function to set the flag to enable local movement triged by landing activity. More... | |
bool | isNewlyLanded () |
Supply whether it is newly landed grid. More... | |
bool | isFarm () |
The function to return whether it is part of farm. More... | |
![]() | |
TAnimal (int x, int y, Landscape *L) | |
The TAnimal constructor saving the x,y, location and the landscape pointer. More... | |
TAnimal (int x, int y) | |
The TAnimal constructor saving the x,y used if landscape is already set. More... | |
void | SetGuardMapIndex (int a_index_x, int a_index_y) |
Set the guard map index, this is used to avoid two animals operating in the same location when using multithread. More... | |
unsigned | SupplyFarmOwnerRef () const |
Get the current location farm ref if any. More... | |
AnimalPosition | SupplyPosition () const |
Returns the objects location and habitat type and veg type. More... | |
APoint | SupplyPoint () const |
Returns the objects location in ALMaSS coordinates. More... | |
int | SupplyPolygonRef () const |
Returns the polygon reference where the object is located. More... | |
TTypesOfLandscapeElement | SupplyPolygonType () const |
Returns the polygon type where the object is located. More... | |
int | Supply_m_Location_x () const |
Returns the ALMaSS x-coordinate. More... | |
int | Supply_m_Location_y () const |
Returns the ALMaSS y-coordinate. More... | |
int | SupplyGuardCellX () const |
Returns the x-index to the guard cell. More... | |
int | SupplyGuardCellY () const |
Returns the y-index to the guard cell. More... | |
int | SupplyAge () const |
Returns the animals age in days. More... | |
void | SetAge (int a_age) |
Sets the animals age in days. More... | |
virtual void | KillThis () |
Sets all parameters ready for object destruction. More... | |
virtual void | CopyMyself () |
Used to copy the object details to another in descendent classes. More... | |
void | SetX (const int a_x) |
Sets the x-coordinate. More... | |
void | SetY (const int a_y) |
Sets the y-coordinate. More... | |
virtual void | ReinitialiseObject (int a_x, int a_y, Landscape *a_l_ptr) |
virtual void | ReinitialiseObject (int a_x, int a_y) |
Used to re-use an object - must be implemented in descendent classes. More... | |
virtual int | WhatState () |
Returns the objects current state number. More... | |
virtual void | Dying () |
A wrapped for KillThis - ideally should not be used. More... | |
void | CheckManagement () |
Used to start a check for any management related effects at the objects current location. More... | |
void | CheckManagementXY (int a_x, int a_y) |
Used to start a check for any management related effects at x,y. More... | |
![]() | |
int | GetCurrentStateNo () const |
Returns the current state number. More... | |
void | SetCurrentStateNo (int a_num) |
Sets the current state number. More... | |
bool | GetStepDone () const |
Returns the step done indicator flag. More... | |
void | SetStepDone (bool a_bool) |
Sets the step done indicator flag. More... | |
virtual void | EndStep () |
EndStep behaviour - must be implemented in descendent classes. More... | |
void | ReinitialiseObjectBase () |
Used to initialise an object. More... | |
TALMaSSObject () | |
The constructor for TALMaSSObject. More... | |
virtual | ~TALMaSSObject ()=default |
The destructor for TALMaSSObject. More... | |
Private Attributes | |
void(Aphid::* | m_cal_suitability_func_pointer )(void) |
The function pointer for suitability calculations. More... | |
double(Aphid::* | m_cal_biotic_mortality_func_pointer )(int) |
The function pointer for biotic mortality rate calculation. More... | |
std::vector< double > | m_history_density_vec |
The array to store the previous density in the past days. More... | |
Additional Inherited Members | |
![]() | |
static void | SetSimulationWidth (int a_value) |
Sets the simulation width. More... | |
static void | SetSimulationHeight (int a_value) |
Sets the simulation height. More... | |
static void | SetDayInYear (int a_value) |
Sets the day in year attribute. More... | |
static void | SetOurLandscape (Landscape *a_value) |
Sets the landscape pointer. More... | |
static void | SetTempToday (double a_value) |
Sets the temperature today attribute. More... | |
![]() | |
static void | OnArrayBoundsError () |
Used for debugging only, tests basic object properties. More... | |
![]() | |
void | CorrectWrapRound () |
Corrects wrap around co-ordinate problems. More... | |
![]() | |
int | m_index_x |
Variable to store the index of x in the population manager. More... | |
int | m_index_y |
Variable to store the index of y in the population manager. More... | |
SubPopulation_Population_Manager * | m_OurPopulationManager |
This is a time saving pointer to the correct population manager object. More... | |
double * | m_popu_density |
Variable to store the weighted population density pointer. More... | |
double * | m_suitability |
Variable to store the suitability pointer. More... | |
double | m_whole_population_in_cell |
Variable to track the whole population in the current cell. More... | |
blitz::Array< double, 1 > | m_population_each_life_stage |
Array to hold the population number for each life stage. More... | |
blitz::Array< double, 2 > | m_animal_num_array |
Variables to record numbers of the animals at different life stages and age in canlander days. More... | |
blitz::Array< double, 2 > | m_temp_animal_num_array |
Tempraral variables for manipulting the animal number array. More... | |
blitz::Array< double, 1 > | m_temp_droping_wings_array |
Array used for droping wings. More... | |
blitz::Array< double, 1 > | m_died_number_each_life_stage |
Array used for mortality. More... | |
blitz::Array< double, 2 > | m_flying_array |
Array used to store the number of winged adults willing to fly away. More... | |
blitz::Array< double, 2 > | m_local_moving_array |
Array used to store the number of adults willing for local movement. More... | |
TTypesOfLandscapeElement | m_winter_landscape_host |
The flag to show whether it is a winter landscape type host. More... | |
TTypesOfLandscapeElement | m_summer_landscape_host |
The flag to show whether it is a summer landscape type host. More... | |
std::vector< int > | m_winter_landscape_host_period |
The staring and ending month for the winter landscape host. More... | |
std::vector< int > | m_summer_landscape_host_period |
The starting and ending month for the summer landscape host. More... | |
bool | m_farm_flag |
The flag to show whether it is part of farm. More... | |
double | m_parasitoid_num |
The variable to record the number of parasitoid. More... | |
double | m_parasitoid_egg_num |
The variable to recourd the number of parasitoid egg. More... | |
bool | m_landing_local_move_flag |
landing_enable_local_movement_flag More... | |
![]() | |
int | m_Location_x |
The objects ALMaSS x coordinate. More... | |
int | m_Location_y |
The objects ALMaSS y coordinate. More... | |
int | m_guard_cell_x |
The index x to the guard cell. More... | |
int | m_guard_cell_y |
The index y to the guard cell. More... | |
int | m_AgeDays {0} |
To hold the age in days. More... | |
PesticideToxicity | m_my_pesticide |
![]() | |
int | m_CurrentStateNo |
The basic state number for all objects - '-1' indicates death. More... | |
bool | m_StepDone |
Indicates whether the iterative step code is done for this timestep. More... | |
![]() | |
static Landscape * | m_OurLandscape = nullptr |
A pointer to the landscape object shared with all TAnimal objects. More... | |
static int | m_SimulationWidth = 0 |
A static member for the simulation width because it is often used by descendent classes. More... | |
static int | m_SimulationHeight = 0 |
A static member for the simulation height because it is often used by descendent classes. More... | |
static double | m_TemperatureToday = 0.0 |
A holder for the temperature today shared with all TAnimal objects. More... | |
static int | m_DayInYear = 0 |
A holder for the day in year shared with all TAnimal objects. More... | |
The class for base Aphid using subpopulation method.
Aphid::Aphid | ( | int | p_x, |
int | p_y, | ||
int | p_w, | ||
int | p_h, | ||
Landscape * | p_L, | ||
Aphid_Population_Manager * | p_NPM, | ||
bool | a_empty_flag, | ||
double * | p_suitability, | ||
double * | p_weight_density, | ||
int | number, | ||
int | a_index_x, | ||
int | a_index_y, | ||
int | a_SpeciesID = 919 , |
||
TTypesOfLandscapeElement | p_winter_landscape_host = tole_Foobar , |
||
TTypesOfLandscapeElement | p_summer_landscape_host = tole_Foobar , |
||
bool | p_farm_flag = false |
||
) |
Aphid constructor.
References calBioticMortalityRateShared(), calSuitabilityShared(), cfg_AphidDensityHistoryDayNumVec, m_cal_biotic_mortality_func_pointer, m_cal_suitability_func_pointer, m_history_density_vec, SubPopulation::m_OurPopulationManager, and CfgArray_Int::value().
|
virtual |
BeingStep behaviour - must be implemented in descendent classes.
Reimplemented from SubPopulation.
References TAnimal::CheckManagement().
|
virtual |
The function to calculate the biotic mortalit rate.
Reimplemented from SubPopulation.
References m_cal_biotic_mortality_func_pointer.
double Aphid::calBioticMortalityRateShared | ( | int | a_life_stage | ) |
References cfg_AphidPredatorsMortalityVec, SubPopulation::m_OurPopulationManager, toa_Egg, and CfgArray_Double::value().
Referenced by Aphid().
|
virtual |
This function is used to calculate the cell realted weight to multiply with the temperature and age based mortality rate. In this base class, it always return 1.
Reimplemented from SubPopulation.
References cfg_AphidDensityMortalityStrengthVec, cfg_APhidIndependentSurvivorVec, m_history_density_vec, SubPopulation::m_OurPopulationManager, and CfgArray_Double::value().
|
virtual |
Function to calculate the weighted population density for the cell.
Reimplemented from SubPopulation.
References cfg_AphidDensityHistoryDayNumVec, cfg_AphidNoGrowWinterHostGreenBiomass, cfg_AphidNoncropBiomassWeightVec, SubPopulation::m_farm_flag, m_history_density_vec, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, SubPopulation::m_OurPopulationManager, SubPopulation::m_popu_density, SubPopulation::m_whole_population_in_cell, SubPopulation::m_winter_landscape_host, Landscape::SupplyInterestedGreenBiomassTotal(), SubPopulation_Population_Manager::supplySizeSubpopulationCell(), Landscape::SupplyVegType(), SubPopulation_Population_Manager::supplyWinterHostOn(), tole_Foobar, tov_NoGrowth, CfgFloat::value(), CfgArray_Int::value(), and CfgArray_Double::value().
|
virtual |
Function to calculate the suitability for the cell.
Reimplemented from SubPopulation.
References m_cal_suitability_func_pointer.
void Aphid::calSuitabilityShared | ( | void | ) |
References SubPopulation::m_farm_flag, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, SubPopulation::m_OurPopulationManager, SubPopulation::m_suitability, SubPopulation::m_summer_landscape_host, SubPopulation::m_winter_landscape_host, Landscape::SupplyCropType(), Landscape::SupplyGreenBiomassProp(), SubPopulation_Population_Manager::supplySummerHostOn(), SubPopulation_Population_Manager::supplyWinterHostOn(), and tole_Foobar.
Referenced by Aphid().
|
virtual |
Reimplemented from SubPopulation.
References SubPopulation::addAnimalNumGivenStage(), cfg_AphidLocalMovementFractionVec, g_random_fnc(), SubPopulation_Population_Manager::getSuitabilityInCell(), SubPopulation_Population_Manager::getTotalSubpopulationInCell(), SubPopulation::m_animal_num_array, SubPopulation::m_index_x, SubPopulation::m_index_y, SubPopulation::m_OurPopulationManager, SubPopulation::m_population_each_life_stage, SubPopulation::m_whole_population_in_cell, SubPopulation_Population_Manager::supplyCellNumX(), SubPopulation_Population_Manager::supplyCellNumY(), SubPopulation_Population_Manager::supplySubPopulationPointer(), SubPopulation_Population_Manager::supplyVecLocMoveLifeStages(), and CfgArray_Double::value().
|
virtual |
Reimplemented from SubPopulation.
References SubPopulation::addAnimalNumGivenStageColumn(), SubPopulation_Population_Manager::calOffspringStage(), SubPopulation::m_animal_num_array, SubPopulation::m_farm_flag, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, SubPopulation::m_OurPopulationManager, SubPopulation::m_popu_density, SubPopulation::m_winter_landscape_host, SubPopulation_Population_Manager::setFirstFlagLifeStage(), SubPopulation_Population_Manager::setOldIndex(), SubPopulation_Population_Manager::supplyAgeInDay(), SubPopulation_Population_Manager::supplyAgeInDayDegree(), Landscape::SupplyDeadBiomass(), SubPopulation_Population_Manager::supplyFirstFlagLifeStage(), Landscape::SupplyGreenBiomass(), Landscape::SupplyGreenBiomassProp(), Landscape::SupplyInterestedGreenBiomassTotal(), SubPopulation_Population_Manager::supplyLifeStageNum(), SubPopulation_Population_Manager::supplyMaxColNum(), Landscape::SupplyMonth(), SubPopulation_Population_Manager::supplyNewestIndex(), Landscape::SupplyPolyRef(), Landscape::SupplyVegGrowthStage(), Landscape::SupplyVegHeight(), Landscape::SupplyVegType(), SubPopulation_Population_Manager::supplyWinterHostOn(), toa_Alate, toa_Aptera, toa_Egg, toa_Female, toa_Male, toa_Nymph, toa_Nymph_F, toa_Nymph_M, toa_Nymph_W, toas_EG, toas_PEA, tole_Foobar, and tov_NoGrowth.
void Aphid::killAllPopulation | ( | ) |
The function to kill all aphids in the cell due to e.g. pesticide applications.
References SubPopulation::m_animal_num_array, SubPopulation::m_population_each_life_stage, SubPopulation::m_whole_population_in_cell, toa_Egg, and toa_Male.
Referenced by OnFarmEvent().
|
virtual |
The function to kill the aphids by the given number.
References SubPopulation::m_animal_num_array, SubPopulation::m_population_each_life_stage, and SubPopulation::m_whole_population_in_cell.
void Aphid::killPopulationByProportion | ( | double | a_proportion | ) |
The function to kill the aphids by the given proportion.
References SubPopulation::m_animal_num_array, SubPopulation::m_population_each_life_stage, SubPopulation::m_whole_population_in_cell, toa_Egg, and toa_Male.
Referenced by OnFarmEvent().
|
virtual |
Must be reimplemented if used in descendent classes. Sets the action on a management event.
Reimplemented from TAnimal.
References biocide, cfg_AphidMortalityByPesticideVec, harvest, insecticide_treat, killAllPopulation(), killPopulationByProportion(), SubPopulation::m_OurPopulationManager, and CfgArray_Double::value().
|
private |
The function pointer for biotic mortality rate calculation.
Referenced by Aphid(), and calBioticMortalityRate().
|
private |
The function pointer for suitability calculations.
Referenced by Aphid(), and calSuitability().
|
private |
The array to store the previous density in the past days.
Referenced by Aphid(), calCellRelatedMortalityWeight(), and calPopuDensity().