ALMaSS Rodenticide ODdox  1.1
The rodenticide model description following ODdox protocol
Population_Manager Class Reference

Base class for all population managers. More...

#include <PopulationManager.h>

Public Member Functions

 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 ()
 
TAnimalSupplyAnimalPtr (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)
 
TAnimalFindClosest (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)
 

Public Attributes

int IndexArrayX [5][10000]
 
probe_dataTheProbe [100]
 
int SimH
 
int SimW
 
unsigned SimHH
 
unsigned SimWH
 
char m_SimulationName [255]
 
bool ProbesSet
 
Landscapem_TheLandscape
 

Protected Member Functions

virtual bool StepFinished ()
 Overrides the population manager StepFinished - there is no chance that hunters do not finish a step behaviour. More...
 
virtual void DoFirst ()
 
virtual void DoBefore ()
 
virtual void DoAfter ()
 
virtual void DoAlmostLast ()
 
virtual void DoLast ()
 
void EmptyTheArray ()
 Removes all objects from the TheArray by deleting them and clearing TheArray. More...
 
void SortX (unsigned Type)
 
void SortXIndex (unsigned Type)
 
void SortY (unsigned Type)
 
void SortState (unsigned Type)
 
void SortStateR (unsigned Type)
 
unsigned PartitionLiveDead (unsigned Type)
 
void Shuffle_or_Sort (unsigned Type)
 
void Shuffle (unsigned Type)
 
virtual void Catastrophe ()
 

Protected Attributes

vector< unsigned > m_LiveArraySize
 
int m_NoProbes
 
AOR_Probe * m_AOR_Probe
 
FILE * m_GeneticsFile
 
FILE * m_AlleleFreqsFile
 
FILE * m_EasyPopRes
 
const char * StateNames [100]
 
int m_catastrophestartyear
 
int m_StepSize
 
vector< TListOfAnimalsTheArray
 
unsigned StateNamesLength
 
const char * m_ListNames [32]
 
unsigned m_ListNameLength
 
FILE * TestFile
 
FILE * TestFile2
 
unsigned BeforeStepActions [12]
 
int m_SeasonNumber
 Holds the season number. Used when running goose and hunter sims. More...
 
TTypesOfPopulation m_population_type
 
ofstream * AOROutputPrb
 
FILE * RipleysOutputPrb
 
FILE * RipleysOutputPrb1
 
FILE * RipleysOutputPrb2
 
FILE * RipleysOutputPrb3
 
FILE * RipleysOutputPrb4
 
FILE * RipleysOutputPrb5
 
FILE * RipleysOutputPrb6
 
FILE * RipleysOutputPrb7
 
FILE * RipleysOutputPrb8
 
FILE * RipleysOutputPrb9
 
FILE * RipleysOutputPrb10
 
FILE * RipleysOutputPrb11
 
FILE * RipleysOutputPrb12
 
FILE * ReallyBigOutputPrb
 
long int lamdagrid [2][257][257]
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Population_Manager()

Population_Manager::Population_Manager ( Landscape L)

Constructor for the Population_Manager class

221  {
222  // Keep a pointer to the landscape this population is in
223  m_TheLandscape = L;
224  // create 10 empty arrays as default, excess can be removed in descendent classes
225  TListOfAnimals alist;
226  TheArray.insert( TheArray.end(), 12, alist );
227  // Set the simulation bounds
232 
233  // dww this is hardcoded limit of 12.
234  // Needs fixing
235  for (int i = 0; i < 12; i++) {
236  // Set default BeforeStepActions
237  BeforeStepActions[ i ] = 0;
238  m_ListNames[ i ] = "Unknown";
239  m_LiveArraySize.push_back( 0 );
240  }
241  // modify this if they need to in descendent classes
242  StateNamesLength = 0; // initialise this variable.
243  m_catastrophestartyear=-1; // Default is don't do this
244 #ifdef __LAMBDA_RECORD
245  ofstream fout("LambdaGridOuput.txt", ios_base::out); // open for writing
246  fout.close();
247  LamdaClear();
248 #endif
249  if ( cfg_RipleysOutputMonthly_used.value() ) {
251  }
252  if (cfg_AOROutput_used.value()) {
253  OpenTheAOROutputProbe("AOR_Probe.txt");
254  }
255  // Ensure the GUI pointer is NULL in case we are not in GUI mode
256 #ifdef __ALMASS_VISUAL
257  m_MainForm = NULL;
258 #endif
259  m_SeasonNumber = 0; // Ensure that we start in season number 0. Season number is incremented at day in year 183
260 }

References cfg_AOROutput_used(), and cfg_RipleysOutputMonthly_used().

◆ ~Population_Manager()

Population_Manager::~Population_Manager ( void  )
virtual

Destructor for the Population_Manager class

266  {
267  // clean-up
268  for ( unsigned i = 0; i < TheArray.size(); i++ ) {
269  // if objects in the list need to be deleted:
270  for ( unsigned j = 0; j < (unsigned) GetLiveArraySize(i); j++ ) {
271  delete TheArray[ i ] [ j ];
272  }
273  // empty the array
274  TheArray[ i ].clear();
275  // --
276  }
277  if ( cfg_RipleysOutput_used.value() ) {
279  }
280  if ( cfg_RipleysOutputMonthly_used.value() ) {
282  }
283  if ( cfg_ReallyBigOutput_used.value() ) {
285  }
286  if (cfg_AOROutput_used.value()) delete m_AOR_Probe;
287 }

References cfg_AOROutput_used(), cfg_ReallyBigOutput_used(), cfg_RipleysOutput_used(), and cfg_RipleysOutputMonthly_used().

Member Function Documentation

◆ BeginningOfMonth()

bool Population_Manager::BeginningOfMonth ( )

Is it the first day of the month?

1102  {
1103  if ( m_TheLandscape->SupplyDayInMonth() == cfg_DayInMonth.value() ) return true;
1104  return false;
1105 }

References cfg_DayInMonth().

◆ BreedingPairsOutput()

virtual void Population_Manager::BreedingPairsOutput ( int  )
inlinevirtual
641  {
642  }

◆ BreedingSuccessProbeOutput()

virtual void Population_Manager::BreedingSuccessProbeOutput ( double  ,
int  ,
int  ,
int  ,
int  ,
int  ,
int  ,
int   
)
inlinevirtual
649  {
650  }

◆ 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

1109  {
1114  return;
1115 }

◆ Catastrophe() [2/2]

virtual void Population_Manager::Catastrophe ( int  )
inlinevirtual
440  {
441  }

◆ CheckXY()

bool Population_Manager::CheckXY ( int  l,
int  i 
)

Debug method to test for out of bounds coordinates.

1519 {
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;
1524  return false;
1525 }

◆ CloseTheMonthlyRipleysOutputProbe()

void Population_Manager::CloseTheMonthlyRipleysOutputProbe ( )

close the monthly probes

885  {
886  fclose( RipleysOutputPrb1 );
887  fclose( RipleysOutputPrb2 );
888  fclose( RipleysOutputPrb3 );
889  fclose( RipleysOutputPrb4 );
890  fclose( RipleysOutputPrb5 );
891  fclose( RipleysOutputPrb6 );
892  fclose( RipleysOutputPrb7 );
893  fclose( RipleysOutputPrb8 );
894  fclose( RipleysOutputPrb9 );
895  fclose( RipleysOutputPrb10 );
896  fclose( RipleysOutputPrb11 );
897  fclose( RipleysOutputPrb12 );
898 }

◆ CloseTheReallyBigOutputProbe()

void Population_Manager::CloseTheReallyBigOutputProbe ( )
virtual

close the probe

904  {
905  if ( ReallyBigOutputPrb != 0 )
906  fclose( ReallyBigOutputPrb );
908 }

◆ CloseTheRipleysOutputProbe()

void Population_Manager::CloseTheRipleysOutputProbe ( )
virtual

close the probe

874  {
875  if ( cfg_RipleysOutputMonthly_used.value() )
876  fclose( RipleysOutputPrb );
877  RipleysOutputPrb=NULL;
878 }

References cfg_RipleysOutputMonthly_used().

◆ DisplayLocations()

void Population_Manager::DisplayLocations ( )
virtual

Used to update the graphics when control is not returned to the ALMaSS_GUI between timesteps.

561 {
565 #ifdef __ALMASS_VISUAL
566  m_MainForm->UpdateGraphics();
567 #endif
568 }

◆ DoAfter()

void Population_Manager::DoAfter ( )
protectedvirtual

Can be used in descendent classes

513  {
514  //TODO: Add your source code here
515 }

◆ DoAlmostLast()

void Population_Manager::DoAlmostLast ( )
protectedvirtual

Can be used in descendent classes

522  {
523  //TODO: Add your source code here
524 }

◆ DoBefore()

void Population_Manager::DoBefore ( )
protectedvirtual

Can be used in descendent classes

328  {
329 }

◆ DoFirst()

void Population_Manager::DoFirst ( )
protectedvirtual

Can be used in descendent classes

