ALMaSS Rodenticide ODdox
1.1
The rodenticide model description following ODdox protocol
|
Base class for all population managers.
More...
#include <PopulationManager.h>
|
| Population_Manager (Landscape *L) |
|
virtual | ~Population_Manager (void) |
|
void | SetNoProbes (int a_pn) |
|
unsigned | GetLiveArraySize (int a_listindex) |
| Gets the number of 'live' objects for a list index in the TheArray. More...
|
|
void | IncLiveArraySize (int a_listindex) |
| Increments the number of 'live' objects for a list index in the TheArray. More...
|
|
virtual void | Catastrophe (int) |
|
unsigned int | FarmAnimalCensus (unsigned int a_farm, unsigned int a_typeofanimal) |
|
char * | SpeciesSpecificReporting (int a_species, int a_time) |
|
char * | ProbeReport (int a_time) |
|
char * | ProbeReportTimed (int a_time) |
|
void | ImpactProbeReport (int a_Time) |
|
bool | BeginningOfMonth () |
|
void | LOG (const char *fname) |
|
int | SupplyStepSize () |
|
int | SupplySimW () |
|
int | SupplySimH () |
|
virtual void | Run (int NoTSteps) |
|
virtual float | Probe (int ListIndex, probe_data *p_TheProbe) |
|
virtual void | ImpactedProbe () |
|
int | SupplyListNameLength () |
|
TAnimal * | SupplyAnimalPtr (int a_index, int a_animal) |
| Returns the pointer indexed by a_index and a_animal. Note NO RANGE CHECK. More...
|
|
unsigned | SupplyListIndexSize () |
|
unsigned | SupplyListSize (unsigned listindex) |
|
bool | CheckXY (int l, int i) |
| Debug method to test for out of bounds coordinates. More...
|
|
const char * | SupplyListName (int i) |
|
bool | IsLast (unsigned listindex) |
|
int | SupplyState (unsigned listindex, unsigned j) |
|
virtual void | SupplyLocXY (unsigned listindex, unsigned j, int &x, int &y) |
|
const char * | SupplyStateNames (int i) |
|
unsigned | SupplyStateNamesLength () |
|
virtual void | DisplayLocations () |
|
int | ProbeFileInput (char *p_Filename, int p_ProbeNo) |
|
TAnimal * | FindClosest (int x, int y, unsigned Type) |
|
bool | OpenTheRipleysOutputProbe (string a_NWordFilename) |
|
void | OpenTheAOROutputProbe (string a_AORFilename) |
|
bool | OpenTheMonthlyRipleysOutputProbe () |
|
bool | OpenTheReallyBigProbe () |
|
virtual void | TheAOROutputProbe () |
|
virtual void | TheRipleysOutputProbe (FILE *a_prb) |
|
virtual void | TheReallyBigOutputProbe () |
|
void | CloseTheMonthlyRipleysOutputProbe () |
|
virtual void | CloseTheRipleysOutputProbe () |
|
virtual void | CloseTheReallyBigOutputProbe () |
|
TTypesOfPopulation | GetPopulationType () |
|
int | GetSeasonNumber () |
| Get the season number. More...
|
|
void | LamdaDeath (int x, int y) |
|
void | LamdaBirth (int x, int y) |
|
void | LamdaBirth (int x, int y, int z) |
|
void | LamdaClear () |
|
void | LamdaDumpOutput () |
|
virtual int | SupplyPegPosx (int) |
|
virtual int | SupplyPegPosy (int) |
|
virtual int | SupplyCovPosx (int) |
|
virtual int | SupplyCovPosy (int) |
|
virtual bool | OpenTheFledgelingProbe () |
|
virtual bool | OpenTheBreedingPairsProbe () |
|
virtual bool | OpenTheBreedingSuccessProbe () |
|
virtual void | BreedingPairsOutput (int) |
|
virtual int | TheBreedingFemalesProbe (int) |
|
virtual int | TheFledgelingProbe () |
|
virtual void | BreedingSuccessProbeOutput (double, int, int, int, int, int, int, int) |
|
virtual int | TheBreedingSuccessProbe (int &, int &, int &, int &, int &, int &) |
|
virtual void | FledgelingProbeOutput (int, int) |
|
virtual void | TheGeneticProbe (unsigned, int, unsigned &) |
|
virtual void | GeneticsResultsOutput (FILE *, unsigned) |
|
Base class for all population managers.
The core of the handling of animal populations. All time-step code and most input/output is handled by this class and its descendents. This class effectively implements a state machine to facilitate simulation of animal behaviours and handle potential issues with concurrency. The PopulationManager class is never instantiated but must be used by deriving a descendent class.
◆ Population_Manager()
Population_Manager::Population_Manager |
( |
Landscape * |
L | ) |
|
◆ ~Population_Manager()
Population_Manager::~Population_Manager |
( |
void |
| ) |
|
|
virtual |
◆ BeginningOfMonth()
bool Population_Manager::BeginningOfMonth |
( |
| ) |
|
◆ BreedingPairsOutput()
virtual void Population_Manager::BreedingPairsOutput |
( |
int |
| ) |
|
|
inlinevirtual |
◆ BreedingSuccessProbeOutput()
virtual void Population_Manager::BreedingSuccessProbeOutput |
( |
double |
, |
|
|
int |
, |
|
|
int |
, |
|
|
int |
, |
|
|
int |
, |
|
|
int |
, |
|
|
int |
, |
|
|
int |
|
|
) |
| |
|
inlinevirtual |
◆ Catastrophe() [1/2]
void Population_Manager::Catastrophe |
( |
| ) |
|
|
protectedvirtual |
This method MUST be overidden in descendent classes if this functionality is does not match with the animals requirements
◆ Catastrophe() [2/2]
virtual void Population_Manager::Catastrophe |
( |
int |
| ) |
|
|
inlinevirtual |
◆ CheckXY()
bool Population_Manager::CheckXY |
( |
int |
l, |
|
|
int |
i |
|
) |
| |
Debug method to test for out of bounds coordinates.
1520 if (
TheArray[l][i]->Supply_m_Location_x() > 10000)
return true;
1521 if (
TheArray[l][i]->Supply_m_Location_y() > 10000)
return true;
1522 if (
TheArray[l][i]->Supply_m_Location_x() < 0)
return true;
1523 if (
TheArray[l][i]->Supply_m_Location_y() < 0)
return true;
◆ CloseTheMonthlyRipleysOutputProbe()
void Population_Manager::CloseTheMonthlyRipleysOutputProbe |
( |
| ) |
|
◆ CloseTheReallyBigOutputProbe()
void Population_Manager::CloseTheReallyBigOutputProbe |
( |
| ) |
|
|
virtual |
◆ CloseTheRipleysOutputProbe()
void Population_Manager::CloseTheRipleysOutputProbe |
( |
| ) |
|
|
virtual |
◆ DisplayLocations()
void Population_Manager::DisplayLocations |
( |
| ) |
|
|
virtual |
Used to update the graphics when control is not returned to the ALMaSS_GUI between timesteps.
565 #ifdef __ALMASS_VISUAL
566 m_MainForm->UpdateGraphics();
◆ DoAfter()
void Population_Manager::DoAfter |
( |
| ) |
|
|
protectedvirtual |
Can be used in descendent classes
◆ DoAlmostLast()
void Population_Manager::DoAlmostLast |
( |
| ) |
|
|
protectedvirtual |
Can be used in descendent classes
◆ DoBefore()
void Population_Manager::DoBefore |
( |
| ) |
|
|
protectedvirtual |
Can be used in descendent classes
◆ DoFirst()
void Population_Manager::DoFirst |
( |
| ) |
|
|
protectedvirtual |
Can be used in descendent classes
◆ DoLast()
void Population_Manager::DoLast |
( |
| ) |
|
|
protectedvirtual |
Collects some data to describe the number of animals in each state at the end of the day
◆ EmptyTheArray()
void Population_Manager::EmptyTheArray |
( |
| ) |
|
|
protected |
Removes all objects from the TheArray by deleting them and clearing TheArray.
Sort TheArray w.r.t. the m_Location_x attribute
964 for (
unsigned i = 0; i <
TheArray.size(); i++ )
967 for (
unsigned j = 0; j < (unsigned)
TheArray[i].size(); j++)
◆ FarmAnimalCensus()
unsigned int Population_Manager::FarmAnimalCensus |
( |
unsigned int |
a_farm, |
|
|
unsigned int |
a_typeofanimal |
|
) |
| |
1263 unsigned int No = 0;
1265 for (
unsigned j = 0; j < sz; j++ )
1267 if (a_farm ==
TheArray[ a_typeofanimal ] [ j ]->SupplyFarmOwnerRef()) No++;
◆ FindClosest()
TAnimal * Population_Manager::FindClosest |
( |
int |
x, |
|
|
int |
y, |
|
|
unsigned |
Type |
|
) |
| |
Finds the closest individual to an x,y point
938 int distance = 100000000;
942 dx =
TheArray[ Type ] [ j ]->Supply_m_Location_x();
943 dy =
TheArray[ Type ] [ j ]->Supply_m_Location_y();
950 if ( d < distance ) {
◆ FledgelingProbeOutput()
virtual void Population_Manager::FledgelingProbeOutput |
( |
int |
, |
|
|
int |
|
|
) |
| |
|
inlinevirtual |
◆ GeneticsResultsOutput()
virtual void Population_Manager::GeneticsResultsOutput |
( |
FILE * |
, |
|
|
unsigned |
|
|
) |
| |
|
inlinevirtual |
◆ GetLiveArraySize()
unsigned Population_Manager::GetLiveArraySize |
( |
int |
a_listindex | ) |
|
|
inline |
Gets the number of 'live' objects for a list index in the TheArray.
References m_LiveArraySize.
◆ GetPopulationType()
◆ GetSeasonNumber()
int Population_Manager::GetSeasonNumber |
( |
| ) |
|
|
inline |
◆ ImpactedProbe()
void Population_Manager::ImpactedProbe |
( |
| ) |
|
|
virtual |
Special pesticide related probe. Overidden in descendent classes
◆ ImpactProbeReport()
void Population_Manager::ImpactProbeReport |
( |
int |
a_Time | ) |
|
Special probe
1323 for (
int ProbeNo = 0; ProbeNo < 1; ProbeNo++ ) {
1326 if ( (
TheProbe[ ProbeNo ]->m_ReportInterval == 3 )
1328 || ( (
TheProbe[ ProbeNo ]->m_ReportInterval == 1 ) && ( a_Time % 365 == 0 ) ) ) {
References BeginningOfMonth().
◆ IncLiveArraySize()
void Population_Manager::IncLiveArraySize |
( |
int |
a_listindex | ) |
|
|
inline |
Increments the number of 'live' objects for a list index in the TheArray.
References m_LiveArraySize.
◆ IsLast()
bool Population_Manager::IsLast |
( |
unsigned |
listindex | ) |
|
|
inline |
◆ LamdaBirth() [1/2]
void Population_Manager::LamdaBirth |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
|
inline |
◆ LamdaBirth() [2/2]
void Population_Manager::LamdaBirth |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
z |
|
) |
| |
|
inline |
◆ LamdaClear()
void Population_Manager::LamdaClear |
( |
| ) |
|
|
inline |
610 for (
int i = 0; i < 257; i++) {
611 for (
int j = 0; j < 257; j++) {
References lamdagrid.
◆ LamdaDeath()
void Population_Manager::LamdaDeath |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
|
inline |
◆ LamdaDumpOutput()
void Population_Manager::LamdaDumpOutput |
( |
| ) |
|
Special probe
658 ofstream fout(
"LambdaGridOuput.txt", ios_base::app);
659 for (
int i=0; i<257; i++ ) {
660 for (
int j=0; j<257; j++) {
◆ LOG()
void Population_Manager::LOG |
( |
const char * |
fname | ) |
|
Debug function used to log whatever is needed - this is just a place to write whatever is needed at the time - so contents vary
295 FILE * PFile = fopen(fname,
"w" );
301 for (
unsigned listindex = 0; listindex <
TheArray.size(); listindex++ ) {
303 fprintf( PFile,
"%s :\n",
m_ListNames[ listindex ] );
305 fprintf( PFile,
"%s :\n",
m_ListNames[ listindex ].c_str() );
307 for (
unsigned j = 0; j < (unsigned)
m_LiveArraySize[listindex]; j++ ) {
308 AP =
TheArray[ listindex ] [ j ]->SupplyPosition();
309 fprintf( PFile,
"%i %i %i\n", j, AP.
m_x, AP.
m_y );
References AnimalPosition::m_x, and AnimalPosition::m_y.
◆ OpenTheAOROutputProbe()
void Population_Manager::OpenTheAOROutputProbe |
( |
string |
a_AORFilename | ) |
|
◆ OpenTheBreedingPairsProbe()
virtual bool Population_Manager::OpenTheBreedingPairsProbe |
( |
| ) |
|
|
inlinevirtual |
◆ OpenTheBreedingSuccessProbe()
virtual bool Population_Manager::OpenTheBreedingSuccessProbe |
( |
| ) |
|
|
inlinevirtual |
◆ OpenTheFledgelingProbe()
virtual bool Population_Manager::OpenTheFledgelingProbe |
( |
| ) |
|
|
inlinevirtual |
◆ OpenTheMonthlyRipleysOutputProbe()
bool Population_Manager::OpenTheMonthlyRipleysOutputProbe |
( |
| ) |
|
open 12 ripley output probles, one for each month
781 g_msg->Warn( WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
787 g_msg->Warn( WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
793 g_msg->Warn( WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
799 g_msg->Warn( WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
805 g_msg->Warn( WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
811 g_msg->Warn( WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
817 g_msg->Warn( WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
823 g_msg->Warn( WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
829 g_msg->Warn( WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
835 g_msg->Warn( WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
841 g_msg->Warn( WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
847 g_msg->Warn( WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
References cfg_RipleysOutput_filename().
◆ OpenTheReallyBigProbe()
bool Population_Manager::OpenTheReallyBigProbe |
( |
| ) |
|
open the probe
862 g_msg->Warn( WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
References cfg_ReallyBigOutput_filename().
◆ OpenTheRipleysOutputProbe()
bool Population_Manager::OpenTheRipleysOutputProbe |
( |
string |
a_NWordFilename | ) |
|
open the Ripley probe
760 g_msg->Warn(WARN_FILE,
"Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
References cfg_RipleysOutput_filename().
◆ PartitionLiveDead()
unsigned Population_Manager::PartitionLiveDead |
( |
unsigned |
Type | ) |
|
|
protected |
Sort TheArray w.r.t. the current state attribute in reverse order
1019 return unsigned(it -
TheArray[Type].begin());
◆ Probe()
float Population_Manager::Probe |
( |
int |
ListIndex, |
|
|
probe_data * |
p_TheProbe |
|
) |
| |
|
virtual |
Default data probe. Rarely used in actuality but always available
689 Sp =
TheArray[ ListIndex ] [ j ]->SupplyPosition();
690 unsigned Farm =
TheArray[ ListIndex ] [ j ]->SupplyFarmOwnerRef();
691 for (
unsigned i = 0; i < p_TheProbe->
m_NoAreas; i++ ) {
694 for (
unsigned k = 0; k < p_TheProbe->
m_NoFarms; k++ ) {
703 Sp =
TheArray[ ListIndex ] [ j ]->SupplyPosition();
704 for (
unsigned i = 0; i < p_TheProbe->
m_NoAreas; i++ ) {
707 for (
unsigned k = 0; k < p_TheProbe->
m_NoEleTypes; k++ ) {
716 Sp =
TheArray[ ListIndex ] [ j ]->SupplyPosition();
718 for (
unsigned i = 0; i < p_TheProbe->
m_NoAreas; i++ ) {
721 for (
unsigned k = 0; k < p_TheProbe->
m_NoVegTypes; k++ ) {
740 for (
unsigned j = 0; j < sz; j++ ) {
741 Sp =
TheArray[ ListIndex ] [ j ]->SupplyPosition();
742 for (
unsigned i = 0; i < p_TheProbe->
m_NoAreas; i++ ) {
References AnimalPosition::m_EleType, probe_data::m_NoAreas, probe_data::m_NoEleTypes, probe_data::m_NoFarms, probe_data::m_NoVegTypes, probe_data::m_Rect, probe_data::m_RefEle, probe_data::m_RefFarms, probe_data::m_RefVeg, AnimalPosition::m_VegType, AnimalPosition::m_x, rectangle::m_x1, rectangle::m_x2, AnimalPosition::m_y, rectangle::m_y1, and rectangle::m_y2.
◆ ProbeFileInput()
int Population_Manager::ProbeFileInput |
( |
char * |
p_Filename, |
|
|
int |
p_ProbeNo |
|
) |
| |
Default probe file input
579 PFile = fopen(p_Filename,
"r" );
584 fgets( S, 255, PFile );
585 fgets( S, 255, PFile );
586 fscanf( PFile,
"%d\n", & data );
588 fgets( S, 255, PFile );
589 fscanf( PFile,
"%d\n", & data );
592 fgets( S, 255, PFile );
593 for (
int i = 0; i < 10; i++ ) {
594 fscanf( PFile,
"%d", & data );
599 fgets( S, 255, PFile );
600 fgets( S, 255, PFile );
601 fscanf( PFile,
"%d", & data );
603 fgets( S, 255, PFile );
604 fgets( S, 255, PFile );
605 fscanf( PFile,
"%d", & data2 );
606 fgets( S, 255, PFile );
607 fgets( S, 255, PFile );
608 fscanf( PFile,
"%d", & data );
615 fgets( S, 255, PFile );
616 fgets( S, 255, PFile );
618 for (
int i = 0; i < 10; i++ ) {
619 fscanf( PFile,
"%d", & data );
621 fscanf( PFile,
"%d", & data );
623 fscanf( PFile,
"%d", & data );
625 fscanf( PFile,
"%d", & data );
628 fgets( S, 255, PFile );
629 fgets( S, 255, PFile );
630 if (
TheProbe[ p_ProbeNo ]->m_NoVegTypes > 0 ) {
631 for (
int i = 0; i < 25; i++ ) {
632 fscanf( PFile,
"%d", & data );
636 }
else if (
TheProbe[ p_ProbeNo ]->m_NoFarms > 0 ) {
637 for (
int i = 0; i < 25; i++ ) {
638 fscanf( PFile,
"%d", & data );
643 for (
int i = 0; i < 25; i++ ) {
644 fscanf( PFile,
"%d", & data );
Referenced by GetProbeInput_ini().
◆ ProbeReport()
char * Population_Manager::ProbeReport |
( |
int |
a_time | ) |
|
1278 for (
int ProbeNo = 0; ProbeNo <
m_NoProbes; ProbeNo++ ) {
1282 if ( (
TheProbe[ ProbeNo ]->m_ReportInterval == 3 )
1284 || ( (
TheProbe[ ProbeNo ]->m_ReportInterval == 1 ) && ( Time % 365 == 0 ) ) ) {
1287 for (
unsigned listindex = 0; listindex < Index; listindex++ ) {
1288 if (
TheProbe[ ProbeNo ]->m_TargetTypes[ listindex ] )
1292 sprintf(str,
" %d ", No );
References BeginningOfMonth(), and g_str.
◆ ProbeReportTimed()
char * Population_Manager::ProbeReportTimed |
( |
int |
a_time | ) |
|
1304 for (
int ProbeNo = 0; ProbeNo <
m_NoProbes; ProbeNo++ ) {
1307 for (
unsigned listindex = 0; listindex < Index; listindex++ ) {
1311 sprintf(str,
" %d ", No );
References g_str.
◆ Run()
void Population_Manager::Run |
( |
int |
NoTSteps | ) |
|
|
virtual |
This is the main scheduling method for the population manager.
Note the structure of Shuffle_or_Sort(), DoFirst(), BeginStep, DoBefore(), Step looping until all are finished, DoAfter(), DoAlmostLast(), EndStep, DoLast().
Can do multiple time-steps here inside one landscape time-step (a day). This is used in the roe deer model to provide 10 minute behavioural time-steps.
It is necessary to remove any dead animals before the timestep starts. It is possible that animals are killed after their population manager Run method has been executed. This is the case with geese and hunters. Checking death first prevents this becomming a problem.
341 for (
int TSteps = 0; TSteps < NoTSteps; TSteps++ )
344 unsigned size1 = (unsigned)
TheArray.size();
349 for (
unsigned listindex = 0; listindex < size1; listindex++ )
354 #ifdef __ALMASS_VISUAL
355 if (m_MainForm!=NULL)
358 for (
unsigned listindex = 0; listindex < size1; listindex++ ) n += (
int)
m_LiveArraySize[ listindex ];
365 for (
unsigned listindex = 0; listindex < size1; listindex++ )
368 for (
unsigned j = 0; j < size2; j++ )
370 TheArray[ listindex ] [ j ]->SetStepDone(
false );
374 for (
unsigned listindex = 0; listindex < size1; listindex++ ) {
463 for (
unsigned listindex = 0; listindex < size1; listindex++ ) {
465 for (
unsigned j = 0; j < size2; j++)
466 TheArray[ listindex ] [ j ]->BeginStep();
471 for (
unsigned listindex = 0; listindex < size1; listindex++ ) {
473 for (
unsigned j = 0; j < size2; j++) {
474 TheArray[ listindex ] [ j ]->Step();
480 for (
unsigned listindex = 0; listindex < size1; listindex++ ) {
482 for (
unsigned j = 0; j < size2; j++) {
483 TheArray[ listindex ] [ j ]->EndStep();
References cfg_AOROutput_day(), cfg_AOROutput_interval(), cfg_AOROutput_used(), cfg_AOROutputFirstYear(), cfg_CatastropheEventStartYear(), cfg_ReallyBigOutput_day1(), cfg_ReallyBigOutput_day2(), cfg_ReallyBigOutput_day3(), cfg_ReallyBigOutput_day4(), cfg_ReallyBigOutput_interval(), cfg_ReallyBigOutput_used(), cfg_ReallyBigOutputFirstYear(), cfg_RipleysOutput_day(), cfg_RipleysOutput_interval(), cfg_RipleysOutput_used(), cfg_RipleysOutputFirstYear(), and cfg_RipleysOutputMonthly_used().
Referenced by RunTheSim().
◆ SetNoProbes()
void Population_Manager::SetNoProbes |
( |
int |
a_pn | ) |
|
|
inline |
◆ Shuffle()
void Population_Manager::Shuffle |
( |
unsigned |
Type | ) |
|
|
protected |
Run once through the list swapping randomly chosen elements
1057 for (
unsigned i = 0; i < s; i++ ) {
1059 unsigned a =
random( s );
1060 unsigned b =
random( s );
References random().
◆ Shuffle_or_Sort()
void Population_Manager::Shuffle_or_Sort |
( |
unsigned |
Type | ) |
|
|
protected |
This method is used to determine whether the array of animals should be shuffled or sorted.
To do nothing ensure that the BeforeStepActions[] is set appropriately // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = sortXIndex, 4 = do nothing
1093 m_TheLandscape->
Warn(
"Population_Manager::Shuffle_or_Sort- BeforeStepAction Unknown", NULL );
References g_rand_uni.
◆ SortState()
void Population_Manager::SortState |
( |
unsigned |
Type | ) |
|
|
protected |
Sort TheArray w.r.t. the current state attribute
◆ SortStateR()
void Population_Manager::SortStateR |
( |
unsigned |
Type | ) |
|
|
protected |
Sort TheArray w.r.t. the current state attribute in reverse order
◆ SortX()
void Population_Manager::SortX |
( |
unsigned |
Type | ) |
|
|
protected |
Sort TheArray w.r.t. the m_Location_x attribute
◆ SortXIndex()
void Population_Manager::SortXIndex |
( |
unsigned |
Type | ) |
|
|
protected |
Sort TheArray w.r.t. the m_Location_x attribute, and make an indexing array
1035 for (
unsigned i = 0; i < s; i++ ) {
1037 x =
TheArray[ Type ] [ i ]->Supply_m_Location_x();
1039 while ( counter < x )
IndexArrayX[ Type ] [ counter++ ] = -1;
1040 if ( x == counter ) {
1045 for (
int c = counter; c < 10000; c++ ) {
◆ SortY()
void Population_Manager::SortY |
( |
unsigned |
Type | ) |
|
|
protected |
Sort TheArray w.r.t. the m_Location_y attribute
◆ SpeciesSpecificReporting()
char * Population_Manager::SpeciesSpecificReporting |
( |
int |
a_species, |
|
|
int |
a_time |
|
) |
| |
This method handles species specific outputs. This is one place to do it. More commonly this is done in descendent classes
1124 if ( a_species == 1 ) {
1212 #ifdef __SpecificPesticideEffectsVinclozolinLike__
1215 #ifdef __WithinOrchardPesticideSim__
1221 else if ( a_species == 0 ) {
1223 int a_day = a_time % 365;
1224 if ( a_time % 365 == 364 )
1227 int BreedingFemales, YoungOfTheYear, TotalPop, TotalFemales, TotalMales, BreedingAttempts;
1228 No =
TheBreedingSuccessProbe( BreedingFemales, YoungOfTheYear, TotalPop, TotalFemales, TotalMales, BreedingAttempts );
1230 if ( BreedingFemales > 0 ) {
1231 bs = No / ( float )BreedingFemales;
1234 TotalFemales, TotalMales, a_time, BreedingAttempts );
1236 if ( a_day == 152 ) {
1241 if ( a_day == 197 ) {
1242 for (
int ProbeNo = 0; ProbeNo <
m_NoProbes; ProbeNo++ ) {
References g_str, ImpactProbeReport(), and ProbeReport().
Referenced by RunTheSim().
◆ StepFinished()
bool Population_Manager::StepFinished |
( |
void |
| ) |
|
|
protectedvirtual |
Overrides the population manager StepFinished - there is no chance that hunters do not finish a step behaviour.
Returns true if and only if all objects have finished the current step
499 for (
unsigned listindex = 0; listindex <
TheArray.size(); listindex++ ) {
501 if (
TheArray[ listindex ] [ j ]->GetStepDone() == false ) {
◆ SupplyAnimalPtr()
TAnimal* Population_Manager::SupplyAnimalPtr |
( |
int |
a_index, |
|
|
int |
a_animal |
|
) |
| |
|
inline |
Returns the pointer indexed by a_index and a_animal. Note NO RANGE CHECK.
References TheArray.
◆ SupplyCovPosx()
virtual int Population_Manager::SupplyCovPosx |
( |
int |
| ) |
|
|
inlinevirtual |
◆ SupplyCovPosy()
virtual int Population_Manager::SupplyCovPosy |
( |
int |
| ) |
|
|
inlinevirtual |
◆ SupplyListIndexSize()
unsigned Population_Manager::SupplyListIndexSize |
( |
| ) |
|
|
inline |
◆ SupplyListName()
const char* Population_Manager::SupplyListName |
( |
int |
i | ) |
|
|
inline |
◆ SupplyListNameLength()
int Population_Manager::SupplyListNameLength |
( |
| ) |
|
|
inline |
◆ SupplyListSize()
unsigned Population_Manager::SupplyListSize |
( |
unsigned |
listindex | ) |
|
|
inline |
◆ SupplyLocXY()
virtual void Population_Manager::SupplyLocXY |
( |
unsigned |
listindex, |
|
|
unsigned |
j, |
|
|
int & |
x, |
|
|
int & |
y |
|
) |
| |
|
inlinevirtual |
494 x =
TheArray[listindex][j]->Supply_m_Location_x();
495 y =
TheArray[listindex][j]->Supply_m_Location_y();
References TheArray.
◆ SupplyPegPosx()
virtual int Population_Manager::SupplyPegPosx |
( |
int |
| ) |
|
|
inlinevirtual |
◆ SupplyPegPosy()
virtual int Population_Manager::SupplyPegPosy |
( |
int |
| ) |
|
|
inlinevirtual |
◆ SupplySimH()
int Population_Manager::SupplySimH |
( |
| ) |
|
|
inline |
◆ SupplySimW()
int Population_Manager::SupplySimW |
( |
| ) |
|
|
inline |
◆ SupplyState()
int Population_Manager::SupplyState |
( |
unsigned |
listindex, |
|
|
unsigned |
j |
|
) |
| |
|
inline |
◆ SupplyStateNames()
const char* Population_Manager::SupplyStateNames |
( |
int |
i | ) |
|
|
inline |
◆ SupplyStateNamesLength()
unsigned Population_Manager::SupplyStateNamesLength |
( |
| ) |
|
|
inline |
◆ SupplyStepSize()
int Population_Manager::SupplyStepSize |
( |
| ) |
|
|
inline |
◆ TheAOROutputProbe()
void Population_Manager::TheAOROutputProbe |
( |
| ) |
|
|
virtual |
This method must be overridden in descendent classes
◆ TheBreedingFemalesProbe()
virtual int Population_Manager::TheBreedingFemalesProbe |
( |
int |
| ) |
|
|
inlinevirtual |
◆ TheBreedingSuccessProbe()
virtual int Population_Manager::TheBreedingSuccessProbe |
( |
int & |
, |
|
|
int & |
, |
|
|
int & |
, |
|
|
int & |
, |
|
|
int & |
, |
|
|
int & |
|
|
) |
| |
|
inlinevirtual |
◆ TheFledgelingProbe()
virtual int Population_Manager::TheFledgelingProbe |
( |
| ) |
|
|
inlinevirtual |
◆ TheGeneticProbe()
virtual void Population_Manager::TheGeneticProbe |
( |
unsigned |
, |
|
|
int |
, |
|
|
unsigned & |
|
|
) |
| |
|
inlinevirtual |
◆ TheReallyBigOutputProbe()
void Population_Manager::TheReallyBigOutputProbe |
( |
| ) |
|
|
virtual |
This method must be overridden in descendent classes
◆ TheRipleysOutputProbe()
void Population_Manager::TheRipleysOutputProbe |
( |
FILE * |
a_prb | ) |
|
|
virtual |
This method must be overridden in descendent classes
◆ AOROutputPrb
ofstream* Population_Manager::AOROutputPrb |
|
protected |
◆ BeforeStepActions
unsigned Population_Manager::BeforeStepActions[12] |
|
protected |
◆ IndexArrayX
int Population_Manager::IndexArrayX[5][10000] |
◆ lamdagrid
long int Population_Manager::lamdagrid[2][257][257] |
|
protected |
◆ m_AlleleFreqsFile
FILE* Population_Manager::m_AlleleFreqsFile |
|
protected |
◆ m_AOR_Probe
AOR_Probe* Population_Manager::m_AOR_Probe |
|
protected |
◆ m_catastrophestartyear
int Population_Manager::m_catastrophestartyear |
|
protected |
◆ m_EasyPopRes
FILE* Population_Manager::m_EasyPopRes |
|
protected |
◆ m_GeneticsFile
FILE* Population_Manager::m_GeneticsFile |
|
protected |
◆ m_ListNameLength
unsigned Population_Manager::m_ListNameLength |
|
protected |
◆ m_ListNames
const char* Population_Manager::m_ListNames[32] |
|
protected |
◆ m_LiveArraySize
vector<unsigned> Population_Manager::m_LiveArraySize |
|
protected |
◆ m_NoProbes
int Population_Manager::m_NoProbes |
|
protected |
◆ m_population_type
◆ m_SeasonNumber
int Population_Manager::m_SeasonNumber |
|
protected |
Holds the season number. Used when running goose and hunter sims.
Referenced by GetSeasonNumber().
◆ m_SimulationName
char Population_Manager::m_SimulationName[255] |
◆ m_StepSize
int Population_Manager::m_StepSize |
|
protected |
◆ m_TheLandscape
Landscape* Population_Manager::m_TheLandscape |
◆ ProbesSet
bool Population_Manager::ProbesSet |
◆ ReallyBigOutputPrb
FILE* Population_Manager::ReallyBigOutputPrb |
|
protected |
◆ RipleysOutputPrb
FILE* Population_Manager::RipleysOutputPrb |
|
protected |
◆ RipleysOutputPrb1
FILE* Population_Manager::RipleysOutputPrb1 |
|
protected |
◆ RipleysOutputPrb10
FILE* Population_Manager::RipleysOutputPrb10 |
|
protected |
◆ RipleysOutputPrb11
FILE* Population_Manager::RipleysOutputPrb11 |
|
protected |
◆ RipleysOutputPrb12
FILE* Population_Manager::RipleysOutputPrb12 |
|
protected |
◆ RipleysOutputPrb2
FILE* Population_Manager::RipleysOutputPrb2 |
|
protected |
◆ RipleysOutputPrb3
FILE* Population_Manager::RipleysOutputPrb3 |
|
protected |
◆ RipleysOutputPrb4
FILE* Population_Manager::RipleysOutputPrb4 |
|
protected |
◆ RipleysOutputPrb5
FILE* Population_Manager::RipleysOutputPrb5 |
|
protected |
◆ RipleysOutputPrb6
FILE* Population_Manager::RipleysOutputPrb6 |
|
protected |
◆ RipleysOutputPrb7
FILE* Population_Manager::RipleysOutputPrb7 |
|
protected |
◆ RipleysOutputPrb8
FILE* Population_Manager::RipleysOutputPrb8 |
|
protected |
◆ RipleysOutputPrb9
FILE* Population_Manager::RipleysOutputPrb9 |
|
protected |
◆ SimH
int Population_Manager::SimH |
◆ SimHH
unsigned Population_Manager::SimHH |
◆ SimW
int Population_Manager::SimW |
◆ SimWH
unsigned Population_Manager::SimWH |
◆ StateNames
const char* Population_Manager::StateNames[100] |
|
protected |
◆ StateNamesLength
unsigned Population_Manager::StateNamesLength |
|
protected |
◆ TestFile
FILE* Population_Manager::TestFile |
|
protected |
◆ TestFile2
FILE* Population_Manager::TestFile2 |
|
protected |
◆ TheArray
◆ TheProbe
The documentation for this class was generated from the following files:
bool m_TargetTypes[10]
Definition: PopulationManager.h:301
static CfgInt cfg_DayInMonth("PRB_DAYINMONTH", CFG_CUSTOM, 1)
TTypesOfVegetation TranslateVegTypes(int VegReference)
Definition: landscape.h:1655
int m_catastrophestartyear
Definition: PopulationManager.h:532
virtual void DoLast()
Definition: PopulationManager.cpp:530
FILE * RipleysOutputPrb
Definition: PopulationManager.h:582
char g_str[255]
Definition: PopulationManager.cpp:129
FILE * RipleysOutputPrb9
Definition: PopulationManager.h:591
void CloseTheMonthlyRipleysOutputProbe()
Definition: PopulationManager.cpp:885
unsigned m_NoAreas
Definition: PopulationManager.h:292
void Shuffle_or_Sort(unsigned Type)
Definition: PopulationManager.cpp:1073
unsigned m_RefFarms[25]
Definition: PopulationManager.h:299
vector< TListOfAnimals > TheArray
Definition: PopulationManager.h:534
unsigned StateNamesLength
Definition: PopulationManager.h:535
TTypesOfPopulation m_population_type
Definition: PopulationManager.h:580
virtual float Probe(int ListIndex, probe_data *p_TheProbe)
Definition: PopulationManager.cpp:680
static CfgInt cfg_ReallyBigOutput_day2("G_REALLYBIGOUTPUT_DAY_TWO", CFG_CUSTOM, 91)
rectangle m_Rect[10]
Definition: PopulationManager.h:293
virtual void TheRipleysOutputProbe(FILE *a_prb)
Definition: PopulationManager.cpp:918
FILE * ReallyBigOutputPrb
Definition: PopulationManager.h:595
unsigned SimWH
Definition: PopulationManager.h:512
Function to compare to TAnimal's m_CurrentStateNo to anything but -1.
Definition: PopulationManager.cpp:205
probe_data * TheProbe[100]
Definition: PopulationManager.h:510
static CfgInt cfg_RipleysOutput_interval("G_RIPLEYSOUTPUT_INTERVAL", CFG_CUSTOM, 1)
virtual void BreedingSuccessProbeOutput(double, int, int, int, int, int, int, int)
Definition: PopulationManager.h:649
virtual void CloseTheRipleysOutputProbe()
Definition: PopulationManager.cpp:874
int SupplyMonth(void)
Definition: landscape.h:1601
int m_StepSize
Definition: PopulationManager.h:533
unsigned m_x
Definition: PopulationManager.h:172
unsigned SimHH
Definition: PopulationManager.h:512
unsigned m_y1
Definition: PopulationManager.h:101
unsigned GetLiveArraySize(int a_listindex)
Gets the number of 'live' objects for a list index in the TheArray.
Definition: PopulationManager.h:433
Function to compare to TAnimal's m_Location_y.
Definition: PopulationManager.cpp:157
static CfgStr cfg_ReallyBigOutput_filename("G_REALLYBIGOUTPUT_FILENAME", CFG_CUSTOM, "ReallyBigOutput.txt")
void FillVegAreaData()
Definition: Landscape.cpp:3641
CfgBool cfg_RipleysOutput_used("G_RIPLEYSOUTPUT_USED", CFG_CUSTOM, false)
unsigned m_NoVegTypes
Definition: PopulationManager.h:295
int IndexArrayX[5][10000]
Definition: PopulationManager.h:509
void SortXIndex(unsigned Type)
Definition: PopulationManager.cpp:1027
void ImpactProbeReport(int a_Time)
Definition: PopulationManager.cpp:1321
unsigned m_x2
Definition: PopulationManager.h:102
int SimW
Definition: PopulationManager.h:511
CfgInt cfg_CatastropheEventStartYear("PM_CATASTROPHEEVENTSTARTYEAR", CFG_CUSTOM, 99999)
FILE * RipleysOutputPrb6
Definition: PopulationManager.h:588
static CfgInt cfg_ReallyBigOutput_interval("G_REALLYBIGOUTPUT_INTERVAL", CFG_CUSTOM, 1)
AOR_Probe * m_AOR_Probe
Definition: PopulationManager.h:526
unsigned m_ReportInterval
Definition: PopulationManager.h:291
void FileOutput(int No, int time, int ProbeNo)
Definition: PopulationManager.cpp:1447
TTypesOfLandscapeElement m_RefEle[25]
Definition: PopulationManager.h:298
void LamdaClear()
Definition: PopulationManager.h:609
static CfgInt cfg_AOROutput_day("G_AOROUTPUT_DAY", CFG_CUSTOM, 60)
CfgBool cfg_ReallyBigOutput_used("G_REALLYBIGOUTPUT_USED", CFG_CUSTOM, false)
FILE * RipleysOutputPrb8
Definition: PopulationManager.h:590
CfgBool cfg_RipleysOutputMonthly_used("G_RIPLEYSOUTPUTMONTHLY_USED", CFG_CUSTOM, false)
int SupplyDayInMonth(void)
Definition: landscape.h:1606
TTypesOfVegetation m_RefVeg[25]
Definition: PopulationManager.h:297
int SupplySimAreaHeight(void)
Definition: landscape.h:1637
int SupplySimAreaWidth(void)
Definition: landscape.h:1632
TTypesOfLandscapeElement TranslateEleTypes(int EleReference)
Definition: landscape.h:1648
virtual void TheReallyBigOutputProbe()
Definition: PopulationManager.cpp:913
virtual void DoBefore()
Definition: PopulationManager.cpp:328
FILE * RipleysOutputPrb10
Definition: PopulationManager.h:592
unsigned SupplyListIndexSize()
Definition: PopulationManager.h:468
The base class for all ALMaSS animal classes.
Definition: PopulationManager.h:205
int m_SeasonNumber
Holds the season number. Used when running goose and hunter sims.
Definition: PopulationManager.h:544
Function to compare to TAnimal's m_Location_x.
Definition: PopulationManager.cpp:146
static CfgInt cfg_ReallyBigOutputFirstYear("G_REALLYBIGOUTPUT_FIRSTYEAR", CFG_CUSTOM, 1)
static CfgInt cfg_AOROutput_interval("G_AORSOUTPUT_INTERVAL", CFG_CUSTOM, 1)
A class defining an animals position.
Definition: PopulationManager.h:168
unsigned BeforeStepActions[12]
Definition: PopulationManager.h:542
static CfgInt cfg_AOROutputFirstYear("G_AOROUTPUT_FIRSTYEAR", CFG_CUSTOM, 1)
virtual void ImpactedProbe()
Definition: PopulationManager.cpp:672
static CfgInt cfg_RipleysOutputFirstYear("G_RIPLEYSOUTPUT_FIRSTYEAR", CFG_CUSTOM, 1)
int SupplyDayInYear(void)
Definition: landscape.h:1596
static CfgInt cfg_RipleysOutput_day("G_RIPLEYSOUTPUT_DAY", CFG_CUSTOM, 60)
FILE * RipleysOutputPrb11
Definition: PopulationManager.h:593
long int lamdagrid[2][257][257]
Definition: PopulationManager.h:597
unsigned m_y2
Definition: PopulationManager.h:103
int SupplyYearNumber(void)
Definition: landscape.h:1616
virtual int TheFledgelingProbe()
Definition: PopulationManager.h:646
static CfgInt cfg_ReallyBigOutput_day1("G_REALLYBIGOUTPUT_DAY_ONE", CFG_CUSTOM, 1)
TTypesOfLandscapeElement m_EleType
Definition: PopulationManager.h:174
FILE * RipleysOutputPrb3
Definition: PopulationManager.h:585
unsigned m_y
Definition: PopulationManager.h:173
virtual void DoFirst()
Definition: PopulationManager.cpp:320
FILE * RipleysOutputPrb4
Definition: PopulationManager.h:586
const char * StateNames[100]
Definition: PopulationManager.h:531
virtual int TheBreedingSuccessProbe(int &, int &, int &, int &, int &, int &)
Definition: PopulationManager.h:651
bool m_FileRecord
Definition: PopulationManager.h:290
Landscape * m_TheLandscape
Definition: PopulationManager.h:515
virtual void FledgelingProbeOutput(int, int)
Definition: PopulationManager.h:654
static CfgInt cfg_ReallyBigOutput_day4("G_REALLYBIGOUTPUT_DAY_FOUR", CFG_CUSTOM, 274)
char * ProbeReport(int a_time)
Definition: PopulationManager.cpp:1273
bool OpenTheMonthlyRipleysOutputProbe()
Definition: PopulationManager.cpp:778
FILE * RipleysOutputPrb12
Definition: PopulationManager.h:594
int random(int a_range)
Definition: ALMaSS_CmdLine.cpp:142
FILE * RipleysOutputPrb1
Definition: PopulationManager.h:583
int SimH
Definition: PopulationManager.h:511
virtual void BreedingPairsOutput(int)
Definition: PopulationManager.h:641
unsigned m_x1
Definition: PopulationManager.h:100
unsigned m_ListNameLength
Definition: PopulationManager.h:538
FILE * RipleysOutputPrb5
Definition: PopulationManager.h:587
bool BeginningOfMonth()
Definition: PopulationManager.cpp:1102
void SortX(unsigned Type)
Definition: PopulationManager.cpp:979
unsigned m_NoEleTypes
Definition: PopulationManager.h:294
Function to compare to TAnimal's Current behavioural state.
Definition: PopulationManager.cpp:171
CfgBool cfg_AOROutput_used("G_AOROUTPUT_USED", CFG_CUSTOM, false)
unsigned m_NoFarms
Definition: PopulationManager.h:296
unsigned PartitionLiveDead(unsigned Type)
Definition: PopulationManager.cpp:1015
FILE * RipleysOutputPrb2
Definition: PopulationManager.h:584
int m_NoProbes
Definition: PopulationManager.h:525
FILE * RipleysOutputPrb7
Definition: PopulationManager.h:589
virtual bool StepFinished()
Overrides the population manager StepFinished - there is no chance that hunters do not finish a step ...
Definition: PopulationManager.cpp:498
virtual void DoAlmostLast()
Definition: PopulationManager.cpp:522
virtual void CloseTheReallyBigOutputProbe()
Definition: PopulationManager.cpp:904
void Shuffle(unsigned Type)
Definition: PopulationManager.cpp:1055
static CfgStr cfg_RipleysOutput_filename("G_RIPLEYSOUTPUT_FILENAME", CFG_CUSTOM, "RipleysOutput.txt")
Function to compare to TAnimal's m_CurrentStateNo.
Definition: PopulationManager.cpp:183
void OpenTheAOROutputProbe(string a_AORFilename)
Definition: PopulationManager.cpp:771
const char * m_ListNames[32]
Definition: PopulationManager.h:537
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
static CfgInt cfg_ReallyBigOutput_day3("G_REALLYBIGOUTPUT_DAY_THREE", CFG_CUSTOM, 182)
virtual void TheAOROutputProbe()
Definition: PopulationManager.cpp:924
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
void SortY(unsigned Type)
Definition: PopulationManager.cpp:989
vector< unsigned > m_LiveArraySize
Definition: PopulationManager.h:524
virtual void Catastrophe()
Definition: PopulationManager.cpp:1109
virtual void DoAfter()
Definition: PopulationManager.cpp:513
TTypesOfVegetation m_VegType
Definition: PopulationManager.h:175