320  {
321 }

◆ DoLast()

void Population_Manager::DoLast ( )
protectedvirtual

Collects some data to describe the number of animals in each state at the end of the day

530  {
531 
532 /*
533 #ifdef __UNIX__
534  for ( unsigned i = 0; i < 100; i++ ) {
535  StateList.n[ i ] = 0;
536  }
537 #else
538  // Zero results
539  for ( unsigned listindex = 0; listindex < m_ListNameLength; listindex++ ) {
540  for ( unsigned i = 0; i < 100; i++ ) {
541  Counts[ listindex ] [ i ] = 0;
542  }
543  }
544 #endif
545  // How many animals in each state?
546  for ( unsigned listindex = 0; listindex < TheArray.size(); listindex++ ) {
547  unsigned size = (unsigned) TheArray[ listindex ].size();
548  for ( unsigned j = 0; j < size; j++ ) {
549 #ifdef __UNIX__
550  StateList.n[ TheArray[ listindex ] [ j ]->WhatState() ] ++;
551 #else
552  Counts[ listindex ] [ TheArray[ listindex ] [ j ]->WhatState() ] ++;
553 #endif
554  }
555  }
556 */
557 }

◆ 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

963 {
964  for ( unsigned i = 0; i < TheArray.size(); i++ )
965  {
966  // if objects in the list need to be deleted:
967  for (unsigned j = 0; j < (unsigned) TheArray[i].size(); j++)
968  {
969  delete TheArray[ i ] [ j ];
970  }
971  // empty the array
972  TheArray[ i ].clear();
973  }
974 }

◆ FarmAnimalCensus()

unsigned int Population_Manager::FarmAnimalCensus ( unsigned int  a_farm,
unsigned int  a_typeofanimal 
)
1262 {
1263  unsigned int No = 0;
1264  unsigned sz = (unsigned)GetLiveArraySize( a_typeofanimal );
1265  for ( unsigned j = 0; j < sz; j++ )
1266  {
1267  if (a_farm == TheArray[ a_typeofanimal ] [ j ]->SupplyFarmOwnerRef()) No++;
1268  }
1269  return No;
1270 }

◆ FindClosest()

TAnimal * Population_Manager::FindClosest ( int  x,
int  y,
unsigned  Type 
)

Finds the closest individual to an x,y point

937  {
938  int distance = 100000000;
939  TAnimal * TA = NULL;
940  int dx, dy, d;
941  for (unsigned j = 0; j < (unsigned)GetLiveArraySize( Type ); j++) {
942  dx = TheArray[ Type ] [ j ]->Supply_m_Location_x();
943  dy = TheArray[ Type ] [ j ]->Supply_m_Location_y();
944  dx = ( dx - x );
945  dx *= dx;
946  dy = ( dy - y );
947 
948  dy *= dy;
949  d = dx + dy;
950  if ( d < distance ) {
951  distance = d;
952  TA = TheArray[ Type ] [ j ];
953  }
954  }
955  return TA;
956 }

◆ FledgelingProbeOutput()

virtual void Population_Manager::FledgelingProbeOutput ( int  ,
int   
)
inlinevirtual
654  {
655  }

◆ GeneticsResultsOutput()

virtual void Population_Manager::GeneticsResultsOutput ( FILE *  ,
unsigned   
)
inlinevirtual
658  {
659  }

◆ GetLiveArraySize()

unsigned Population_Manager::GetLiveArraySize ( int  a_listindex)
inline

Gets the number of 'live' objects for a list index in the TheArray.

433  {
434  return m_LiveArraySize[a_listindex];
435  }

References m_LiveArraySize.

◆ GetPopulationType()

TTypesOfPopulation Population_Manager::GetPopulationType ( )
inline
576 { return m_population_type; }

References m_population_type.

◆ GetSeasonNumber()

int Population_Manager::GetSeasonNumber ( )
inline

Get the season number.

578 { return m_SeasonNumber; }

References m_SeasonNumber.

◆ ImpactedProbe()

void Population_Manager::ImpactedProbe ( )
virtual

Special pesticide related probe. Overidden in descendent classes

672  {
673 
674 }

◆ ImpactProbeReport()

void Population_Manager::ImpactProbeReport ( int  a_Time)

Special probe

1321  {
1322 
1323  for ( int ProbeNo = 0; ProbeNo < 1; ProbeNo++ ) {
1324  // See if we need to record/update this one
1325  // if time/months/years ==0 or every time
1326  if ( ( TheProbe[ ProbeNo ]->m_ReportInterval == 3 )
1327  || ( ( TheProbe[ ProbeNo ]->m_ReportInterval == 2 ) && ( BeginningOfMonth() ) )
1328  || ( ( TheProbe[ ProbeNo ]->m_ReportInterval == 1 ) && ( a_Time % 365 == 0 ) ) ) {
1329  ImpactedProbe();
1330  }
1331  }
1332 }

References BeginningOfMonth().

◆ IncLiveArraySize()

void Population_Manager::IncLiveArraySize ( int  a_listindex)
inline

Increments the number of 'live' objects for a list index in the TheArray.

437  {
438  m_LiveArraySize[a_listindex]++;
439  }

References m_LiveArraySize.

◆ IsLast()

bool Population_Manager::IsLast ( unsigned  listindex)
inline
481  {
482  if (TheArray[listindex].size() > 1) return false; else
483  return true;
484  }

References TheArray.

◆ LamdaBirth() [1/2]

void Population_Manager::LamdaBirth ( int  x,
int  y 
)
inline
603  {
604  lamdagrid[0][x / __lgridsize][y / __lgridsize]++;
605  }

References lamdagrid.

◆ LamdaBirth() [2/2]

void Population_Manager::LamdaBirth ( int  x,
int  y,
int  z 
)
inline
606  {
607  lamdagrid[0][x / __lgridsize][y / __lgridsize] += z;
608  }

References lamdagrid.

◆ LamdaClear()

void Population_Manager::LamdaClear ( )
inline
609  {
610  for (int i = 0; i < 257; i++) {
611  for (int j = 0; j < 257; j++) {
612  lamdagrid[0][i][j] = 0;
613  lamdagrid[1][i][j] = 0;
614  }
615  }
616  }

References lamdagrid.

◆ LamdaDeath()

void Population_Manager::LamdaDeath ( int  x,
int  y 
)
inline
599  {
600  // inlined for speed
601  lamdagrid[1][x / __lgridsize][y / __lgridsize]++;
602  }

References lamdagrid.

◆ LamdaDumpOutput()

void Population_Manager::LamdaDumpOutput ( )

Special probe

657  {
658  ofstream fout("LambdaGridOuput.txt", ios_base::app); // open for writing
659  for (int i=0; i<257; i++ ) {
660  for (int j=0; j<257; j++) {
661  fout << lamdagrid[0][i][j] << "\t" << lamdagrid[1][i][j] << endl;
662  }
663  }
664  //fout << "NEXT" << endl;
665  fout.close();
666 }

◆ 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

294  {
295  FILE * PFile = fopen(fname, "w" );
296  if (PFile) {
297  m_TheLandscape->Warn("PopulationManager::LOG - Could not open file ",fname);
298  exit(0);
299  }
300  AnimalPosition AP;
301  for ( unsigned listindex = 0; listindex < TheArray.size(); listindex++ ) {
302 #ifndef __BCB__
303  fprintf( PFile, "%s :\n", m_ListNames[ listindex ] );
304 #else
305  fprintf( PFile, "%s :\n", m_ListNames[ listindex ].c_str() );
306 #endif
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 );
310  }
311  }
312  fclose( PFile );
313 }

References AnimalPosition::m_x, and AnimalPosition::m_y.

◆ OpenTheAOROutputProbe()

void Population_Manager::OpenTheAOROutputProbe ( string  a_AORFilename)

open the AOR Grid probe

771  {
772  m_AOR_Probe = new AOR_Probe(this, m_TheLandscape, a_AORFilename);
773 }

◆ OpenTheBreedingPairsProbe()

virtual bool Population_Manager::OpenTheBreedingPairsProbe ( )
inlinevirtual
635  {
636  return false;
637  }

Referenced by CreatePopulationManager().

◆ OpenTheBreedingSuccessProbe()

virtual bool Population_Manager::OpenTheBreedingSuccessProbe ( )
inlinevirtual
638  {
639  return false;
640  }

Referenced by CreatePopulationManager().

◆ OpenTheFledgelingProbe()

virtual bool Population_Manager::OpenTheFledgelingProbe ( )
inlinevirtual
632  {
633  return false;
634  }

Referenced by CreatePopulationManager().

◆ OpenTheMonthlyRipleysOutputProbe()

bool Population_Manager::OpenTheMonthlyRipleysOutputProbe ( )

open 12 ripley output probles, one for each month

778  {
779  RipleysOutputPrb1 = fopen("RipleyOutput_Jan.txt", "w" );
780  if ( !RipleysOutputPrb1 ) {
781  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
782  cfg_RipleysOutput_filename.value() );
783  exit( 1 );
784  }
785  RipleysOutputPrb2 = fopen("RipleyOutput_Feb.txt", "w" );
786  if ( !RipleysOutputPrb2 ) {
787  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
788  cfg_RipleysOutput_filename.value() );
789  exit( 1 );
790  }
791  RipleysOutputPrb3 = fopen("RipleyOutput_Mar.txt", "w" );
792  if ( !RipleysOutputPrb3 ) {
793  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
794  cfg_RipleysOutput_filename.value() );
795  exit( 1 );
796  }
797  RipleysOutputPrb4 = fopen("RipleyOutput_Apr.txt", "w" );
798  if ( !RipleysOutputPrb4 ) {
799  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
800  cfg_RipleysOutput_filename.value() );
801  exit( 1 );
802  }
803  RipleysOutputPrb5 = fopen("RipleyOutput_May.txt", "w" );
804  if ( !RipleysOutputPrb5 ) {
805  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
806  cfg_RipleysOutput_filename.value() );
807  exit( 1 );
808  }
809  RipleysOutputPrb6 = fopen("RipleyOutput_Jun.txt", "w" );
810  if ( !RipleysOutputPrb6 ) {
811  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
812  cfg_RipleysOutput_filename.value() );
813  exit( 1 );
814  }
815  RipleysOutputPrb7 = fopen("RipleyOutput_Jul.txt", "w" );
816  if ( !RipleysOutputPrb7 ) {
817  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
818  cfg_RipleysOutput_filename.value() );
819  exit( 1 );
820  }
821  RipleysOutputPrb8 = fopen("RipleyOutput_Aug.txt", "w" );
822  if ( !RipleysOutputPrb8 ) {
823  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
824  cfg_RipleysOutput_filename.value() );
825  exit( 1 );
826  }
827  RipleysOutputPrb9 = fopen("RipleyOutput_Sep.txt", "w" );
828  if ( !RipleysOutputPrb9 ) {
829  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
830  cfg_RipleysOutput_filename.value() );
831  exit( 1 );
832  }
833  RipleysOutputPrb10 = fopen("RipleyOutput_Oct.txt", "w" );
834  if ( !RipleysOutputPrb10 ) {
835  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
836  cfg_RipleysOutput_filename.value() );
837  exit( 1 );
838  }
839  RipleysOutputPrb11 = fopen("RipleyOutput_Nov.txt", "w" );
840  if ( !RipleysOutputPrb11 ) {
841  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
842  cfg_RipleysOutput_filename.value() );
843  exit( 1 );
844  }
845  RipleysOutputPrb12 = fopen("RipleyOutput_Dec.txt", "w" );
846  if ( !RipleysOutputPrb12 ) {
847  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
848  cfg_RipleysOutput_filename.value() );
849  exit( 1 );
850  }
851  return true;
852 }

References cfg_RipleysOutput_filename().

◆ OpenTheReallyBigProbe()

bool Population_Manager::OpenTheReallyBigProbe ( )

open the probe

859  {
860  ReallyBigOutputPrb = fopen(cfg_ReallyBigOutput_filename.value(), "w" );
861  if ( !ReallyBigOutputPrb ) {
862  g_msg->Warn( WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
864  exit( 1 );
865  }
866  return true;
867 }

References cfg_ReallyBigOutput_filename().

◆ OpenTheRipleysOutputProbe()

bool Population_Manager::OpenTheRipleysOutputProbe ( string  a_NWordFilename)

open the Ripley probe

757  {
758  RipleysOutputPrb = fopen(cfg_RipleysOutput_filename.value(), "w");
759  if (!RipleysOutputPrb) {
760  g_msg->Warn(WARN_FILE, "Population_Manager::OpenTheRipleysOutputProbe(): ""Unable to open probe file",
762  exit(1);
763  }
764  return true;
765 }

References cfg_RipleysOutput_filename().

◆ PartitionLiveDead()

unsigned Population_Manager::PartitionLiveDead ( unsigned  Type)
protected

Sort TheArray w.r.t. the current state attribute in reverse order

1015  {
1016  auto it = partition(TheArray[Type].begin(), TheArray[Type].begin() + m_LiveArraySize[Type], CompareStateAlive());
1017  // it now points at the first dead element
1018  // the number of live ones before it is it-TheArray[Type].begin(). This is the new vector size for live animals.
1019  return unsigned(it - TheArray[Type].begin());
1020 }

◆ Probe()

float Population_Manager::Probe ( int  ListIndex,
probe_data p_TheProbe 
)
virtual

Default data probe. Rarely used in actuality but always available

680  {
681  // Counts through the list and goes through each area to see if the animal
682  // is standing there and if the farm, veg or element conditions are met
683  AnimalPosition Sp;
684  float NumberSk = 0;
685  // Four possibilites
686  // either NoVegTypes or NoElementTypes or NoFarmTypes is >0 or all==0
687  if ( p_TheProbe->m_NoFarms != 0 ) {
688  for (unsigned j = 0; j < (unsigned)GetLiveArraySize( ListIndex ); j++) {
689  Sp = TheArray[ ListIndex ] [ j ]->SupplyPosition();
690  unsigned Farm = TheArray[ ListIndex ] [ j ]->SupplyFarmOwnerRef();
691  for ( unsigned i = 0; i < p_TheProbe->m_NoAreas; i++ ) {
692  if ( ( Sp.m_x >= p_TheProbe->m_Rect[ i ].m_x1 ) && ( Sp.m_y >= p_TheProbe->m_Rect[ i ].m_y1 )
693  && ( Sp.m_x <= p_TheProbe->m_Rect[ i ].m_x2 ) && ( Sp.m_y <= p_TheProbe->m_Rect[ i ].m_y2 ) )
694  for ( unsigned k = 0; k < p_TheProbe->m_NoFarms; k++ ) {
695  if ( p_TheProbe->m_RefFarms[ k ] == Farm )
696  NumberSk++; // it is in the square so increment number
697  }
698 
699  }
700  }
701  } else if ( p_TheProbe->m_NoEleTypes != 0 ) {
702  for (unsigned j = 0; j < (unsigned)GetLiveArraySize( ListIndex ); j++) {
703  Sp = TheArray[ ListIndex ] [ j ]->SupplyPosition();
704  for ( unsigned i = 0; i < p_TheProbe->m_NoAreas; i++ ) {
705  if ( ( Sp.m_x >= p_TheProbe->m_Rect[ i ].m_x1 ) && ( Sp.m_y >= p_TheProbe->m_Rect[ i ].m_y1 )
706  && ( Sp.m_x <= p_TheProbe->m_Rect[ i ].m_x2 ) && ( Sp.m_y <= p_TheProbe->m_Rect[ i ].m_y2 ) )
707  for ( unsigned k = 0; k < p_TheProbe->m_NoEleTypes; k++ ) {
708  if ( p_TheProbe->m_RefEle[ k ] == Sp.m_EleType )
709  NumberSk++; // it is in the square so increment number
710  }
711  }
712  }
713  } else {
714  if ( p_TheProbe->m_NoVegTypes != 0 ) {
715  for (unsigned j = 0; j < (unsigned)GetLiveArraySize( ListIndex ); j++) {
716  Sp = TheArray[ ListIndex ] [ j ]->SupplyPosition();
717 
718  for ( unsigned i = 0; i < p_TheProbe->m_NoAreas; i++ ) {
719  if ( ( Sp.m_x >= p_TheProbe->m_Rect[ i ].m_x1 ) && ( Sp.m_y >= p_TheProbe->m_Rect[ i ].m_y1 )
720  && ( Sp.m_x <= p_TheProbe->m_Rect[ i ].m_x2 ) && ( Sp.m_y <= p_TheProbe->m_Rect[ i ].m_y2 ) ) {
721  for ( unsigned k = 0; k < p_TheProbe->m_NoVegTypes; k++ ) {
722  if ( p_TheProbe->m_RefVeg[ k ] == Sp.m_VegType )
723  NumberSk++; // it is in the square so increment number
724  }
725  }
726  }
727  }
728  } else // both must be zero
729  {
730  unsigned sz = (unsigned)GetLiveArraySize( ListIndex );
731  // It is worth checking whether we have a total dump of all individuals
732  // if so don't bother with asking each where it is
733  if (p_TheProbe->m_NoAreas==1) {
734  if ((p_TheProbe->m_Rect[0].m_x1==0) && (p_TheProbe->m_Rect[0].m_y1==0) && (p_TheProbe->m_Rect[0].m_x2==(unsigned)SimW) &&
735  (p_TheProbe->m_Rect[0].m_y2==(unsigned)SimH)) {
736  return (float) sz;
737  }
738  }
739  // Asking for a subset - need to test them all
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++ ) {
743  if ( ( Sp.m_x >= p_TheProbe->m_Rect[ i ].m_x1 ) && ( Sp.m_y >= p_TheProbe->m_Rect[ i ].m_y1 )
744  && ( Sp.m_x <= p_TheProbe->m_Rect[ i ].m_x2 ) && ( Sp.m_y <= p_TheProbe->m_Rect[ i ].m_y2 ) )
745  NumberSk++; // it is in the square so increment number
746  }
747  }
748  }
749  }
750  return NumberSk;
751 }

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

574  {
575  FILE * PFile;
576  int data = 0;
577  int data2 = 0;
578  char S[ 255 ];
579  PFile = fopen(p_Filename, "r" );
580  if ( !PFile ) {
581  m_TheLandscape->Warn( "Population Manager - cannot open Probe File ", p_Filename );
582  exit( 0 );
583  }
584  fgets( S, 255, PFile ); // dummy line
585  fgets( S, 255, PFile ); // dummy line
586  fscanf( PFile, "%d\n", & data ); // Reporting interval
587  TheProbe[ p_ProbeNo ]->m_ReportInterval = data;
588  fgets( S, 255, PFile ); // dummy line
589  fscanf( PFile, "%d\n", & data ); // Write to file
590  if ( data == 0 ) TheProbe[ p_ProbeNo ]->m_FileRecord = false; else
591  TheProbe[ p_ProbeNo ]->m_FileRecord = true;
592  fgets( S, 255, PFile ); // dummy line
593  for ( int i = 0; i < 10; i++ ) {
594  fscanf( PFile, "%d", & data );
595  if ( data > 0 ) TheProbe[ p_ProbeNo ]->m_TargetTypes[ i ] = true; else
596  TheProbe[ p_ProbeNo ]->m_TargetTypes[ i ] = false;
597  }
598 
599  fgets( S, 255, PFile ); // dummy line
600  fgets( S, 255, PFile ); // dummy line
601  fscanf( PFile, "%d", & data );
602  TheProbe[ p_ProbeNo ]->m_NoAreas = data;
603  fgets( S, 255, PFile ); // dummy line
604  fgets( S, 255, PFile ); // dummy line
605  fscanf( PFile, "%d", & data2 ); // No References areas
606  fgets( S, 255, PFile ); // dummy line
607  fgets( S, 255, PFile ); // dummy line
608  fscanf( PFile, "%d", & data ); // Type reference for probe
609  if ( data == 1 ) TheProbe[ p_ProbeNo ]->m_NoEleTypes = data2; else
610  TheProbe[ p_ProbeNo ]->m_NoEleTypes = 0;
611  if ( data == 2 ) TheProbe[ p_ProbeNo ]->m_NoVegTypes = data2; else
612  TheProbe[ p_ProbeNo ]->m_NoVegTypes = 0;
613  if ( data == 3 ) TheProbe[ p_ProbeNo ]->m_NoFarms = data2; else
614  TheProbe[ p_ProbeNo ]->m_NoFarms = 0;
615  fgets( S, 255, PFile ); // dummy line
616  fgets( S, 255, PFile ); // dummy line
617  // Now read in the areas data
618  for ( int i = 0; i < 10; i++ ) {
619  fscanf( PFile, "%d", & data );
620  TheProbe[ p_ProbeNo ]->m_Rect[ i ].m_x1 = data;
621  fscanf( PFile, "%d", & data );
622  TheProbe[ p_ProbeNo ]->m_Rect[ i ].m_y1 = data;
623  fscanf( PFile, "%d", & data );
624  TheProbe[ p_ProbeNo ]->m_Rect[ i ].m_x2 = data;
625  fscanf( PFile, "%d", & data );
626  TheProbe[ p_ProbeNo ]->m_Rect[ i ].m_y2 = data;
627  }
628  fgets( S, 255, PFile ); // dummy line
629  fgets( S, 255, PFile ); // dummy line
630  if ( TheProbe[ p_ProbeNo ]->m_NoVegTypes > 0 ) {
631  for ( int i = 0; i < 25; i++ ) {
632  fscanf( PFile, "%d", & data );
633  if ( data != 999 )
634  TheProbe[ p_ProbeNo ]->m_RefVeg[ i ] = m_TheLandscape->TranslateVegTypes( data );
635  }
636  } else if ( TheProbe[ p_ProbeNo ]->m_NoFarms > 0 ) {
637  for ( int i = 0; i < 25; i++ ) {
638  fscanf( PFile, "%d", & data );
639  if ( data != 999 )
640  TheProbe[ p_ProbeNo ]->m_RefFarms[ i ] = data;
641  }
642  } else {
643  for ( int i = 0; i < 25; i++ ) {
644  fscanf( PFile, "%d", & data );
645  if ( data != 999 ) TheProbe[ p_ProbeNo ]->m_RefEle[ i ] = m_TheLandscape->TranslateEleTypes( data );
646  }
647  }
648  fclose( PFile );
649  return data2; // number of data references
650 }

Referenced by GetProbeInput_ini().

◆ ProbeReport()

char * Population_Manager::ProbeReport ( int  a_time)
1273  {
1274 
1275  int No;
1276  char str[100]; // 100 out to be enough!!
1277  strcpy(g_str,"");
1278  for ( int ProbeNo = 0; ProbeNo < m_NoProbes; ProbeNo++ ) {
1279  No = 0;
1280  // See if we need to record/update this one
1281  // if time/months/years ==0 or every time
1282  if ( ( TheProbe[ ProbeNo ]->m_ReportInterval == 3 )
1283  || ( ( TheProbe[ ProbeNo ]->m_ReportInterval == 2 ) && ( BeginningOfMonth() ) )
1284  || ( ( TheProbe[ ProbeNo ]->m_ReportInterval == 1 ) && ( Time % 365 == 0 ) ) ) {
1285  // Goes through each area and sends a value to OutputForm
1286  unsigned Index = SupplyListIndexSize();
1287  for ( unsigned listindex = 0; listindex < Index; listindex++ ) {
1288  if ( TheProbe[ ProbeNo ]->m_TargetTypes[ listindex ] )
1289  No += (int) Probe( listindex, TheProbe[ ProbeNo ] );
1290  }
1291  TheProbe[ ProbeNo ]->FileOutput( No, Time, ProbeNo );
1292  sprintf(str," %d ", No );
1293  strcat(g_str,str);
1294  }
1295  }
1296  return g_str;
1297 }

References BeginningOfMonth(), and g_str.

◆ ProbeReportTimed()

char * Population_Manager::ProbeReportTimed ( int  a_time)
1300  {
1301  int No;
1302  char str[100]; // 100 ought to be enough!!
1303  strcpy(g_str,"");
1304  for ( int ProbeNo = 0; ProbeNo < m_NoProbes; ProbeNo++ ) {
1305  No = 0;
1306  unsigned Index = SupplyListIndexSize();
1307  for ( unsigned listindex = 0; listindex < Index; listindex++ ) {
1308  if ( TheProbe[ ProbeNo ]->m_TargetTypes[ listindex ] ) No += (int) Probe( listindex, TheProbe[ ProbeNo ] );
1309  }
1310  TheProbe[ ProbeNo ]->FileOutput( No, Time, ProbeNo );
1311  sprintf(str," %d ", No );
1312  strcat(g_str,str);
1313  }
1314  return g_str;
1315 }

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.

337  {
341  for ( int TSteps = 0; TSteps < NoTSteps; TSteps++ )
342  {
343  unsigned size2;
344  unsigned size1 = (unsigned) TheArray.size();
349  for ( unsigned listindex = 0; listindex < size1; listindex++ )
350  {
351  // Must check each object in the list for m_CurrentStateNo==-1
352  m_LiveArraySize[listindex] = PartitionLiveDead(listindex);
353  }
354 #ifdef __ALMASS_VISUAL
355  if (m_MainForm!=NULL)
356  {
357  int n = 0;
358  for ( unsigned listindex = 0; listindex < size1; listindex++ ) n += (int) m_LiveArraySize[ listindex ];
360  //if (n>0) DisplayLocations();
361  }
362 #endif
363  // begin step actions ...
364  // set all stepdone to false.... is this really necessary??
365  for ( unsigned listindex = 0; listindex < size1; listindex++ )
366  {
367  size2 = (unsigned) GetLiveArraySize(listindex);
368  for ( unsigned j = 0; j < size2; j++ )
369  {
370  TheArray[ listindex ] [ j ]->SetStepDone( false );
371  }
372  }
373 
374  for ( unsigned listindex = 0; listindex < size1; listindex++ ) {
375  // Call the Shuffle/Sort procedures
376  Shuffle_or_Sort( listindex );
377  }
378  // Need to check if Ripleys Statistic needs to be saved
379  if (cfg_RipleysOutput_used.value()) {
380  int Year = m_TheLandscape->SupplyYearNumber();
381  if (Year >= cfg_RipleysOutputFirstYear.value()) {
382  if (Year % cfg_RipleysOutput_interval.value() == 0) {
383  int day = m_TheLandscape->SupplyDayInYear();
384  if (cfg_RipleysOutput_day.value() == day) {
385  // Do the Ripley Probe
387  }
388  }
389  }
390  }
391  // Need to check if AOR output needs to be saved
392  if (cfg_AOROutput_used.value()) {
393  int Year = m_TheLandscape->SupplyYearNumber();
394  if (Year >= cfg_AOROutputFirstYear.value()) {
395  if (Year % cfg_AOROutput_interval.value() == 0) {
396  int day = m_TheLandscape->SupplyDayInYear();
397  if (cfg_AOROutput_day.value() == day) {
398  // Do the AOR Probe
400  }
401  }
402  }
403  }
404  // Need to check if Monthly Ripleys Statistic needs to be saved
405  if ( cfg_RipleysOutputMonthly_used.value() ) {
406  if (m_TheLandscape->SupplyDayInMonth()==1) {
407  int Year = m_TheLandscape->SupplyYearNumber();
408  if (Year>=cfg_RipleysOutputFirstYear.value()) {
409  if ( Year % cfg_RipleysOutput_interval.value() == 0 ) {
410  int month = m_TheLandscape->SupplyMonth();
411  // Do the Ripley Probe
412  switch (month) {
414  break;
416  break;
418  break;
420  break;
422  break;
424  break;
426  break;
428  break;
430  break;
432  break;
434  break;
436  break;
437  }
438  }
439  }
440  }
441  }
442  // Need to check if Really Big Probe needs to be saved
443  if ( cfg_ReallyBigOutput_used.value() ) {
444  int Year = m_TheLandscape->SupplyYearNumber();
445  if (Year>=cfg_ReallyBigOutputFirstYear.value()) {
446  if ( Year % cfg_ReallyBigOutput_interval.value() == 0 ) {
447  int day = m_TheLandscape->SupplyDayInYear();
448  if (( cfg_ReallyBigOutput_day1.value() == day )|| ( cfg_ReallyBigOutput_day2.value() == day )|| ( cfg_ReallyBigOutput_day3.value() == day )|| ( cfg_ReallyBigOutput_day4.value() == day )||( cfg_ReallyBigOutput_day1.value() == -1 ))
449  {
450  // Do the Ripley Probe
452  }
453  }
454  }
455  }
457  if ( yr > cfg_CatastropheEventStartYear.value() ) {
459  Catastrophe(); // This method must be overidden in descendent classes
460  }
461  DoFirst();
462  // call the begin-step-method of all objects
463  for ( unsigned listindex = 0; listindex < size1; listindex++ ) {
464  size2 = (unsigned)GetLiveArraySize( listindex );
465  for (unsigned j = 0; j < size2; j++)
466  TheArray[ listindex ] [ j ]->BeginStep();
467  }
468  DoBefore();
469  // call the step-method of all objects
470  do {
471  for ( unsigned listindex = 0; listindex < size1; listindex++ ) {
472  size2 = (unsigned)GetLiveArraySize( listindex );
473  for (unsigned j = 0; j < size2; j++) {
474  TheArray[ listindex ] [ j ]->Step();
475  }
476  } // for listindex
477  } while ( !StepFinished() );
478  DoAfter();
479  // call the end-step-method of all objects
480  for ( unsigned listindex = 0; listindex < size1; listindex++ ) {
481  size2 = (unsigned)GetLiveArraySize( listindex );
482  for (unsigned j = 0; j < size2; j++) {
483  TheArray[ listindex ] [ j ]->EndStep();
484  }
485  }
486  // ----------------
487  // end of this step actions
488  // For each animal list
489  DoAlmostLast();
490 
491 DoLast();
492  } // End of time step loop
493 }

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
431 { m_NoProbes = a_pn; }

References m_NoProbes.

Referenced by CreatePopulationManager().

◆ Shuffle()

void Population_Manager::Shuffle ( unsigned  Type)
protected

Run once through the list swapping randomly chosen elements

1055  {
1056  unsigned s = (unsigned)GetLiveArraySize( Type );
1057  for ( unsigned i = 0; i < s; i++ ) {
1058  TAnimal * temp;
1059  unsigned a = random( s );
1060  unsigned b = random( s );
1061  temp = TheArray[ Type ] [ a ];
1062  TheArray[ Type ] [ a ] = TheArray[ Type ] [ b ];
1063  TheArray[ Type ] [ b ] = temp;
1064  }
1065 }

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

1073  {
1074  switch ( BeforeStepActions[ Type ] ) {
1075  case 0:
1076  Shuffle( Type );
1077  break;
1078  case 1:
1079  SortX( Type );
1080  break;
1081  case 2:
1082  SortY( Type );
1083  break;
1084  case 3:
1085  SortXIndex( Type );
1086  break;
1087  case 4: // Do nothing
1088  break;
1089  case 5:
1090  if (g_rand_uni() < double (1/500)) Shuffle( Type );
1091  break;
1092  default:
1093  m_TheLandscape->Warn( "Population_Manager::Shuffle_or_Sort- BeforeStepAction Unknown", NULL );
1094  exit( 1 );
1095  }
1096 }

References g_rand_uni.

◆ SortState()

void Population_Manager::SortState ( unsigned  Type)
protected

Sort TheArray w.r.t. the current state attribute

999  {
1000  sort( TheArray[ Type ].begin(), TheArray[ Type ].end(), CompareState() );
1001 }

◆ SortStateR()

void Population_Manager::SortStateR ( unsigned  Type)
protected

Sort TheArray w.r.t. the current state attribute in reverse order

1008  {
1009  sort(TheArray[Type].begin(), TheArray[Type].begin()+m_LiveArraySize[Type], CompareStateR());
1010 }

◆ SortX()

void Population_Manager::SortX ( unsigned  Type)
protected

Sort TheArray w.r.t. the m_Location_x attribute

979  {
980  vector<TAnimal*>::iterator nth = TheArray[Type].begin() + m_LiveArraySize[Type];
981  sort( TheArray[ Type ].begin(), nth, CompareX() );
982 }

◆ SortXIndex()

void Population_Manager::SortXIndex ( unsigned  Type)
protected

Sort TheArray w.r.t. the m_Location_x attribute, and make an indexing array

1027  {
1028  vector<TAnimal*>::iterator nth = TheArray[Type].begin() + m_LiveArraySize[Type];
1029  sort(TheArray[Type].begin(), nth, CompareX());
1030  unsigned s = (unsigned)GetLiveArraySize( Type );
1031  // Now make the index array to X;
1032  int counter = 0;
1033  int x;
1034  // for each individual
1035  for ( unsigned i = 0; i < s; i++ ) {
1036  // Get Next co-ordiated
1037  x = TheArray[ Type ] [ i ]->Supply_m_Location_x();
1038  // fill gaps up to x
1039  while ( counter < x ) IndexArrayX[ Type ] [ counter++ ] = -1;
1040  if ( x == counter ) {
1041  IndexArrayX[ Type ] [ counter++ ] = i;
1042  }
1043  }
1044  // Fill up the rest of the array with -1;
1045  for ( int c = counter; c < 10000; c++ ) {
1046  IndexArrayX[ Type ] [ c ] = -1;
1047  }
1048 }

◆ SortY()

void Population_Manager::SortY ( unsigned  Type)
protected

Sort TheArray w.r.t. the m_Location_y attribute

989  {
990  vector<TAnimal*>::iterator nth = TheArray[Type].begin() + m_LiveArraySize[Type];
991  sort(TheArray[Type].begin(), nth, CompareY());
992 }

◆ 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

1121  {
1122  strcpy(g_str,"");
1123 // Vole Model
1124  if ( a_species == 1 ) {
1125 /*
1126 // The next lines are obselete code from genetic simulations
1127 float MeanNoAlleles;
1128  float MeanHO;
1129  float MeanHE;
1130  unsigned size;
1131 
1132  if ( m_time % ( 365 * 24 * 60 ) == 0 ) // End of year
1133  {
1134 
1135  // empty the GenStruc data
1136  for ( int ProbeNo = 0; ProbeNo < ( int )m_NoProbes; ProbeNo++ ) {
1137  fprintf( m_GeneticsFile, "%d ", m_time );
1138  int TotalSize = 0;
1139  m_AManager->AlFreq->Flush();
1140  for ( unsigned listindex = 0; listindex <= 1; listindex++ ) {
1141  size = 0;
1142  m_AManager->TheGeneticProbe( listindex, ProbeNo, size );
1143  TotalSize += size;
1144  }
1145  if ( TotalSize > 0 ) {
1146  m_AManager->AlFreq->CalcAF();
1147  m_AManager->AlFreq->CalcNoAlleles();
1148  m_AManager->AlFreq->CalcHE();
1149  m_AManager->AlFreq->CalcHO( TotalSize );
1150  }
1151  // Get the means
1152  // For N alleles
1153  int NA = 0;
1154  float NHO = 0;
1155  float NHE = 0;
1156  for ( int l = 0; l < 16; l++ ) {
1157  NA += m_AManager->AlFreq->SupplyNoAlleles( l );
1158  }
1159  MeanNoAlleles = ( float )NA / 16.0;
1160  for ( int l = 0; l < 16; l++ ) {
1161  NHO += m_AManager->AlFreq->SupplyHO( l );
1162  }
1163  MeanHO = NHO / 16.0;
1164  for ( int l = 0; l < 16; l++ ) {
1165  NHE += m_AManager->AlFreq->SupplyHE( l );
1166  }
1167  MeanHE = NHE / 16.0;
1168 
1169  // Do some output
1170  // Output is to two files, the genetics file and the AllelerequencyFile
1171  fprintf( m_GeneticsFile, "%2.2f ", MeanNoAlleles );
1172  fprintf( m_GeneticsFile, "%1.3f ", MeanHO );
1173  fprintf( m_GeneticsFile, "%1.3f ", MeanHE );
1174  for ( int l = 0; l < 16; l++ ) {
1175  fprintf( m_GeneticsFile, "%04i ", m_AManager->AlFreq->SupplyNoAlleles( l ) );
1176  }
1177  for ( int l = 0; l < 16; l++ ) {
1178  fprintf( m_GeneticsFile, "%1.3f ", m_AManager->AlFreq->SupplyHO( l ) );
1179  }
1180  for ( int l = 0; l < 16; l++ ) {
1181  fprintf( m_GeneticsFile, "%1.3f ", m_AManager->AlFreq->SupplyHE( l ) );
1182  }
1183  fprintf( m_GeneticsFile, "\n" );
1184  fprintf( m_AlleleFreqsFile, "%d ", m_time );
1185  for ( int l = 0; l < 16; l++ ) {
1186  for ( int al = 0; al < 4; al++ ) {
1187  fprintf( m_AlleleFreqsFile, "%1.3f ", m_AManager->AlFreq->SupplyAF( l, al ) );
1188  }
1189  }
1190  fprintf( m_AlleleFreqsFile, "\n" );
1191  }
1192  // make sure progress reaches the disk
1193  fflush( m_GeneticsFile );
1194  fflush( m_AlleleFreqsFile );
1195  }
1196 
1197  if ( cfg_UseEasyPop.value()) {
1198  int targettime=a_time % ( 365 * 100 );
1199  if ( ( targettime == 59 ) ||(targettime == 181)||(targettime ==304)||(targettime ==59+365)||(targettime ==181+365)||(targettime ==304+365)) {
1200  for ( unsigned listindex = 0; listindex <= 1; listindex++ ) {
1201  GeneticsResultsOutput( m_EasyPopRes, listindex);
1202  }
1203  fflush( m_EasyPopRes );
1204  }
1205  }
1206 */
1207  /* Three times a year reporting
1208  if ( m_time % 365 == 60 ) ProbeReportNow( m_time );
1209  if ( m_time % 365 == 152 ) ProbeReportNow( m_time );
1210  if ( m_time % 365 == 273 ) ProbeReportNow( m_time ); */
1211  ProbeReport( a_time );
1212 #ifdef __SpecificPesticideEffectsVinclozolinLike__
1213  ImpactProbeReport( a_time );
1214 #endif
1215 #ifdef __WithinOrchardPesticideSim__
1216  ImpactProbeReport( a_time );
1217 #endif
1218 
1219  }
1220  // Skylark Model
1221  else if ( a_species == 0 ) {
1222  int No;
1223  int a_day = a_time % 365;
1224  if ( a_time % 365 == 364 )
1225  {
1226  //Write the Breeding Attempts Probe
1227  int BreedingFemales, YoungOfTheYear, TotalPop, TotalFemales, TotalMales, BreedingAttempts;
1228  No = TheBreedingSuccessProbe( BreedingFemales, YoungOfTheYear, TotalPop, TotalFemales, TotalMales, BreedingAttempts );
1229  float bs = 0;
1230  if ( BreedingFemales > 0 ) {
1231  bs = No / ( float )BreedingFemales; //bs = successful breeding attempt per attempting to breed female
1232  }
1233  BreedingSuccessProbeOutput( bs, BreedingFemales, YoungOfTheYear, TotalPop,
1234  TotalFemales, TotalMales, a_time, BreedingAttempts );
1235  }
1236  if ( a_day == 152 ) {
1237  // Need to fill in the landscape from 1st June, it will change before
1238  // the count of fledgelings is needed
1240  }
1241  if ( a_day == 197 ) {
1242  for ( int ProbeNo = 0; ProbeNo < m_NoProbes; ProbeNo++ ) {
1243  No = TheFledgelingProbe();
1244  // Do some output
1245  FledgelingProbeOutput( No, a_time );
1246  }
1247  }
1248 #ifdef __SKPOM
1249  // This is clunky but for purposes of validation we want probes throughout the year
1250  // First get the breeding pairs data.
1251  BreedingPairsOutput(a_day);
1252 #else
1253  ProbeReport( a_time );
1254 #endif
1255  }
1256  else return ProbeReport( a_time );
1257  return g_str;
1258 }

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

498  {
499  for ( unsigned listindex = 0; listindex < TheArray.size(); listindex++ ) {
500  for (unsigned j = 0; j < (unsigned)GetLiveArraySize( listindex ); j++) {
501  if ( TheArray[ listindex ] [ j ]->GetStepDone() == false ) {
502  return false;
503  }
504  }
505  }
506  return true;
507 }

◆ 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.

465  {
466  return TheArray[a_index][a_animal];
467  }

References TheArray.

◆ SupplyCovPosx()

virtual int Population_Manager::SupplyCovPosx ( int  )
inlinevirtual
626  {
627  return 0;
628  }

◆ SupplyCovPosy()

virtual int Population_Manager::SupplyCovPosy ( int  )
inlinevirtual
629  {
630  return 0;
631  }

◆ SupplyListIndexSize()

unsigned Population_Manager::SupplyListIndexSize ( )
inline
468  {
469  return (unsigned)TheArray.size();
470  }

References TheArray.

◆ SupplyListName()

const char* Population_Manager::SupplyListName ( int  i)
inline
478  {
479  return m_ListNames[i];
480  }

References m_ListNames.

◆ SupplyListNameLength()

int Population_Manager::SupplyListNameLength ( )
inline
461  {
462  return m_ListNameLength;
463  }

References m_ListNameLength.

◆ SupplyListSize()

unsigned Population_Manager::SupplyListSize ( unsigned  listindex)
inline
471  {
472  return (unsigned)TheArray[listindex].size();
473  }

References TheArray.

◆ SupplyLocXY()

virtual void Population_Manager::SupplyLocXY ( unsigned  listindex,
unsigned  j,
int x,
int y 
)
inlinevirtual
493  {
494  x = TheArray[listindex][j]->Supply_m_Location_x();
495  y = TheArray[listindex][j]->Supply_m_Location_y();
496  }

References TheArray.

◆ SupplyPegPosx()

virtual int Population_Manager::SupplyPegPosx ( int  )
inlinevirtual
620  {
621  return 0;
622  }

◆ SupplyPegPosy()

virtual int Population_Manager::SupplyPegPosy ( int  )
inlinevirtual
623  {
624  return 0;
625  }

◆ SupplySimH()

int Population_Manager::SupplySimH ( )
inline
455  {
456  return SimH;
457  }

References SimH.

◆ SupplySimW()

int Population_Manager::SupplySimW ( )
inline
452  {
453  return SimW;
454  }

References SimW.

◆ SupplyState()

int Population_Manager::SupplyState ( unsigned  listindex,
unsigned  j 
)
inline

IntArray100 * SupplyStateList() { return & StateList; }

490  {
491  return TheArray[listindex][j]->WhatState();
492  }

References TheArray.

◆ SupplyStateNames()

const char* Population_Manager::SupplyStateNames ( int  i)
inline
497  {
498  return StateNames[i];
499  }

References StateNames.

◆ SupplyStateNamesLength()

unsigned Population_Manager::SupplyStateNamesLength ( )
inline
500  {
501  return StateNamesLength;
502  }

References StateNamesLength.

◆ SupplyStepSize()

int Population_Manager::SupplyStepSize ( )
inline
449  {
450  return m_StepSize;
451  }

References m_StepSize.

◆ TheAOROutputProbe()

void Population_Manager::TheAOROutputProbe ( )
virtual

This method must be overridden in descendent classes

924  {
925 }

◆ TheBreedingFemalesProbe()

virtual int Population_Manager::TheBreedingFemalesProbe ( int  )
inlinevirtual
643  {
644  return 0;
645  }

◆ TheBreedingSuccessProbe()

virtual int Population_Manager::TheBreedingSuccessProbe ( int ,
int ,
int ,
int ,
int ,
int  
)
inlinevirtual
651  {
652  return 0;
653  }

◆ TheFledgelingProbe()

virtual int Population_Manager::TheFledgelingProbe ( )
inlinevirtual
646  {
647  return 0;
648  }

◆ TheGeneticProbe()

virtual void Population_Manager::TheGeneticProbe ( unsigned  ,
int  ,
unsigned &   
)
inlinevirtual
656  {
657  }

◆ TheReallyBigOutputProbe()

void Population_Manager::TheReallyBigOutputProbe ( )
virtual

This method must be overridden in descendent classes

913  {
914 }

◆ TheRipleysOutputProbe()

void Population_Manager::TheRipleysOutputProbe ( FILE *  a_prb)
virtual

This method must be overridden in descendent classes

918  {
919 }

Member Data Documentation

◆ 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

Referenced by LamdaBirth(), LamdaClear(), and LamdaDeath().

◆ 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

Referenced by SupplyListNameLength().

◆ m_ListNames

const char* Population_Manager::m_ListNames[32]
protected

Referenced by SupplyListName().

◆ m_LiveArraySize

vector<unsigned> Population_Manager::m_LiveArraySize
protected

◆ m_NoProbes

int Population_Manager::m_NoProbes
protected

Referenced by SetNoProbes().

◆ m_population_type

TTypesOfPopulation Population_Manager::m_population_type
protected

Referenced by GetPopulationType().

◆ 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

Referenced by SupplyStepSize().

◆ 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

Referenced by SupplySimH().

◆ SimHH

unsigned Population_Manager::SimHH

◆ SimW

int Population_Manager::SimW

Referenced by SupplySimW().

◆ SimWH

unsigned Population_Manager::SimWH

◆ StateNames

const char* Population_Manager::StateNames[100]
protected

Referenced by SupplyStateNames().

◆ StateNamesLength

unsigned Population_Manager::StateNamesLength
protected

Referenced by SupplyStateNamesLength().

◆ TestFile

FILE* Population_Manager::TestFile
protected

◆ TestFile2

FILE* Population_Manager::TestFile2
protected

◆ TheArray

vector< TListOfAnimals > Population_Manager::TheArray
protected

◆ TheProbe

probe_data* Population_Manager::TheProbe[100]

Referenced by CloseDownSim(), and GetProbeInput_ini().


The documentation for this class was generated from the following files:
probe_data::m_TargetTypes
bool m_TargetTypes[10]
Definition: PopulationManager.h:301
cfg_DayInMonth
static CfgInt cfg_DayInMonth("PRB_DAYINMONTH", CFG_CUSTOM, 1)
Landscape::TranslateVegTypes
TTypesOfVegetation TranslateVegTypes(int VegReference)
Definition: landscape.h:1655
Population_Manager::m_catastrophestartyear
int m_catastrophestartyear
Definition: PopulationManager.h:532
Population_Manager::DoLast
virtual void DoLast()
Definition: PopulationManager.cpp:530
Population_Manager::RipleysOutputPrb
FILE * RipleysOutputPrb
Definition: PopulationManager.h:582
g_str
char g_str[255]
Definition: PopulationManager.cpp:129
Population_Manager::RipleysOutputPrb9
FILE * RipleysOutputPrb9
Definition: PopulationManager.h:591
Population_Manager::CloseTheMonthlyRipleysOutputProbe
void CloseTheMonthlyRipleysOutputProbe()
Definition: PopulationManager.cpp:885
probe_data::m_NoAreas
unsigned m_NoAreas
Definition: PopulationManager.h:292
Population_Manager::Shuffle_or_Sort
void Shuffle_or_Sort(unsigned Type)
Definition: PopulationManager.cpp:1073
probe_data::m_RefFarms
unsigned m_RefFarms[25]
Definition: PopulationManager.h:299
Population_Manager::TheArray
vector< TListOfAnimals > TheArray
Definition: PopulationManager.h:534
Population_Manager::StateNamesLength
unsigned StateNamesLength
Definition: PopulationManager.h:535
Population_Manager::m_population_type
TTypesOfPopulation m_population_type
Definition: PopulationManager.h:580
Population_Manager::Probe
virtual float Probe(int ListIndex, probe_data *p_TheProbe)
Definition: PopulationManager.cpp:680
cfg_ReallyBigOutput_day2
static CfgInt cfg_ReallyBigOutput_day2("G_REALLYBIGOUTPUT_DAY_TWO", CFG_CUSTOM, 91)
probe_data::m_Rect
rectangle m_Rect[10]
Definition: PopulationManager.h:293
Population_Manager::TheRipleysOutputProbe
virtual void TheRipleysOutputProbe(FILE *a_prb)
Definition: PopulationManager.cpp:918
Population_Manager::ReallyBigOutputPrb
FILE * ReallyBigOutputPrb
Definition: PopulationManager.h:595
Population_Manager::SimWH
unsigned SimWH
Definition: PopulationManager.h:512
CompareStateAlive
Function to compare to TAnimal's m_CurrentStateNo to anything but -1.
Definition: PopulationManager.cpp:205
Population_Manager::TheProbe
probe_data * TheProbe[100]
Definition: PopulationManager.h:510
cfg_RipleysOutput_interval
static CfgInt cfg_RipleysOutput_interval("G_RIPLEYSOUTPUT_INTERVAL", CFG_CUSTOM, 1)
Population_Manager::BreedingSuccessProbeOutput
virtual void BreedingSuccessProbeOutput(double, int, int, int, int, int, int, int)
Definition: PopulationManager.h:649
Population_Manager::CloseTheRipleysOutputProbe
virtual void CloseTheRipleysOutputProbe()
Definition: PopulationManager.cpp:874
Landscape::SupplyMonth
int SupplyMonth(void)
Definition: landscape.h:1601
Population_Manager::m_StepSize
int m_StepSize
Definition: PopulationManager.h:533
AnimalPosition::m_x
unsigned m_x
Definition: PopulationManager.h:172
Population_Manager::SimHH
unsigned SimHH
Definition: PopulationManager.h:512
rectangle::m_y1
unsigned m_y1
Definition: PopulationManager.h:101
Population_Manager::GetLiveArraySize
unsigned GetLiveArraySize(int a_listindex)
Gets the number of 'live' objects for a list index in the TheArray.
Definition: PopulationManager.h:433
CompareY
Function to compare to TAnimal's m_Location_y.
Definition: PopulationManager.cpp:157
cfg_ReallyBigOutput_filename
static CfgStr cfg_ReallyBigOutput_filename("G_REALLYBIGOUTPUT_FILENAME", CFG_CUSTOM, "ReallyBigOutput.txt")
Landscape::FillVegAreaData
void FillVegAreaData()
Definition: Landscape.cpp:3641
cfg_RipleysOutput_used
CfgBool cfg_RipleysOutput_used("G_RIPLEYSOUTPUT_USED", CFG_CUSTOM, false)
probe_data::m_NoVegTypes
unsigned m_NoVegTypes
Definition: PopulationManager.h:295
Population_Manager::IndexArrayX
int IndexArrayX[5][10000]
Definition: PopulationManager.h:509
Population_Manager::SortXIndex
void SortXIndex(unsigned Type)
Definition: PopulationManager.cpp:1027
Population_Manager::ImpactProbeReport
void ImpactProbeReport(int a_Time)
Definition: PopulationManager.cpp:1321
rectangle::m_x2
unsigned m_x2
Definition: PopulationManager.h:102
Population_Manager::SimW
int SimW
Definition: PopulationManager.h:511
cfg_CatastropheEventStartYear
CfgInt cfg_CatastropheEventStartYear("PM_CATASTROPHEEVENTSTARTYEAR", CFG_CUSTOM, 99999)
Population_Manager::RipleysOutputPrb6
FILE * RipleysOutputPrb6
Definition: PopulationManager.h:588
cfg_ReallyBigOutput_interval
static CfgInt cfg_ReallyBigOutput_interval("G_REALLYBIGOUTPUT_INTERVAL", CFG_CUSTOM, 1)
Population_Manager::m_AOR_Probe
AOR_Probe * m_AOR_Probe
Definition: PopulationManager.h:526
probe_data::m_ReportInterval
unsigned m_ReportInterval
Definition: PopulationManager.h:291
probe_data::FileOutput
void FileOutput(int No, int time, int ProbeNo)
Definition: PopulationManager.cpp:1447
probe_data::m_RefEle
TTypesOfLandscapeElement m_RefEle[25]
Definition: PopulationManager.h:298
Population_Manager::LamdaClear
void LamdaClear()
Definition: PopulationManager.h:609
cfg_AOROutput_day
static CfgInt cfg_AOROutput_day("G_AOROUTPUT_DAY", CFG_CUSTOM, 60)
cfg_ReallyBigOutput_used
CfgBool cfg_ReallyBigOutput_used("G_REALLYBIGOUTPUT_USED", CFG_CUSTOM, false)
Population_Manager::RipleysOutputPrb8
FILE * RipleysOutputPrb8
Definition: PopulationManager.h:590
cfg_RipleysOutputMonthly_used
CfgBool cfg_RipleysOutputMonthly_used("G_RIPLEYSOUTPUTMONTHLY_USED", CFG_CUSTOM, false)
Landscape::SupplyDayInMonth
int SupplyDayInMonth(void)
Definition: landscape.h:1606
probe_data::m_RefVeg
TTypesOfVegetation m_RefVeg[25]
Definition: PopulationManager.h:297
Landscape::SupplySimAreaHeight
int SupplySimAreaHeight(void)
Definition: landscape.h:1637
Landscape::SupplySimAreaWidth
int SupplySimAreaWidth(void)
Definition: landscape.h:1632
Landscape::TranslateEleTypes
TTypesOfLandscapeElement TranslateEleTypes(int EleReference)
Definition: landscape.h:1648
Population_Manager::TheReallyBigOutputProbe
virtual void TheReallyBigOutputProbe()
Definition: PopulationManager.cpp:913
Population_Manager::DoBefore
virtual void DoBefore()
Definition: PopulationManager.cpp:328
Population_Manager::RipleysOutputPrb10
FILE * RipleysOutputPrb10
Definition: PopulationManager.h:592
Population_Manager::SupplyListIndexSize
unsigned SupplyListIndexSize()
Definition: PopulationManager.h:468
TAnimal
The base class for all ALMaSS animal classes.
Definition: PopulationManager.h:205
Population_Manager::m_SeasonNumber
int m_SeasonNumber
Holds the season number. Used when running goose and hunter sims.
Definition: PopulationManager.h:544
CompareX
Function to compare to TAnimal's m_Location_x.
Definition: PopulationManager.cpp:146
cfg_ReallyBigOutputFirstYear
static CfgInt cfg_ReallyBigOutputFirstYear("G_REALLYBIGOUTPUT_FIRSTYEAR", CFG_CUSTOM, 1)
cfg_AOROutput_interval
static CfgInt cfg_AOROutput_interval("G_AORSOUTPUT_INTERVAL", CFG_CUSTOM, 1)
AnimalPosition
A class defining an animals position.
Definition: PopulationManager.h:168
Population_Manager::BeforeStepActions
unsigned BeforeStepActions[12]
Definition: PopulationManager.h:542
cfg_AOROutputFirstYear
static CfgInt cfg_AOROutputFirstYear("G_AOROUTPUT_FIRSTYEAR", CFG_CUSTOM, 1)
Population_Manager::ImpactedProbe
virtual void ImpactedProbe()
Definition: PopulationManager.cpp:672
cfg_RipleysOutputFirstYear
static CfgInt cfg_RipleysOutputFirstYear("G_RIPLEYSOUTPUT_FIRSTYEAR", CFG_CUSTOM, 1)
Landscape::SupplyDayInYear
int SupplyDayInYear(void)
Definition: landscape.h:1596
cfg_RipleysOutput_day
static CfgInt cfg_RipleysOutput_day("G_RIPLEYSOUTPUT_DAY", CFG_CUSTOM, 60)
Population_Manager::RipleysOutputPrb11
FILE * RipleysOutputPrb11
Definition: PopulationManager.h:593
Population_Manager::lamdagrid
long int lamdagrid[2][257][257]
Definition: PopulationManager.h:597
rectangle::m_y2
unsigned m_y2
Definition: PopulationManager.h:103
Landscape::SupplyYearNumber
int SupplyYearNumber(void)
Definition: landscape.h:1616
Population_Manager::TheFledgelingProbe
virtual int TheFledgelingProbe()
Definition: PopulationManager.h:646
cfg_ReallyBigOutput_day1
static CfgInt cfg_ReallyBigOutput_day1("G_REALLYBIGOUTPUT_DAY_ONE", CFG_CUSTOM, 1)
AnimalPosition::m_EleType
TTypesOfLandscapeElement m_EleType
Definition: PopulationManager.h:174
Population_Manager::RipleysOutputPrb3
FILE * RipleysOutputPrb3
Definition: PopulationManager.h:585
AnimalPosition::m_y
unsigned m_y
Definition: PopulationManager.h:173
Population_Manager::DoFirst
virtual void DoFirst()
Definition: PopulationManager.cpp:320
vector< TAnimal * >
Population_Manager::RipleysOutputPrb4
FILE * RipleysOutputPrb4
Definition: PopulationManager.h:586
Population_Manager::StateNames
const char * StateNames[100]
Definition: PopulationManager.h:531
Population_Manager::TheBreedingSuccessProbe
virtual int TheBreedingSuccessProbe(int &, int &, int &, int &, int &, int &)
Definition: PopulationManager.h:651
probe_data::m_FileRecord
bool m_FileRecord
Definition: PopulationManager.h:290
Population_Manager::m_TheLandscape
Landscape * m_TheLandscape
Definition: PopulationManager.h:515
Population_Manager::FledgelingProbeOutput
virtual void FledgelingProbeOutput(int, int)
Definition: PopulationManager.h:654
cfg_ReallyBigOutput_day4
static CfgInt cfg_ReallyBigOutput_day4("G_REALLYBIGOUTPUT_DAY_FOUR", CFG_CUSTOM, 274)
Population_Manager::ProbeReport
char * ProbeReport(int a_time)
Definition: PopulationManager.cpp:1273
Population_Manager::OpenTheMonthlyRipleysOutputProbe
bool OpenTheMonthlyRipleysOutputProbe()
Definition: PopulationManager.cpp:778
Population_Manager::RipleysOutputPrb12
FILE * RipleysOutputPrb12
Definition: PopulationManager.h:594
random
int random(int a_range)
Definition: ALMaSS_CmdLine.cpp:142
Population_Manager::RipleysOutputPrb1
FILE * RipleysOutputPrb1
Definition: PopulationManager.h:583
Population_Manager::SimH
int SimH
Definition: PopulationManager.h:511
Population_Manager::BreedingPairsOutput
virtual void BreedingPairsOutput(int)
Definition: PopulationManager.h:641
rectangle::m_x1
unsigned m_x1
Definition: PopulationManager.h:100
Population_Manager::m_ListNameLength
unsigned m_ListNameLength
Definition: PopulationManager.h:538
Population_Manager::RipleysOutputPrb5
FILE * RipleysOutputPrb5
Definition: PopulationManager.h:587
Population_Manager::BeginningOfMonth
bool BeginningOfMonth()
Definition: PopulationManager.cpp:1102
Population_Manager::SortX
void SortX(unsigned Type)
Definition: PopulationManager.cpp:979
probe_data::m_NoEleTypes
unsigned m_NoEleTypes
Definition: PopulationManager.h:294
CompareState
Function to compare to TAnimal's Current behavioural state.
Definition: PopulationManager.cpp:171
cfg_AOROutput_used
CfgBool cfg_AOROutput_used("G_AOROUTPUT_USED", CFG_CUSTOM, false)
probe_data::m_NoFarms
unsigned m_NoFarms
Definition: PopulationManager.h:296
Population_Manager::PartitionLiveDead
unsigned PartitionLiveDead(unsigned Type)
Definition: PopulationManager.cpp:1015
Population_Manager::RipleysOutputPrb2
FILE * RipleysOutputPrb2
Definition: PopulationManager.h:584
Population_Manager::m_NoProbes
int m_NoProbes
Definition: PopulationManager.h:525
Population_Manager::RipleysOutputPrb7
FILE * RipleysOutputPrb7
Definition: PopulationManager.h:589
Population_Manager::StepFinished
virtual bool StepFinished()
Overrides the population manager StepFinished - there is no chance that hunters do not finish a step ...
Definition: PopulationManager.cpp:498
Population_Manager::DoAlmostLast
virtual void DoAlmostLast()
Definition: PopulationManager.cpp:522
Population_Manager::CloseTheReallyBigOutputProbe
virtual void CloseTheReallyBigOutputProbe()
Definition: PopulationManager.cpp:904
Population_Manager::Shuffle
void Shuffle(unsigned Type)
Definition: PopulationManager.cpp:1055
cfg_RipleysOutput_filename
static CfgStr cfg_RipleysOutput_filename("G_RIPLEYSOUTPUT_FILENAME", CFG_CUSTOM, "RipleysOutput.txt")
CompareStateR
Function to compare to TAnimal's m_CurrentStateNo.
Definition: PopulationManager.cpp:183
Population_Manager::OpenTheAOROutputProbe
void OpenTheAOROutputProbe(string a_AORFilename)
Definition: PopulationManager.cpp:771
Population_Manager::m_ListNames
const char * m_ListNames[32]
Definition: PopulationManager.h:537
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
cfg_ReallyBigOutput_day3
static CfgInt cfg_ReallyBigOutput_day3("G_REALLYBIGOUTPUT_DAY_THREE", CFG_CUSTOM, 182)
Population_Manager::TheAOROutputProbe
virtual void TheAOROutputProbe()
Definition: PopulationManager.cpp:924
g_rand_uni
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
Population_Manager::SortY
void SortY(unsigned Type)
Definition: PopulationManager.cpp:989
Population_Manager::m_LiveArraySize
vector< unsigned > m_LiveArraySize
Definition: PopulationManager.h:524
Population_Manager::Catastrophe
virtual void Catastrophe()
Definition: PopulationManager.cpp:1109
int
Population_Manager::DoAfter
virtual void DoAfter()
Definition: PopulationManager.cpp:513
AnimalPosition::m_VegType
TTypesOfVegetation m_VegType
Definition: PopulationManager.h:175