ALMaSS Partridge ODdox  1.1
The partridge model description following ODdox protocol
Partridge_Population_Manager.cpp
Go to the documentation of this file.
1 /*
2 *******************************************************************************************************
3 Copyright (c) 2011, Christopher John Topping, University of Aarhus
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without modification, are permitted provided
7 that the following conditions are met:
8 
9 Redistributions of source code must retain the above copyright notice, this list of conditions and the
10 following disclaimer.
11 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
12 the following disclaimer in the documentation and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
15 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
17 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
18 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
19 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 ********************************************************************************************************
23 */
39 #include <cmath>
40 #include <string.h>
41 #include <iostream>
42 #include <fstream>
43 #include "../Landscape/ls.h"
44 #include "../BatchALMaSS/PopulationManager.h"
45 #include "../Partridge/Partridge_Communication.h"
46 #include "../Partridge/Partridge_All.h"
47 #include "../Partridge/Partridge_Population_Manager.h"
48 #include "../Partridge/Partridge_Covey.h"
49 #include "../BatchALMaSS/BoostRandomGenerators.h"
50 #include "../BatchALMaSS/AOR_Probe.h"
51 
52 #ifdef __NESTPOSITIONS_OUT
53  static CfgInt cfg_ParNestPosOutStart( "PAR_NESPOSTOUTSTART", CFG_CUSTOM, 20 );
54  static CfgInt cfg_ParNestPosOutEnd( "PAR_NESPOSTOUTEND", CFG_CUSTOM, 30 );
55  FILE* NestPositions;
56 #endif
57 
58 //---------------------------------------------------------------------------
59 //---------------------------------------------------------------------------
60 
61 extern void FloatToDouble(double&,float);
62 
64 //double g_move_veg_structure[4] [4];
65 double g_FoodNeed[200];
66 int g_MaxWalk[200];
67 
68 
69 // The data below is the culmulative probabability of covey dissolution
70 // if it used to determine when the covey dissovles by the partridge_pop_man
71 const int DissolveChance[40] =
72 {
73  0, 381, 1123, 2205, 3609, 5314, 7300, 9548, 12036, 14746, 17657, 20749, 24003, 27399, 30916, 3453, 38235, 41997, 45801,
74  49626, 53454, 57263, 61035, 64748, 68383, 71921, 75341, 78623, 81747, 84694, 87443, 89974, 92268, 94305, 96064, 97525,
75  98670, 99477, 99927, 100000
76 };
77 
80 
85 
89 //extern CfgInt cfg_par_female_mortality_alone;
97 
103 
104 
106 static CfgFloat cfg_par_rainfactor("PAR_RAINFACTOR",CFG_CUSTOM,0.2);
108 static CfgFloat cfg_rainscaling("PAR_RAINSCALING",CFG_CUSTOM,0.767);
110 static CfgInt cfg_springcensusdate("PAR_SPRINGCENSUSDATE",CFG_CUSTOM,March+21);
112 static CfgInt cfg_Emigration( "PAR_EMIGRATION", CFG_CUSTOM, 1 ); // 0 upwards, e.g. 3000 = 30% of current population size emigrates
114 CfgInt cfg_IndividualEmigration( "PAR_INDIVIDUALEMIGRATION", CFG_CUSTOM, 3500 ); // 0 upwards, e.g. 30 = 30% of current population size immigrates
116 static CfgInt cfg_MaleImmigration( "PAR_MALEIMMIGRATION", CFG_CUSTOM, 0 ); // 0 upwards, e.g. 30 = 30% of current population size immigrates
118 static CfgInt cfg_ParHuntingThreshold("PAR_HUNTINGTHRESHOLD",CFG_CUSTOM,1);
120 static CfgInt cfg_ParHuntingGridSize("PAR_HUNTINGGRIDSIZE",CFG_CUSTOM,1000);
122 static CfgInt cfg_ParHuntingType("PAR_HUNTINGTYPE",CFG_CUSTOM,1); // 1==Grid & threshold, 2 == beetlband differentiated, otherwise global
124 static CfgInt cfg_ParShootStartYear( "PAR_SHOOTSTARTYEAR", CFG_CUSTOM, 1 );
126 static CfgInt cfg_ParShotMin( "PAR_SHOTPERCENTAGE_MIN", CFG_CUSTOM, 1500 ); // out of 10000
128 static CfgInt cfg_ParShotMax( "PAR_SHOTPERCENTAGE_MAX", CFG_CUSTOM, 1500 );
130 static CfgFloat cfg_HindranceScalingFactor( "PAR_HINDRANCE_SCALING", CFG_CUSTOM, 1000 );
132 static CfgInt cfg_StartingNumberMalePartridges( "PAR_STARTING_NO_MALES", CFG_CUSTOM, 10000);
134 static CfgInt cfg_StartingNumberFemalePartridges( "PAR_STARTING_NO_FEMALES", CFG_CUSTOM, 10000 );
136 static CfgInt cfg_FemalePopSizeMaxCutoff("PAR_FEMMAXPOPSIZECUTOFF",CFG_CUSTOM,7000);
138 static CfgFloat cfg_par_energyslope_perday( "PAR_ENERGYSLOPE_PERDAY", CFG_CUSTOM, 1.06 );
140 static CfgInt cfg_flockdata_date( "PAR_FLOCKDATA_DATE", CFG_CUSTOM, 270 );
142 static CfgInt cfg_breedingpairs_date( "PAR_BREEDINGPAIRS_DATE", CFG_CUSTOM, 90 );
144 static CfgInt cfg_unpaireddata_date( "PAR_UNPAIREDDATA_DATE", CFG_CUSTOM, 150 );
146 static CfgInt cfg_kfactoroutput_date( "PAR_KFACTOROUTPUT_DATE", CFG_CUSTOM, 90 );
147 
149 CfgInt cfg_ParHuntingBeetleBankArea("PAR_HUNTING_BEETLEBANKAREA",CFG_CUSTOM,500 ); // out of 10000
150 
151 
152 
153 //******* Below are essential methods needed by all Population_Managers ********
154 //
155 
157 {
158 
159  // Six lists are needed so need to remove 4 of the ten default arrays
160  // Clutches,Fledgelings,Males,Females,Flocks
161  for ( int i = 0; i < 10; i++ )
162  {
163  TheArray[i].clear();
164  }
165  for ( int i = 0; i < 4; i++ )
166  {
167  TheArray.pop_back();
168  }
169  Init();
170  m_Starved = 0;
171  /* m_Matured = 0; m_Eaten = 0; */
173 }
174 
175 //-----------------------------------------------------------------------------
176 
178 {
180  delete m_Ourkfactors;
181  delete m_territoryqualmap;
182  delete m_nestingcovermap;
183  delete m_comms_data;
184 }
185 
186 //-----------------------------------------------------------------------------
188 {
189  m_loop_index = 0;
190  m_loop_ob_type = ob_type;
191  m_loop_limit = (int)TheArray[ob_type].size();
192 }
193 
194 //-----------------------------------------------------------------------------
195 
197 {
198 
199  if ( m_loop_index >= m_loop_limit )
200  return NULL;
201 
203 }
204 
205 //-----------------------------------------------------------------------------
206 
208 {
209  if ( cfg_RipleysOutput_used.value() ) {
211  }
214  } else ReallyBigOutputPrb=0;
215  // autom. called by constructor
216  strcpy( m_SimulationName, "Partridge Simulation" );
217  m_Partridge_IDs = 0;
218  // Create some male and female Partridges
220  for ( int i = 0; i < num; i++ )
221  {
223  }
224  for ( int i = 0; i < cfg_StartingNumberFemalePartridges.value(); i++ )
225  {
227  }
228 
229  // Load List of Animal Classes
230  m_ListNames[0] = "Clutch";
231  m_ListNames[1] = "Chick";
232  m_ListNames[2] = "Chick2";
233  m_ListNames[3] = "Male";
234  m_ListNames[4] = "Female";
235  m_ListNames[5] = "Covey";
236  m_ListNameLength = 6;
238 
239  // Load State Names
240  StateNames[pars_Initiation] = "ALL Initiation";
241  StateNames[pars_CMoving] = "Clutch Moving";
242  StateNames[pars_ClDeveloping] = "Clutch Developing";
243  StateNames[pars_ClHatching] = "Clutch Hatching";
244  StateNames[pars_ClDying] = "Clutch Dying";
245  StateNames[pars_ChDeveloping] = "Chick_Developing";
246  StateNames[pars_ChMaturing] = "Chick_Maturing";
247  StateNames[pars_ChDying] = "Chick_Dying";
248  StateNames[pars_MFlocking] = "Male Flocking";
249  StateNames[pars_MFindingMate] = "Male Finding Mate";
250  StateNames[pars_MFollowingMate] = "Male Following Mate";
251  StateNames[pars_MPairing] = "Male Pairing";
252  StateNames[pars_MGuardingMate] = "Male Guarding Mate";
253  StateNames[pars_MCaringForYoung] = "Male Caring For Young";
254  StateNames[pars_MDying] = "Male Dying";
255  StateNames[pars_FFlocking] = "Female Flocking";
256  StateNames[pars_FFindingTerritory] = "Female Finding Territory";
257  StateNames[pars_FAttractingMate] = "Female Attracting A Mate";
258  StateNames[pars_FBuildingUpResources] = "Female Building Up Resources";
259  StateNames[pars_FMakingNest] = "Female Making Nest";
260  StateNames[pars_FLaying] = "Female Laying";
261  StateNames[pars_FStartingNewBrood] = "Female Starting New Brood";
262  StateNames[pars_FIncubating] = "Female Incubating";
263  StateNames[pars_FCaringForYoung] = "Female Caring For Young";
264  StateNames[pars_FDying] = "Female Dying";
265  StateNames[pars_CoveyDissolve] = "Covey Dissolve";
266  StateNames[pars_CoveyBeing] = "Covey Exists";
267  StateNames[pars_Destroy] = "ALL Destroy";
268  StateNamesLength = 28;
269  // determine whether we should shuffle, or sort or do nothing to Partridges
270  // after each time step.
271  BeforeStepActions[0] = 3; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
272  BeforeStepActions[1] = 3; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
273 
274  BeforeStepActions[2] = 0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
275  BeforeStepActions[3] = 0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
276  BeforeStepActions[4] = 0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
277  BeforeStepActions[5] = 0; // 0 = Shuffle, 1 = SortX, 2 = SortY, 3 = do nothing
278 
279  // They all start flocking
280  m_ShouldFlock = true;
281 
282  // OPen the output files
283  m_HatchSuccess = 0;
284  if ( !OpenParOutputFiles() )
285  {
286  m_TheLandscape->Warn( "Partridge_Pop_Man::Init(): ""Problem opening output files", "" );
287  exit( 1 );
288  }
289 #ifdef __NESTPOSITIONS_OUT
290 NestPositions=fopen("NestPositions.txt","w");
291  if ( !NestPositions )
292  {
293  g_msg->Warn( WARN_BUG, "Partridge_Population_Manager::Init(): Cannot open NestPositions.txt file", "" );
294  exit( 1 );
295  }
296 #endif
297  // [Height][Biomass]
298 /*
299 FILE * HBdata = fopen("HB_impedence_18072010.txt", "r" );
300  if ( !HBdata )
301  {
302  g_msg->Warn( WARN_BUG, "Partridge_Population_Manager::Init(): Cannot open HBdata file", "" );
303  exit( 1 );
304  }
305  double d;
306  float f;
307  double sc = cfg_HindranceScalingFactor.value();
308  for ( int h = 0; h < 4; h++ )
309  for ( int b = 0; b < 4; b++ )
310  {
311  fscanf( HBdata, "%g\n", & f );
312  FloatToDouble(d,f);
313  //SetMoveVegStructure(h,b,d);
314  d += ( 1.0 - d ) / sc;
315  g_move_veg_structure[h] [b] = d;
316  }
317  fclose( HBdata );
318 */
319  FillInFoodArray();
320  // Create analysis objects
321  m_Ourkfactors = new k_factors;
322  m_Ourkfactors->m_ThisYear->setNoMalesSept( 100000000 ); // this is just to avoid log error in the first year
324  // Need to create and fill in the density maps
327  m_maxx = lx / 10;
328  m_maxy = ly / 10;
329  m_halfwidth = lx / 2;
330  m_territoryqualmap = new CoverTempMap(lx,ly);
331  m_nestingcovermap = new CoverTempMap(lx,ly);
334 
335  // Added by Krishnan Sudharsan March 22 2007 and March 23 2007
336  m_HabitatQuality[0]=0;
338  double alpha_max = 4.00000; // Maximum power value
339  double alpha_min = 0.00000; // Minimum power value
340  double alpha_medium = (alpha_max + alpha_min) / 2; // Changing value of mid point
341  double m_medium_tq = cfg_par_max_terr_qual.value() - pow(daydiff, alpha_medium); // Territory quality when power is intermediate
342  // the range of territory quality within which our target has to be
343  double range_min = cfg_par_min_terr_qual.value()- cfg_par_min_terr_qual.value()* 0.01;
344  double range_max = cfg_par_min_terr_qual.value()+ cfg_par_min_terr_qual.value()* 0.01;
345 
346  // Search value has to be equal to territory minimum value at end
347  // Binary search to find the power that decreases TQ from max to min in given days
348  // Continue searching till the search value equals the minimum territory value.
349  // Stop when the search value = t_min. Time at this point = daydiff.
350  while (m_medium_tq < range_min || m_medium_tq > range_max)
351  {
352  if (m_medium_tq < range_min){
353  alpha_max = alpha_medium ;
354  alpha_medium = (alpha_min + alpha_max) / 2;}
355  else {
356  alpha_min = alpha_medium;
357  alpha_medium = (alpha_min + alpha_max) / 2;}
358  m_medium_tq = cfg_par_max_terr_qual.value() - pow(daydiff, alpha_medium);
359  }
360  // For sake of safety I added 1 extra day for the territoryquality assessment
361  for (int i = 0; i < daydiff+1; i++){
362  m_HabitatQuality[i] = cfg_par_max_terr_qual.value() - pow(i,alpha_medium);}
363 
364 }
365 
366 //-----------------------------------------------------------------------------
367 
368 void Partridge_Population_Manager::CreateObjects( int ob_type, Partridge_struct * data, int number )
369 {
370  Partridge_Clutch * New_Clutch;
371  Partridge_Chick * New_Chick;
372  Partridge_Chick2 * New_Chick2;
373  Partridge_Male * New_Male;
374  Partridge_Female * New_Female;
375  Partridge_Covey * New_Flock;
376 
377  Clutch_struct * cs;
378  Chick_struct * pcs;
380  Covey_struct * covs;
381 
382  // Register the event with k_factors
384 
385  for ( int i = 0; i < number; i++ )
386  {
387  if ( ob_type == 0 ) // Clutch creation
388  {
389 
390  cs = dynamic_cast < Clutch_struct * > ( data );
391  New_Clutch = new Partridge_Clutch( cs->x, cs->y, cs->Mum, cs->m_covey, m_TheLandscape, cs->No,
392  cs->family_counter, this );
393  TheArray[ob_type].push_back( New_Clutch );
394  // Give mum the pointer to the clutch
395  m_comms_data->m_clutch = New_Clutch;
396  m_comms_data->m_female = cs->Mum;
398  // cs->Mum->OnSetMyClutch( New_Clutch );
399  // Register the event with k_factors
401 #ifdef __NESTPOSITIONS_OUT
403  if ((y>=cfg_ParNestPosOutStart.value()) &&(y<cfg_ParNestPosOutEnd.value())) {
404  int veg=int(m_TheLandscape->SupplyVegType(cs->x, cs->y));
405  int ele=int(m_TheLandscape->SupplyElementType(cs->x, cs->y));
406  fprintf(NestPositions,"%d\t%d\t%d\t%d\t%d\n",y,cs->x, cs->y,veg,ele);
407  }
408 #endif
409  }
410  if ( ob_type == 1 ) // Chick
411  {
412  pcs = dynamic_cast < Chick_struct * > ( data );
413  bool sex = false;
414  // if ( random( 2 ) == 1 ) sex = true; Sex ratio not 50:50
415  if ( random( 211 ) > 100 ) sex = true; // sex ratio 111/100 males/females Dammerham
416  New_Chick = new Partridge_Chick( pcs->x, pcs->y, pcs->Mum, pcs->m_covey, m_TheLandscape, sex,
417  pcs->family_counter, this );
418  // Add the new chick to the population managers arrays
419  TheArray[ob_type].push_back( New_Chick );
421  }
422  if ( ob_type == 2 ) // Chick2
423  {
424  pcs = dynamic_cast < Chick_struct * > ( data );
425  New_Chick2 = new Partridge_Chick2( pcs->x, pcs->y, pcs->Mum, pcs->m_covey, m_TheLandscape, pcs->sex,
426  pcs->family_counter, this );
427  // Add the new chick to the population managers arrays
428  TheArray[ob_type].push_back( New_Chick2 );
429  // Record the fact that we got this old
431  }
432  if ( ob_type == 3 ) // Male
433  {
434  as = dynamic_cast < AdultPartridge_struct * > ( data );
435  // Male
436  New_Male = new Partridge_Male( as->bx, as->by, as->x, as->y, as->m_covey, m_TheLandscape, as->family_counter, this );
437  TheArray[ob_type].push_back( New_Male );
438  }
439  if ( ob_type == 4 ) // Female
440  {
441  as = dynamic_cast < AdultPartridge_struct * > ( data );
442  // Female
443  New_Female = new Partridge_Female( as->bx, as->by, as->x, as->y, as->m_covey, m_TheLandscape, as->family_counter, this );
444  TheArray[ob_type].push_back( New_Female );
445  }
446  if ( ob_type == 5 ) // Covey
447  {
448  covs = dynamic_cast < Covey_struct * > ( data );
449  New_Flock = new Partridge_Covey( covs->first_member, this, covs->x, covs->y, m_TheLandscape );
450  TheArray[ob_type].push_back( New_Flock );
451  }
452  }
453 }
454 
455 //-----------------------------------------------------------------------------
456 
458 {
459  TheArray[ob_type].push_back( pTAo );
460 }
461 
462 //-----------------------------------------------------------------------------
463 
464 
466 {
467  Partridge_Male * New_Male;
468  Partridge_Female * New_Female;
469  Partridge_Covey * New_Flock;
470 
471  int extentx = m_TheLandscape->SupplySimAreaWidth();
472  int extenty = m_TheLandscape->SupplySimAreaHeight();
473 
474  for ( int i = 0; i < number; i++ )
475  {
476  unsigned x = 0;
477  unsigned y = 0;
478  bool OK=false;
479  while (!OK) {
480  x = random( extentx );
481  y = random( extenty );
483  switch (ele) {
484  case tole_StoneWall:
485  case tole_Fence:
486  case tole_Garden:
487  case tole_Building:
488  case tole_Pond:
489  case tole_Freshwater:
490  case tole_River:
491  case tole_Saltwater:
492  case tole_Coast:
493  case tole_BareRock:
494  case tole_AmenityGrass:
495  case tole_Parkland:
496  case tole_UrbanNoVeg:
497  case tole_UrbanPark:
499  case tole_SandDune:
500  case tole_Copse:
501  case tole_MetalledPath:
502  case tole_Carpark:
503  case tole_Churchyard:
504  case tole_Saltmarsh:
505  case tole_Stream:
506  case tole_HeritageSite:
507  break;
508  default: OK=true;
509  break;
510  }
511 
512  }
513  if ( ob_type == pob_Male ) // Male
514  {
515  // Male
516  New_Male = new Partridge_Male( 0, 0, x , y, NULL, m_TheLandscape, random( 1000000 ), this );
517  TheArray[ob_type].push_back( New_Male );
518 
519  New_Flock = new Partridge_Covey( New_Male, this, New_Male->Supply_m_Location_x(), New_Male->Supply_m_Location_y(), m_TheLandscape );
520  New_Male->SetCovey( New_Flock );
521  }
522  if ( ob_type == pob_Female ) // Female
523  {
524  New_Female = new Partridge_Female( 0, 0, x , y, NULL, m_TheLandscape, random( 1000000 ), this );
525  TheArray[ob_type].push_back( New_Female );
526  New_Flock = new Partridge_Covey( New_Female, this, New_Female->Supply_m_Location_x(), New_Female->Supply_m_Location_y(), m_TheLandscape );
527  New_Female->SetCovey( New_Flock );
528  }
529  }
530 }
531 
532 //-----------------------------------------------------------------------------
533 
534 
536 {
537  Partridge_Male * New_Male;
538  Partridge_Female * New_Female;
539  Partridge_Covey * New_Flock;
540 
541  if ( as->sex ) // Male
542  {
543  // Male
544  New_Male = new Partridge_Male( as->bx, as->by, as->x, as->y, NULL, m_TheLandscape, as->family_counter, this );
545  TheArray[ob_type].push_back( New_Male );
546  New_Flock = new Partridge_Covey( New_Male, this, New_Male->Supply_m_Location_x(), New_Male->Supply_m_Location_y(), m_TheLandscape );
547  New_Male->SetCovey( New_Flock );
548  // Must now set age.
549  New_Male->SetAge(as->age);
550  }
551  else // Female
552  {
553  // Female
554  New_Female = new Partridge_Female( as->bx, as->by, as->x, as->y, NULL, m_TheLandscape, as->family_counter, this );
555  TheArray[ob_type].push_back( New_Female );
556  New_Flock = new Partridge_Covey( New_Female, this, New_Female->Supply_m_Location_x(), New_Female->Supply_m_Location_y(), m_TheLandscape );
557  New_Female->SetCovey( New_Flock );
558  // Must now set age.
559  New_Female->SetAge(as->age);
560  }
561 }
562 
563 //-----------------------------------------------------------------------------
564 
565 //*************** End of essential methods ***************
566 
567 //-----------------------------------------------------------------------------
568 //-----------------------------------------------------------------------------
569 int Partridge_Population_Manager::ClutchDensity( int x, int y, int radius )
570 {
571  // Counts the number of clutches that are within 500m of x,y
572  int result = 0;
573  AnimalPosition ap;
574  int sz = (int)TheArray[pob_Clutch].size();
575  for ( int c = 0; c < sz; c++ )
576  {
577  ap = TheArray[pob_Clutch] [c]->SupplyPosition();
578  if ( ( ( abs( ( int )( ap.m_x - x ) ) % m_halfwidth ) < radius )
579  && ( ( abs( ( int )( ap.m_y - y ) ) % m_halfwidth ) < radius ) )result++;
580  }
581  return result;
582 }
583 
584 //---------------------------------------------------------------------------
585 
586 
591 {
592  /* if (g_date->Date()<730) { m_female_mortality_alone=0; if (g_date->Date()==729) {
593  m_female_mortality_alone=cfg_par_female_mortality_alone.value(); } } */
594  int today = m_TheLandscape->SupplyDayInYear();
595 
596  if (today==March+22) {
597  if (m_TheLandscape->SupplyYearNumber()>5) {
598  Partridge_Male* PM = NULL; // assignment to get rid of warning
599  Partridge_Female* PF = NULL;
600  if ((int)TheArray[pob_Female].size() > cfg_FemalePopSizeMaxCutoff.value() ){
601  unsigned size2 = (unsigned) TheArray[ pob_Male ].size();
602  for ( unsigned j = 0; j < size2; j++ ) {
603  PM = dynamic_cast < Partridge_Male * > ( TheArray[ pob_Male ] [ j ] );
604  PM->KillThis();
605  }
606  size2 = (unsigned) TheArray[ pob_Female ].size();
607  for ( unsigned j = 0; j < size2; j++ ) {
608  PF = dynamic_cast < Partridge_Female * > ( TheArray[ pob_Female ] [ j ] );
609  PF->KillThis();
610  }
611  }
612  }
613  }
614 
615  // Need to UpdateNestingCoverMap every so often in the breeding season
616  if ( ( today >= cfg_par_start_dissolve.value() ) && ( today < cfg_par_male_gives_up.value() ) && (TheArray[ pob_Female ].size()>0))
617  {
618  int daysfromstart=today-cfg_par_start_dissolve.value();
619  // for now do it every 7 days
620  if ( daysfromstart % 7 == 0 ) UpdateNestingCoverMap();
621  }
622  if ( today == (cfg_springcensusdate.value()-1) )
623  {
624  /*
625  // Before we do anything we may need to have emigration
626  if (cfg_Emigration.value() >0) {
627  unsigned int sz = (int)TheArray[pob_Covey].size();
628  int testvalue;
629  if (sz>1) testvalue=cfg_Emigration.value(); else testvalue=cfg_IndividualEmigration.value();
630  for (unsigned int c=0; c<sz; c++) {
631  if (random(10000) < testvalue) {
632  dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [c] )->CoveyEmigrate();
633  }
634  }
635  }
636  */
637  // Testing 15/04/08
638  // Before we do anything we may need to have emigration
639  if (cfg_Emigration.value() >0) {
640  unsigned int sz = (int)TheArray[pob_Covey].size();
641  int testvalue=cfg_Emigration.value();
642  for (unsigned int c=0; c<sz; c++) {
643  if (random(10000) < testvalue) {
644  dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [c] )->CoveyEmigrate();
645  }
646  else {
647  dynamic_cast < Partridge_Covey * > (TheArray[pob_Covey][c])->CoveyIndividualEmigrate();
648  }
649  }
650  }
651  }
652  if ( today == cfg_springcensusdate.value() )
653  {
654  // before 1st clutch is possible 80
655  int birds = (int)TheArray[pob_Male].size() + (int)TheArray[pob_Female].size();
656  // No Breeding Pairs
657  // Calculate and write output to flock data file
658  int si = (int)TheArray[pob_Female].size();
659  int nobs = 0;
660  int nts = 0;
661  for ( int i = 0; i < si; i++ )
662  {
663  // Generate a date to dissolve
664  if ( dynamic_cast < Partridge_Female * > ( TheArray[pob_Female] [i] )->GetMate() ) nobs++;
665  if ( dynamic_cast < Partridge_Female * > ( TheArray[pob_Female] [i] )->HaveTerritory() ) nts++;
666  }
670  si = (int) TheArray[pob_Male].size();
675  }
676 
677  // Added by Krishnan Sudharsan on May 15, 2007
678  // Needed to count territorial/non-territorial females in May
679  if ( today == May+15 )
680  { int num = (int)TheArray[pob_Female].size();
681  int nobs = 0;
682  int difference = 0;
683  for ( int i = 0; i < num; i++ )
684  {
685  // Find the number of territorial females on May 15th
686  if ( dynamic_cast < Partridge_Female * > ( TheArray[pob_Female] [i] )->HaveTerritory() ) nobs++;
687  }
688  difference = num - nobs;
691  }
692 
693  if ( today == August+4 )
694  { // Aug 5th
699  }
700 
701  if ( today == September )
702  { // 1st Sept
703  // add 50% of chicks to males and females - assumes a 1:1 ratio at hatch
704  int nochicks = (int) TheArray[pob_Chick].size();
705  nochicks += (int) TheArray[pob_Chick2].size();
706  m_Ourkfactors->m_ThisYear->setNoFemalesSept( ( nochicks / 2 ) + (int) TheArray[pob_Female].size() );
707  m_Ourkfactors->m_ThisYear->setNoMalesSept( ( nochicks / 2 ) + (int) TheArray[pob_Male].size() );
708  // Need to set old birds values too
709  Partridge_Base * pf;
710  unsigned sz = (unsigned) TheArray[pob_Female].size();
711  int oldbirds = 0;
712  for ( unsigned j = 0; j < sz; j++ )
713  {
714  pf = dynamic_cast < Partridge_Base * > ( TheArray[pob_Female] [j] );
715  if ( pf->GetAge() > 244 ) oldbirds++;
716  }
717  nochicks += ( sz - oldbirds );
719  oldbirds = 0;
720  sz = (unsigned) TheArray[pob_Male].size();
721  for ( unsigned j = 0; j < sz; j++ )
722  {
723  pf = dynamic_cast < Partridge_Base * > ( TheArray[pob_Male] [j] );
724  if ( pf->GetAge() > 244 ) oldbirds++;
725  }
726  m_Ourkfactors->m_ThisYear->setNoOldMales( oldbirds );
727  nochicks += ( sz - oldbirds );
730  // Here we have a problem that not all chicks have reached 6 weeks - so add
731  // the little ones now
733  // Do those calculations we can now
735  }
736  else if ( today == November )
737  { // after shoot is what is important
740  }
741  else if ( today == December+14 ) {
742  // Mid December counts of males and females
745  }
747  //DoSanityCheck();
748  //MaleImmigration(); // unused at present
749  TestShouldFlock();
750 }
751 
752 //---------------------------------------------------------------------------
753 
755 {
756 /*
757  x /= 10;
758  y /= 10;
759  return m_nestingcovermap->qualmap[x] [y];
760 */
761  return m_nestingcovermap->GetQual(a_x,a_y);
762 }
763 
764 //---------------------------------------------------------------------------
765 
767 {
768 /*
769  x /= 10;
770  y /= 10;
771  return m_territoryqualmap->qualmap[x] [y];
772 */
773  return m_territoryqualmap->GetQual(a_x,a_y);
774 }
775 
776 //---------------------------------------------------------------------------
777 
779 {
780  // Doing this by brute force takes forever, so this is done by creating a
781  // temporary map of covers first
782  //
785  CoverTempMap * tm;
786  tm = new CoverTempMap(lx, ly);
787  tm->ZeroQual();
789  double area;
791  for ( int i = 0; i < lx; i++ )
792  {
793  for ( int j = 0; j < ly; j++ )
794  {
795  tole = m_TheLandscape->SupplyElementType( i, j );
796  // Add the value of this cell to the qualmap
798  switch ( tole )
799  {
800  // case tole_Hedges:
801  // case tole_FieldBoundary:
802  case tole_HedgeBank:
803  // No good if it is sub-type 0
804  if ( m_TheLandscape->SupplyElementSubType( i, j ) > 0 )
805  {
806  tm->AddQual(i,j,1);
807  }
808  break;
809  default:
810  break;
811  }
812  }
813  }
814  // Now we can do the real job
815  // Create a grid of 10x10 squares (default for CoverTempMap)
816  // loop through the grid
817  for ( int i = 0; i < m_maxx; i++ )
818  {
819  for ( int j = 0; j < m_maxy; j++ )
820  {
821  // Needs the values for the 1km square we are in. (1000/8 = 125, so need to look at 125*125 squares)
822  area = 0;
823  for ( int ii = -50; ii < 50; ii++ )
824  {
825  for ( int jj = -50; jj < 50; jj++ )
826  area += tm->GetQualIndexed(( m_maxx + i + ii ) % m_maxx,( m_maxy + j + jj ) % m_maxy);
827  }
828  // Assume the mean width of useful habitat is 2.44m and per km (excl. trees)
829  m_nestingcovermap->SetQualIndexed(i,j,area/3132);
830  }
831  }
832  delete tm;
833 }
834 
835 //---------------------------------------------------------------------------
836 
838 {
839  int st;
840  switch ( a_cet )
841  {
842 
843  // Terrible stuff
844  case tole_IndividualTree:
845  case tole_WindTurbine:
847  case tole_WoodlandMargin:
848  case tole_Pylon:
850  case tole_MixedForest:
852  case tole_Building:
853  case tole_UrbanNoVeg:
854  return -2.0;
855 
856  // Bad stuff.
857  case tole_MetalledPath:
858  case tole_Carpark:
859  case tole_Churchyard:
860  case tole_Saltmarsh:
861  case tole_Stream:
862  case tole_HeritageSite:
864  case tole_RiversideTrees:
865  case tole_Garden:
866  case tole_Track:
867  case tole_SmallRoad:
868  case tole_LargeRoad:
869  case tole_ActivePit:
870  case tole_Pond:
871  case tole_Freshwater:
872  case tole_River:
873  case tole_Saltwater:
874  case tole_Coast:
875  case tole_BareRock:
876  case tole_AmenityGrass:
877  case tole_Parkland:
878  case tole_UrbanPark:
880  case tole_SandDune:
881  case tole_Copse:
882  case tole_PlantNursery:
883  return -1.0;
884 
885  // Questionable.
886  case tole_StoneWall:
887  case tole_Fence:
888  case tole_Hedges:
889  case tole_Marsh:
890  case tole_PitDisused:
891  return 0.0;
892 
893  // OK stuff
895  case tole_RoadsideSlope:
896  case tole_PermPasture:
898  return 2.0;
899 
901  case tole_RoadsideVerge:
902  case tole_Railway:
903  case tole_FieldBoundary:
906  case tole_YoungForest: // ?
907  case tole_Heath:
908  case tole_Orchard:
909  case tole_OrchardBand:
910  case tole_MownGrass:
911  case tole_Scrub:
912  case tole_Vildtager:
913  return 4.0;
914 
915  // Really good stuff!
916  case tole_BeetleBank:
917  return cfg_nest_hedgebank1.value();
918  case tole_HedgeBank:
919  st = m_TheLandscape->SupplyElementSubType( a_poly );
920  switch ( st )
921  {
922  case 0:
923  return cfg_nest_hedgebank0.value();
924  case 1:
925  return cfg_nest_hedgebank1.value();
926  case 2:
927  return cfg_nest_hedgebank2.value();
928  default:
929  return 100;
930  }
931  // Variable, depending on vegetation and condition of same.
932  case tole_Field:
934  return HabitatEvalPolyField( a_poly );
935 
936  default:
937  g_msg->Warn( WARN_BUG, "Partridge_Population_Manager::EvalTerrQual: Unknown Element type", "" );
938  exit( 10 );
939  }
940 }
941 
942 //---------------------------------------------------------------------------
944 {
945 
946  TTypesOfVegetation l_tov = m_TheLandscape->SupplyVegType( a_field );
947  int score = 0;
948  switch ( l_tov )
949  {
951  case tov_OGrazingPigs:
955  score = 0;
956  break;
957 
958  case tov_Carrots:
959  case tov_FieldPeas:
960  case tov_FodderBeet:
961  case tov_SugarBeet:
962  case tov_OFodderBeet:
963  case tov_Maize:
964  case tov_NoGrowth:
965  case tov_None:
966  case tov_OPotatoes:
967  case tov_WinterRape:
968  case tov_Potatoes:
970  score = 1;
971  break;
972 
975  case tov_FodderGrass:
978  case tov_Oats:
979  case tov_OOats:
980  case tov_OSeedGrass1:
981  case tov_OSeedGrass2:
982  case tov_OSpringBarley:
987  case tov_OTriticale:
988  case tov_OWinterBarley:
990  case tov_OWinterRape:
991  case tov_OWinterRye:
993  case tov_OWinterWheat:
994  case tov_SeedGrass1:
995  case tov_SeedGrass2:
996  case tov_SpringBarley:
997  case tov_SpringBarleySpr:
1001  case tov_SpringBarleyGrass:
1002  case tov_SpringBarleySeed:
1004  case tov_SpringRape:
1005  case tov_SpringWheat:
1006  case tov_Triticale:
1007  case tov_WinterBarley:
1008  case tov_WinterRye:
1009  case tov_WinterWheat:
1010  case tov_WWheatPControl:
1012  case tov_WWheatPTreatment:
1014  case tov_WinterWheatShort:
1018  case tov_OSBarleySilage:
1019  case tov_OCarrots:
1021  case tov_OFieldPeas:
1022  case tov_OFieldPeasSilage:
1023  case tov_YoungForest:
1024  case tov_Heath:
1025  case tov_BroadBeans:
1026  score = 2;
1027  if (m_TheLandscape->SupplyVegPatchy(a_field)) score+=2;
1028  //if (m_TheLandscape->SupplyHasTramlines(a_field)) score+=1;
1029  break;
1030 
1031  /* case tov_OGrassClover1: case tov_OGrassClover2: case tov_OBarleyPeaCloverGrass: case tov_OCarrots:
1032  case tov_OCloverGrassGrazed1: case tov_OCloverGrassGrazed2: case tov_OCloverGrassSilage1: case tov_OFieldPeas:
1033  case tov_OPermanentGrassGrazed: case tov_PermanentGrassGrazed: case tov_PermanentGrassTussocky: return 3.0; */
1034 
1035  case tov_Setaside:
1036  case tov_NaturalGrass:
1037  case tov_OSetaside:
1038  score = 4;
1039  if (m_TheLandscape->SupplyVegPatchy(a_field)) score+=2;
1040  break;
1041 
1042  case tov_Undefined:
1043  default:
1044  return 0;
1045  }
1046  return score;
1047 }
1048 
1049 //---------------------------------------------------------------------------
1050 /*
1051 void Partridge_Population_Manager::UpdateNestingCoverMap()
1052 {
1053  int lx = m_TheLandscape->SupplySimAreaHeight();
1054  int ly = m_TheLandscape->SupplySimAreaHeight();
1055  for ( int i = 0; i < lx / 10; i++ )
1056  {
1057  for ( int j = 0; j < ly / 10; j++ )
1058  {
1059  m_territoryqualmap->qualmap[i] [j] = 0;
1060  }
1061  }
1062  TTypesOfLandscapeElement tole;
1063  int oldref=-9999;
1064  double q=0;
1065  for ( int i = 0; i < lx; i++ )
1066  {
1067  for ( int j = 0; j < ly; j++ )
1068  {
1069  int nref = m_TheLandscape->SupplyPolyRef( i, j );
1070  if (nref==oldref) {
1071  m_territoryqualmap->qualmap[i / 10] [j / 10] += q;
1072  }
1073  else {
1074  tole = m_TheLandscape->SupplyElementType( i, j );
1075  // Add the value of this cell to the qualmap
1076  q = EvalHabitatQual( tole, m_TheLandscape->SupplyPolyRef( i, j ) ); // Uses the covey function in Partridge_Tuning.cpp via m_OurSpecialCovey;
1077  m_territoryqualmap->qualmap[i / 10] [j / 10] += q;
1078  oldref=nref;
1079  }
1080  }
1081  }
1082 }
1083 */
1085 {
1086  int lx = m_TheLandscape->SupplySimAreaWidth();
1087  int ly = m_TheLandscape->SupplySimAreaHeight();
1090  int oldref=-9999;
1091  double q=0;
1092  for ( int i = 0; i < lx; i++ )
1093  {
1094  for ( int j = 0; j < ly; j++ )
1095  {
1096  int nref = m_TheLandscape->SupplyPolyRef( i, j );
1097  if (nref==oldref) {
1098  m_territoryqualmap->AddQual(i,j,q);
1099  }
1100  else {
1101  tole = m_TheLandscape->SupplyElementType( i, j );
1102  // Add the value of this cell to the qualmap
1103  q = EvalHabitatQual( tole, m_TheLandscape->SupplyPolyRef( i, j ) ); // Uses the covey function in Partridge_Tuning.cpp via m_OurSpecialCovey;
1104  m_territoryqualmap->AddQual(i,j,q);
1105  oldref=nref;
1106  }
1107  }
1108  }
1109 }
1110 
1111 //---------------------------------------------------------------------------
1112 
1117 {
1118  unsigned size2 = (unsigned) TheArray[pob_Female].size();
1119  for ( unsigned j = 0; j < size2; j++ )
1120  {
1121  if ( random( 10000 ) < p_chance )
1122  {
1123  if (TheArray[pob_Female] [j]->GetCurrentStateNo() != -1) {
1124  TheArray[pob_Female] [j]->Dying();
1127  }
1128  }
1129  }
1130  size2 = (unsigned) TheArray[pob_Male].size();
1131  for ( unsigned j = 0; j < size2; j++ )
1132  {
1133  if ( random( 10000 ) < p_chance )
1134  {
1135  if (TheArray[pob_Male] [j]->GetCurrentStateNo() != -1) {
1136  TheArray[pob_Male] [j]->Dying();
1138  }
1139  }
1140  }
1141  size2 = (unsigned) TheArray[pob_Chick2].size();
1142  for ( unsigned j = 0; j < size2; j++ )
1143  { if (size2>0) {
1144  if ( random( 10000 ) < p_chance )
1145  {
1146  if (TheArray[pob_Chick2] [j]->GetCurrentStateNo() != -1) {
1147  TheArray[pob_Chick2] [j]->Dying();
1149  }
1150  }
1151  }
1152  }
1153 }
1154 
1155 
1160 {
1161  // First creates a density map of e.g. 1km squares
1162  unsigned GridSize=cfg_ParHuntingGridSize.value();
1163  unsigned Grids = SimW/GridSize;
1164  unsigned* densities = new unsigned[10000]; // This will allow up to 100x100 squares
1165  for (unsigned d=0; d<10000; d++) densities[d]=0;
1166  for (int pob=(int)pob_Chick2; pob<=(int)pob_Female; pob++) {
1167  unsigned size2 = (unsigned) TheArray[pob].size();
1168  for ( unsigned j = 0; j < size2; j++ ) {
1169  if (TheArray[pob] [j]->GetCurrentStateNo() != -1) {
1170  AnimalPosition AnPos=TheArray[pob] [j]->SupplyPosition();
1171  unsigned sqx=AnPos.m_x/GridSize;
1172  unsigned sqy=AnPos.m_y/GridSize;
1173  densities[(sqy*Grids)+sqx]++;
1174  }
1175  }
1176  }
1177  // Now go through and apply hunting
1178  unsigned ParHuntingThreshold=cfg_ParHuntingThreshold.value();
1179  for (int pob=(int)pob_Chick2; pob<=(int)pob_Female; pob++) {
1180  unsigned size2 = (unsigned) TheArray[pob].size();
1181  for ( unsigned j = 0; j < size2; j++ ) {
1182  if ( random( 10000 ) < p_chance ) {
1183  if (TheArray[pob] [j]->GetCurrentStateNo() != -1) {
1184  AnimalPosition AnPos=TheArray[pob] [j]->SupplyPosition();
1185  unsigned sqx=AnPos.m_x/GridSize;
1186  unsigned sqy=AnPos.m_y/GridSize;
1187  if (densities[(sqy*Grids)+sqx]>ParHuntingThreshold) {
1188  if ( random( 10000 ) < p_chance ) {
1189  TheArray[pob] [j]->Dying();
1191  }
1192  }
1193  }
1194  }
1195  }
1196  }
1197  delete[] densities;
1198 }
1199 
1205 {
1206  int tx1 = cfg_BeetleBankMinX.value();
1207  int tx2 = cfg_BeetleBankMaxX.value();
1208  int ty1 = cfg_BeetleBankMinY.value();
1209  int ty2 = cfg_BeetleBankMaxY.value();
1210  double huntpercent_out, huntpercent_in;
1211  if (!cfg_BeetleBankInvert.value())
1212  {
1213  huntpercent_out = a_pct;
1214  huntpercent_in =cfg_ParHuntingBeetleBankArea.value();
1215  }
1216  else
1217  {
1218  huntpercent_in = a_pct;
1219  huntpercent_out =cfg_ParHuntingBeetleBankArea.value();
1220  }
1221  for (int pob=(int)pob_Chick2; pob<=(int)pob_Female; pob++)
1222  {
1223  unsigned size2 = (unsigned) TheArray[pob].size();
1224  for ( unsigned j = 0; j < size2; j++ )
1225  {
1226  if (TheArray[pob] [j]->GetCurrentStateNo() != -1)
1227  {
1228  APoint AnPos=TheArray[pob] [j]->SupplyPoint();
1229  if ((AnPos.m_x >= tx1) && (AnPos.m_y >= ty1) && (AnPos.m_x <= tx2) && (AnPos.m_y <= ty2))
1230  {
1231  if ( random( 10000 ) < huntpercent_in )
1232  {
1233  TheArray[pob] [j]->Dying();
1235  }
1236  }
1237  else
1238  if ( random( 10000 ) < huntpercent_out )
1239  {
1240  TheArray[pob] [j]->Dying();
1242  }
1243  }
1244  }
1245  }
1246 }
1247 
1248 
1253 {
1254  int today = m_TheLandscape->SupplyDayInYear();
1255  //if ( today == 60 )
1256  {
1257  for ( unsigned j = 0; j < TheArray[pob_Covey].size(); j++ )
1258  {
1259  dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [j] )->SanityCheck();
1260  }
1261  }
1262  if (( today < 61 ) || (today>270))
1263  {
1264  for ( unsigned j = 0; j < TheArray[pob_Covey].size(); j++ )
1265  {
1266  dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [j] )->SanityCheck4();
1267  }
1268  }
1269 }
1270 
1275 {
1276  // THIS IS A DEBUG FUNCTION
1277  int counter = 0;
1278  for ( unsigned j = 0; j < TheArray[pob_Male].size(); j++ )
1279  {
1280  Partridge_Male * pm = dynamic_cast < Partridge_Male * > ( TheArray[pob_Male] [j] );
1281  if ( pm->WhatState() != pars_Destroy )
1282  {
1283  int res = pm->AmIaMember();
1284  if ( res == 1 ) bad_guys[counter++] = pm;
1285  if ( res == 2 )
1286  {
1287  m_TheLandscape->Warn( "Partridge_Pop_Man::DoMaleSanityCheck(): ""Someone is not a member of their covey", "" );
1288  exit( 0 );
1289  }
1290  }
1291  }
1292 }
1293 
1294 //---------------------------------------------------------------------------
1295 
1296 
1298 {
1299 #ifdef __PARDEBUG4
1300  DoSanityCheck();
1301 #endif
1302 }
1303 
1304 //---------------------------------------------------------------------------
1305 
1306 
1308 {
1309  int today = m_TheLandscape->SupplyDayInYear();
1310  // Shooting after cfg_ParShootStartYear years
1312  if ( today == September+4 )
1313  {
1314  // 5th September is shooting day
1315  int pct= random(cfg_ParShotMax.value()-cfg_ParShotMin.value());
1316  pct+=cfg_ParShotMin.value();
1317  if (cfg_ParHuntingType.value()==1) HuntingGrid( pct );
1319  else Hunting( pct );
1320  }
1321  }
1322 }
1323 
1324 //---------------------------------------------------------------------------
1325 
1327 {
1329 #ifdef __PARDEBUG4
1330  DoSanityCheck();
1331 #endif
1332 }
1333 //---------------------------------------------------------------------------
1334 
1336 {
1338  {
1339  // Calculate and write output to flock data file
1340  int si = (int) TheArray[pob_Covey].size();
1341  int size, chi;
1342  for ( int i = 0; i < si; i++ )
1343  {
1344  // Generate a date to dissolve
1345  size = dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [i] )->GetCoveySize();
1346  chi = dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [i] )->GetOurChicks();
1348  }
1349  }
1350  // Unpaired Males
1352  {
1353  // Calculate and write output to flock data file
1354  int si = (int) TheArray[pob_Male].size();
1355  int upm = 0;
1356  for ( int i = 0; i < si; i++ )
1357  {
1358  // Generate a date to dissolve
1359  if ( !dynamic_cast < Partridge_Male * > ( TheArray[pob_Male] [i] )->GetMate() ) upm++;
1360  }
1362  }
1363  // No Breeding Pairs
1365  {
1366  // Calculate and write output to flock data file
1367  int si = (int) TheArray[pob_Female].size();
1368  int nobs = 0;
1369  for ( int i = 0; i < si; i++ )
1370  {
1371  // Generate a date to dissolve
1372  if ( dynamic_cast < Partridge_Female * > ( TheArray[pob_Female] [i] )->GetMate() ) nobs++;
1373  }
1375  }
1376  if ( m_TheLandscape->SupplyDayInYear() == 364 )
1377  {
1379  m_HatchSuccess = 0;
1380  }
1381 }
1382 
1383 //---------------------------------------------------------------------------
1384 
1391 {
1392  double mult;
1393  for ( int i = 0; i < 200; i++ )
1394  {
1395  // using the raw data will provide the result in Kcal per day
1396  // These then need to be scaled to the expectation of extraction
1397  // by multiplication by the extraction rate
1399  else
1400  mult = i;
1401  // SetFoodNeed(i,(double) cfg_par_energyslope_perday.value()*mult);
1402 #ifdef __RAIN_HURTS
1403  // NB 0.8 is just a guess - we would need a special study on this to firm up this factor
1404  g_FoodNeed[i] = ( double )cfg_par_energyslope_perday.value() * mult * cfg_rainscaling.value();
1405 #else
1406  g_FoodNeed[i] = ( double )cfg_par_energyslope_perday.value() * mult;
1407 #endif
1408  }
1409  int half_grown = cfg_par_mature_threshold.value() / 2;
1410  for ( int i = 0; i < 200; i++ )
1411  {
1412  if ( i > half_grown ) mult = half_grown;
1413  else
1414  mult = i;
1415  g_MaxWalk[i] = ( int )( 50 + ( ( ( 500 - 50 ) / half_grown ) * mult ) );
1416  }
1417 }
1418 //---------------------------------------------------------------------------
1423 {
1424  /* // The aim here is to get covey dissolve after 31st Jan, when we have a 5 day
1425  // period with temp above 5 (mean) and rainfall <2mm long int d1 = m_TheLandscape->SupplyGlobalDate();
1426  for ( int i = 0; i < 5; i++ ) { if ( m_TheLandscape->SupplyTemp( d1 - i ) < 2.5 ) return false;
1427  // if ( m_TheLandscape->SupplyRain( d1 - i ) >= 2.0 ) return false; } // No wet or cold days so all OK */
1428  return true;
1429 }
1430 //---------------------------------------------------------------------------
1431 
1436 {
1437  int today = m_TheLandscape->SupplyDayInYear();
1438  if ( ( m_ShouldFlock ) && ( today > cfg_par_start_dissolve.value() ) && ( today < 150 ) && ( CoveyDissolveWeather() ) )
1439  {
1440  m_ShouldFlock = false;
1441  // Now need to tell the coveys to pair the birds
1442  // and break up
1443  //
1444  int si = (int) TheArray[pob_Covey].size();
1445  for ( int i = 0; i < si; i++ )
1446  {
1447  // Generate a date to dissolve
1448  // Just make sure it is not too late
1449  if ( today > 80 ) today = 80;
1450  dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [i] )->OnDissolve( today );
1451  }
1452  }
1453  if ( today >= cfg_par_male_gives_up.value() ) m_ShouldFlock = true;
1454 }
1455 
1456 //---------------------------------------------------------------------------
1457 
1476 {
1477 #ifdef __PAR_DEBUG2
1478  a_covey->SanityCheck();
1479  if ( !a_covey->AllFlocking2() )
1480  {
1481  m_TheLandscape->Warn( "Partridge_Pop_Man::DissolveCovey(): someone not flocking", "" );
1482  exit( 1 );
1483  }
1484  if ( !a_covey->ArePaired() )
1485  {
1486  m_TheLandscape->Warn( "Partridge_Pop_Man::DissolveCovey(): someone still paired", "" );
1487  exit( 1 );
1488  }
1489 #endif
1490  Partridge_Female * pf;
1491  Partridge_Male * pm;
1492  Partridge_Base * pb;
1493  int remaining = a_covey->GetCoveySize();
1494  do
1495  {
1496  // First loop through the females and see if they have old mates in the covey
1497  pf = a_covey->GetUnpairedFemale();
1498  if ( pf ) // There is a female and she has an oldmate in the covey
1499  {
1500  pm = pf->GetOldMate();
1501  // Take them both out of the covey
1502  remaining = a_covey->RemoveMember( pm );
1503  pm->SetUncleStatus( false );
1504  //remaining = a_covey->RemoveMember( pf );
1505  if (pf->GetUncleStatus()) {
1506  pf->SetUncleStatus( false );
1507  }
1508  // The Male must now make his own covey
1509  pm->MakeCovey(); // this will update his m_covey
1510  m_comms_data->m_female = pf;
1511  m_comms_data->m_male = pm;
1512  m_comms_data->m_covey = pm->GetCovey(); // synchronise coveys
1514  //remaining--; // The female gets removed from the covey by the above line
1515 #ifdef __PAR_DEBUG2
1516  if ( pm->GetObjectType() != pob_Male ) {
1517  m_TheLandscape->Warn( "Partridge_Pop_Man::DissolveCovey(): pm not male", "" );
1518  exit( 1 );
1519  }
1520  if ( pf->GetObjectType() != pob_Female ) {
1521  m_TheLandscape->Warn( "Partridge_Pop_Man::DissolveCovey(): pf not female", "" );
1522  exit( 1 );
1523  }
1524 
1525 #endif
1527  remaining = a_covey->GetCoveySize();
1528  }
1529  }
1530  while ( ( pf ) && ( remaining > 0 ) );
1531  // Send single males off
1532  pm=NULL;
1533  do {
1534  pm=a_covey->GetMaleInCovey();
1535  // The Male must now make his own covey
1536  if (pm!=NULL) {
1537  pm->MakeCovey(); // this will update his m_covey
1538  a_covey->RemoveMember(pm);
1539  remaining = a_covey->GetCoveySize();
1540  pm->StartBreedingBehaviour();
1541  }
1542  } while ( ( pm!=NULL ) && ( remaining > 0 ) && (a_covey->GetCurrentStateNo() > -1));
1543 
1544  if ( remaining > 0 )
1545  {
1546  // Should now only be females left
1547  pf = NULL;
1548  // At this point remaining has the remaining number of birds
1549  for ( int bird = 0; bird < remaining; bird++ )
1550  {
1551  pb = a_covey->GetMember( bird );
1552  pb->SetUncleStatus(false);
1553 #ifdef __PAR_DEBUG2
1554  if ( pb->GetObjectType() == pob_Male ) {
1555  m_TheLandscape->Warn( "Partridge_Pop_Man::DissolveCovey(): Male left in covey on dissolve", "" );
1556  exit( 1 );
1557  }
1558 #endif
1559  pf = dynamic_cast < Partridge_Female * > ( pb );
1560  m_comms_data->m_female = pf;
1561  m_messagecentre.PassMessage( m_comms_data, pcomm_WaitForMale ); // tells her to wait here for a male
1562  }
1563  }
1564 #ifdef __PAR_DEBUG2
1565  a_covey->SanityCheck();
1566 #endif
1567 }
1568 
1569 //---------------------------------------------------------------------------
1570 
1571 bool Partridge_Population_Manager::FillCoveyNeigbourList( Partridge_Covey * a_covey, int a_distance, int a_x, int a_y )
1572 {
1573  // This list loops through the coveys and checks whether they are within
1574  // a_distance. If so add them to the covey neighbour list
1575  //
1576  // Start by emptying the covey neighbour list
1577  a_covey->m_neighbourlist_size = 0;
1578  // Now loop
1579  int size2 = (int) TheArray[pob_Covey].size();
1580  for ( int j = 0; j < size2; j++ )
1581  {
1582  int x = TheArray[pob_Covey] [j]->Supply_m_Location_x();
1583  int y = TheArray[pob_Covey] [j]->Supply_m_Location_y();
1584  int dx = abs( x - a_x );
1585  int dy = abs( y - a_y );
1586  // OK OK, this is not the real distance, but it is a reasonable approximation (max x0.3 out)
1587  int dist = dx + dy;
1588  // There are only 25 spaces in the neighbour list so don't risk an overflow
1589  if ( ( a_covey->m_neighbourlist_size < 25 ) && ( dist <= a_distance ) &&
1590  ( TheArray[pob_Covey] [j] != a_covey ) && ( TheArray[pob_Covey] [j]->GetCurrentStateNo() != -1) )
1591  {
1592  Partridge_Covey * cov = dynamic_cast < Partridge_Covey * > ( TheArray[pob_Covey] [j] );
1593  a_covey->m_neighbourlist[a_covey->m_neighbourlist_size++] = cov;
1594  }
1595  }
1596  if ( a_covey->m_neighbourlist_size == 0 ) return false;
1597  return true;
1598 }
1599 
1600 //---------------------------------------------------------------------------
1601 
1602 // Special Partridge Output Section
1603 
1604 //ParAdMort; // Adult mortality record
1605 //ParJuvMort; // Juvenile mortaltiy record
1606 //ParNoB; // No of breeding Pairs
1607 //ParClutches; // For each clutch, clutch no. & size
1608 //ParFlocks; // Covey size 1st oct, + no. chicks
1609 //ParUnpairedMale; // No unparied males 1st Jun
1610 //NoHatchedPerYear; // No. successful hatches per year
1611 
1613 {
1614  ParAdMort = fopen("ParAdMort.txt", "w" );
1615  if ( !ParAdMort ) return false;
1616  ParJuvMort = fopen("ParJuvMort.txt", "w" );
1617  if ( !ParJuvMort ) return false;
1618  ParNoB = fopen("ParNoB.txt", "w" );
1619  if ( !ParNoB ) return false;
1620  ParClutches = fopen("ParClutches.txt", "w" );
1621  if ( !ParClutches ) return false;
1622  ParFlocks = fopen("ParFlocks.txt", "w" );
1623  if ( !ParFlocks ) return false;
1624  ParUnpairedMale = fopen("ParUnpairedMale.txt", "w" );
1625  if ( !ParUnpairedMale ) return false;
1626  NoHatchedPerYear = fopen("NoHatchedPerYear.txt", "w" );
1627  if ( !NoHatchedPerYear ) return false;
1628  return true;
1629 }
1630 
1632 {
1633  /* FILE * fff = fopen( "MeanFoodPerday.txt", "w" );
1634 
1635  fprintf( fff, "%g\n", debug_totalfood / debug_totaldays ); fprintf( fff, "Starved Chicks %d\n", m_Starved );
1636  fprintf( fff, "Eaten Chicks %d\n", m_Eaten ); fprintf( fff, "Matured Chicks %d\n", m_Matured );
1637  fprintf( fff, "Eaten Clutches %d\n", m_EatenE ); fprintf( fff, "Matured Clutches %d\n", m_MaturedE ); fclose( fff ); */
1638  fclose( ParAdMort );
1639  fclose( ParJuvMort );
1640  fclose( ParNoB );
1641  fclose( ParClutches );
1642  fclose( ParFlocks );
1643  fclose( ParUnpairedMale );
1644  fclose( NoHatchedPerYear );
1645  FILE * idb = fopen("k_facInfoBase.txt", "a" );
1646  if (!idb) {
1647  g_msg->Warn( "k_factors::DumpInfoDatabase","Cannot open k_facInfoBase.txt" );
1648  exit( 1 );
1649  }
1650  fprintf( idb, "0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n");
1651  fclose( idb );
1652 #ifdef __NESTPOSITIONS_OUT
1653  fclose(NestPositions);
1654 #endif
1655  return true;
1656 }
1657 
1658 void Partridge_Population_Manager::WriteParAdMort( int a_min, int a_age, int a_sex, int a_cause )
1659 {
1660  fprintf( ParAdMort, "%d %d %d %d\n", a_min, a_age, a_sex, a_cause );
1661  // fflush(ParAdMort);
1662 }
1663 
1664 void Partridge_Population_Manager::WriteParJuvMort( int a_yr, int a_min, int a_age, int a_cause )
1665 {
1666  fprintf( ParJuvMort, "%d\t%d\t%d\t%d\n", a_yr, a_min, a_age, a_cause );
1667  // fflush(ParJuvMort);
1668 }
1669 
1670 void Partridge_Population_Manager::WriteParNoB( int a_min, int a_nob )
1671 {
1672  fprintf( ParNoB, "%d %d\n", a_min, a_nob );
1673  fflush( ParNoB );
1674 }
1675 
1677 {
1678  fprintf( ParUnpairedMale, "%d %d\n", a_min, a_num );
1679  fflush( ParUnpairedMale );
1680 }
1681 
1682 void Partridge_Population_Manager::WriteParClutches( int a_min, int a_num1, int a_num2 )
1683 {
1684  fprintf( ParClutches, "%d\t%d\t%d\n", a_min, a_num1, a_num2 );
1685  // fflush(ParClutches);
1686 }
1687 
1688 void Partridge_Population_Manager::WriteParFlocks( int a_min, int a_size, int a_young )
1689 {
1690  fprintf( ParFlocks, "%d %d %d\n", a_min, a_size, a_young );
1691  fflush( ParFlocks );
1692 }
1693 
1697 {
1698  fprintf( NoHatchedPerYear, "%d %d\n", a_min, a_num );
1699  fflush( NoHatchedPerYear );
1700 }
1701 
1702 
1703 
1704 
1706  m_AOR_Probe->DoProbe(pob_Female);
1707 }
1708 //-----------------------------------------------------------------------------
1709 
1714  Partridge_Female* FS;
1715  unsigned totalF=(unsigned) TheArray[pob_Female].size();
1716  int x,y;
1719  fprintf(a_prb,"%d %d %d %d %d\n", 0,w ,0, h, totalF);
1720  for (unsigned j=0; j<totalF; j++) //adult females
1721  {
1722  FS=dynamic_cast<Partridge_Female*>(TheArray[pob_Female][j]);
1723  x=FS->Supply_m_Location_x();
1724  y=FS->Supply_m_Location_y();
1725  fprintf(a_prb,"%d\t%d\n", x,y);
1726  }
1727  fflush(a_prb);
1728 }
1729 //-------------------------------------------------------------------------------------------------
1730 
1736  //
1737  // First do we have the right day?
1738  int today = m_TheLandscape->SupplyDayInYear();
1739  if (today!=1) return;
1740  // First do we have the right year?
1742  if (year%cfg_pm_eventfrequency.value()!=0) return;
1743 
1744  Partridge_Male* PM = NULL; // assignment to get rid of warning
1745  Partridge_Female* PF = NULL;
1746  Partridge_Base* PB = NULL;
1747  // Now if the % decrease is higher or lower than 100 we need to do different things
1748  int esize=cfg_pm_eventsize.value();
1749  if (esize<100) {
1750  unsigned size2 = (unsigned) TheArray[ pob_Male ].size();
1751  for ( unsigned j = 0; j < size2; j++ ) {
1752  if (random(100) > esize) {
1753  PM = dynamic_cast < Partridge_Male * > ( TheArray[ pob_Male ] [ j ] );
1754  PM->SetState(pars_MDying); // Kill it
1755  }
1756  }
1757  size2 = (unsigned) TheArray[ pob_Female ].size();
1758  for ( unsigned j = 0; j < size2; j++ ) {
1759  if (random(100) > esize) {
1760  PF = dynamic_cast < Partridge_Female * > ( TheArray[ pob_Female ] [ j ] );
1761  PF->SetState(pars_FDying); // Kill it
1762  }
1763  }
1764  } else if (esize>100) {
1765  // This is a tricky thing to do because we need to duplicate birds, but dare not mess
1766  // mate pointers etc up.
1767  // This also requires a copy method in the target birds
1768  // esize also needs translating 120 = 20%, 200 = 100%
1769  if (esize<200) {
1770  esize-=100;
1771  unsigned size2;
1772  size2 = (unsigned) TheArray[ pob_Male ].size();
1773  for ( unsigned j = 0; j < size2; j++ ) {
1774  if (random(100) < esize) {
1775  PB = dynamic_cast < Partridge_Base * > ( TheArray[ pob_Male ] [ j ] );
1776  PB->CopyMyself(pob_Male); // Duplicate it
1777  }
1778  }
1779  size2 = (unsigned) TheArray[ pob_Female ].size();
1780  for ( unsigned j = 0; j < size2; j++ ) {
1781  if (random(100) < esize) {
1782  PB = dynamic_cast < Partridge_Base * > ( TheArray[ pob_Female ] [ j ] );
1783  PB->CopyMyself(pob_Female); // Duplicate it
1784  }
1785  }
1786  } else {
1787  esize-=100;
1788  esize/=100; // this will throw away fractional parts so will get 1, 2, 3 from 200, 350 400
1789  unsigned size2;
1790  size2 = (unsigned) TheArray[ pob_Male ].size();
1791  for ( unsigned j = 0; j < size2; j++ ) {
1792  for ( int e=0; e<esize; e++) {
1793  PB = dynamic_cast < Partridge_Base * > ( TheArray[ pob_Male ] [ j ] );
1794  PB->CopyMyself(pob_Male); // Duplicate it
1795  }
1796  }
1797  size2 = (unsigned) TheArray[ pob_Female ].size();
1798  for ( unsigned j = 0; j < size2; j++ ) {
1799  for ( int e=0; e<esize; e++) {
1800  PB = dynamic_cast < Partridge_Base * > ( TheArray[ pob_Female ] [ j ] );
1801  PB->CopyMyself(pob_Female); // Duplicate it
1802  }
1803  }
1804  }
1805  }
1806  else return; // No change so do nothing
1807 }
1808 //-----------------------------------------------------------------------------
1809 
1814  //
1815  // First do we have the right day?
1816  int today = m_TheLandscape->SupplyDayInYear();
1817  if (today!=212) return;
1818 
1819  // Now if the % decrease is higher or lower than 100 we need to do different things
1820  int esize=cfg_MaleImmigration.value();
1821  if (esize<1) return; // why waste time if there is nothing to do
1822  Partridge_Base* PB = NULL;
1823  // This is a tricky thing to do because we need to duplicate birds, but dare not mess
1824  // mate pointers etc up.
1825  // This also requires a copy method in the target birds
1826  // esize also needs translating 120 = 20%, 200 = 100%
1827  unsigned size2;
1828  size2 = (unsigned) TheArray[ pob_Male ].size();
1829  for ( unsigned j = 0; j < size2; j++ ) {
1830  if (random(100) < esize) {
1831  PB = dynamic_cast < Partridge_Base * > ( TheArray[ pob_Male ] [ j ] );
1832  PB->CopyMyself(pob_Male); // Duplicate it
1833  }
1834  }
1835 }
1836 //-----------------------------------------------------------------------------
pars_ClDeveloping
Definition: Partridge_All.h:273
CoverTempMap
For storing assessed habitat quality.
Definition: Partridge_Population_Manager.h:68
k_factors::calcreal_2
void calcreal_2()
Definition: Partridge_All.cpp:3006
tov_AgroChemIndustryCereal
Definition: tov_declaration.h:55
Partridge_Population_Manager::m_Ourkfactors
k_factors * m_Ourkfactors
Pointer to kfactors object.
Definition: Partridge_Population_Manager.h:169
Clutch_struct::Mum
Partridge_Female * Mum
Definition: Partridge_All.h:365
tov_OSpringBarleyClover
Definition: tov_declaration.h:46
tole_HedgeBank
Definition: tole_declaration.h:68
k_factors::m_ThisYear
population_attributes * m_ThisYear
Definition: Partridge_All.h:251
tole_UrbanNoVeg
Definition: tole_declaration.h:78
Partridge_Base::SetUncleStatus
void SetUncleStatus(bool a_Status)
Set uncle status.
Definition: Partridge_All.h:442
tole_Saltwater
Definition: tole_declaration.h:66
May
const int May
Definition: landscape.h:40
tov_Oats
Definition: tov_declaration.h:40
tole_UnsprayedFieldMargin
Definition: tole_declaration.h:72
tov_OWinterBarley
Definition: tov_declaration.h:47
Partridge_Covey::RemoveMember
int RemoveMember(Partridge_Base *a_former_member)
Remove a member from the covey.
Definition: Partridge_Covey.cpp:1664
pars_FCaringForYoung
Definition: Partridge_All.h:283
cfg_IndividualEmigration
CfgInt cfg_IndividualEmigration("PAR_INDIVIDUALEMIGRATION", CFG_CUSTOM, 3500)
Emigration rate of alone individuals (of 10000)
population_attributes::incNoChicksSixWeeks
void incNoChicksSixWeeks()
Definition: Partridge_All.h:112
Partridge_Population_Manager::m_nestingcovermap
CoverTempMap * m_nestingcovermap
Pointer to nesting cover map.
Definition: Partridge_Population_Manager.h:167
population_attributes::SetPairsInApril
void SetPairsInApril(double pa)
Definition: Partridge_All.h:116
Partridge_Male
The partridge male class.
Definition: Partridge_All.h:657
Partridge_Female::KillThis
virtual void KillThis()
Direct mortality message.
Definition: Partridge_All.h:888
Partridge_struct::family_counter
int family_counter
Definition: Partridge_All.h:350
Population_Manager::m_catastrophestartyear
int m_catastrophestartyear
Definition: populationmanager.h:532
Partridge_Female
The partridge female class.
Definition: Partridge_All.h:770
tole_Building
Definition: tole_declaration.h:62
cfg_BeetleBankMinY
CfgInt cfg_BeetleBankMinY
Partridge_Communication::PassMessage
bool PassMessage(PartridgeCommunicationData *pc_data, TypeOfPartridge_Communication pc)
Pass a message.
Definition: Partridge_Communication.cpp:86
CoverTempMap::AddQual
void AddQual(int a_x, int a_y, double a_qual)
Definition: Partridge_Population_Manager.h:77
Chick_struct::Mum
Partridge_Female * Mum
Definition: Partridge_All.h:376
Population_Manager::DoLast
virtual void DoLast()
Definition: PopulationManager.cpp:530
cfg_AOROutput_used
CfgBool cfg_AOROutput_used
Partridge_Covey::GetMaleInCovey
Partridge_Male * GetMaleInCovey()
Find a male in the covey.
Definition: Partridge_Covey.cpp:2323
tole_Freshwater
Definition: tole_declaration.h:64
Partridge_Population_Manager::DoAlmostLast
virtual void DoAlmostLast()
Utility method called after EndStep.
Definition: Partridge_Population_Manager.cpp:1335
tov_OPermanentGrassGrazed
Definition: tov_declaration.h:44
Partridge_Population_Manager::~Partridge_Population_Manager
virtual ~Partridge_Population_Manager(void)
Definition: Partridge_Population_Manager.cpp:177
Partridge_Population_Manager::m_loop_index
unsigned int m_loop_index
Definition: Partridge_Population_Manager.h:110
Partridge_Covey::GetMember
Partridge_Base * GetMember(int a_member)
Returns pointer to a_member.
Definition: Partridge_Covey.cpp:1638
Landscape::SupplyVegType
TTypesOfVegetation SupplyVegType(int a_x, int a_y)
Definition: landscape.h:1321
Partridge_Population_Manager::WriteNoHatchedPerYear
void WriteNoHatchedPerYear(int a_min, int a_num)
Output method.
Definition: Partridge_Population_Manager.cpp:1696
population_attributes::SetMalesInApril
void SetMalesInApril(double fa)
Definition: Partridge_All.h:124
Landscape::SupplyElementType
TTypesOfLandscapeElement SupplyElementType(int a_polyref)
Definition: landscape.h:1110
pars_MFollowingMate
Definition: Partridge_All.h:279
population_attributes::incNoClutchesHatched
void incNoClutchesHatched()
Definition: Partridge_All.h:96
tole_Parkland
Definition: tole_declaration.h:77
Partridge_Population_Manager::ObjectLoopFetch
TAnimal * ObjectLoopFetch(void)
Definition: Partridge_Population_Manager.cpp:196
tole_StoneWall
Definition: tole_declaration.h:56
Partridge_Population_Manager::ParFlocks
FILE * ParFlocks
Covey size 1st oct, + no. chicks.
Definition: Partridge_Population_Manager.h:140
tole_RiversidePlants
Definition: tole_declaration.h:49
Partridge_Population_Manager::m_maxy
int m_maxy
Definition: Partridge_Population_Manager.h:129
Partridge_Population_Manager::m_loop_ob_type
int m_loop_ob_type
Definition: Partridge_Population_Manager.h:114
December
const int December
Definition: landscape.h:47
Partridge_Base::MakeCovey
void MakeCovey()
Create our own covey.
Definition: Partridge_All.cpp:206
Population_Manager::TheArray
vector< TListOfAnimals > TheArray
Definition: populationmanager.h:534
Partridge_Population_Manager::m_Partridge_IDs
unsigned int m_Partridge_IDs
Definition: Partridge_Population_Manager.h:116
Population_Manager::StateNamesLength
unsigned StateNamesLength
Definition: populationmanager.h:535
tole_Garden
Definition: tole_declaration.h:58
tov_OOats
Definition: tov_declaration.h:44
tole_Churchyard
Definition: tole_declaration.h:86
Population_Manager::m_population_type
TTypesOfPopulation m_population_type
Definition: populationmanager.h:580
Partridge_Population_Manager::GetTerrQual
double GetTerrQual(int x, int y)
Definition: Partridge_Population_Manager.cpp:766
tole_RoadsideSlope
Definition: tole_declaration.h:83
k_factors
Class for calculating k-factors.
Definition: Partridge_All.h:235
tole_MixedForest
Definition: tole_declaration.h:53
Partridge_struct
Struct to basic partridge information.
Definition: Partridge_All.h:342
tov_OSetaside
Definition: tov_declaration.h:46
tov_OTriticale
Definition: tov_declaration.h:47
cfg_pm_eventsize
CfgInt cfg_pm_eventsize
pars_MCaringForYoung
Definition: Partridge_All.h:279
Partridge_Population_Manager::m_loop_limit
unsigned int m_loop_limit
Definition: Partridge_Population_Manager.h:112
cfg_RipleysOutput_used
CfgBool cfg_RipleysOutput_used
cfg_ParHuntingType
static CfgInt cfg_ParHuntingType("PAR_HUNTINGTYPE", CFG_CUSTOM, 1)
0 if global hunting, else threshold
tov_OWinterWheatUndersown
Definition: tov_declaration.h:49
tole_Copse
Definition: tole_declaration.h:82
tov_Undefined
Definition: tov_declaration.h:114
Partridge_Population_Manager::ParJuvMort
FILE * ParJuvMort
Juvenile mortaltiy record.
Definition: Partridge_Population_Manager.h:134
cfg_MaleImmigration
static CfgInt cfg_MaleImmigration("PAR_MALEIMMIGRATION", CFG_CUSTOM, 0)
unused
pars_CMoving
Definition: Partridge_All.h:270
Population_Manager::ReallyBigOutputPrb
FILE * ReallyBigOutputPrb
Definition: populationmanager.h:595
cfg_ParHuntingGridSize
static CfgInt cfg_ParHuntingGridSize("PAR_HUNTINGGRIDSIZE", CFG_CUSTOM, 1000)
Size if hunting grid (m)
tole_BareRock
Definition: tole_declaration.h:75
tole_Saltmarsh
Definition: tole_declaration.h:88
Partridge_Population_Manager::ClutchDensity
int ClutchDensity(int x, int y, int radius)
Returns clutch density at x,y with radius radius.
Definition: Partridge_Population_Manager.cpp:569
Partridge_Population_Manager::ParClutches
FILE * ParClutches
For each clutch, clutch no. & size.
Definition: Partridge_Population_Manager.h:138
Partridge_Population_Manager::CreateInitialObjects
void CreateInitialObjects(int ob_type, int number)
Definition: Partridge_Population_Manager.cpp:465
cfg_unpaireddata_date
static CfgInt cfg_unpaireddata_date("PAR_UNPAIREDDATA_DATE", CFG_CUSTOM, 150)
Probe date.
tov_WinterWheat
Definition: tov_declaration.h:55
cfg_par_last_brood_date
CfgInt cfg_par_last_brood_date
Latest date for a reproduction attempt.
tov_OCloverGrassSilage1
Definition: tov_declaration.h:43
TOP_Partridge
Definition: populationmanager.h:65
tov_PermanentGrassTussocky
Definition: tov_declaration.h:49
Partridge_Base::SetState
void SetState(Partridge_State a_pars)
Set state.
Definition: Partridge_All.h:462
cfg_par_mature_threshold
CfgInt cfg_par_mature_threshold
Age at maturing in days.
tole_Railway
Definition: tole_declaration.h:39
tov_Heath
Definition: tov_declaration.h:66
Partridge_Population_Manager::m_comms_data
PartridgeCommunicationData * m_comms_data
Message data.
Definition: Partridge_Population_Manager.h:161
Population_Manager::OpenTheRipleysOutputProbe
bool OpenTheRipleysOutputProbe(string a_NWordFilename)
Definition: PopulationManager.cpp:757
cfg_FemalePopSizeMaxCutoff
static CfgInt cfg_FemalePopSizeMaxCutoff("PAR_FEMMAXPOPSIZECUTOFF", CFG_CUSTOM, 7000)
Point at which the simulation is terminated due to excessive population size.
tole_RoadsideVerge
Definition: tole_declaration.h:38
Partridge_Clutch
The partridge clutch class.
Definition: Partridge_All.h:518
tole_Pylon
Definition: tole_declaration.h:96
pars_CoveyDissolve
Definition: Partridge_All.h:285
tov_OCloverGrassGrazed2
Definition: tov_declaration.h:43
Partridge_Population_Manager::NoHatchedPerYear
FILE * NoHatchedPerYear
No. successful hatches per year.
Definition: Partridge_Population_Manager.h:144
Partridge_Covey::AllFlocking2
bool AllFlocking2()
Debug method.
Definition: Partridge_Covey.cpp:2373
WARN_BUG
Definition: maperrormsg.h:34
tole_WoodlandMargin
Definition: tole_declaration.h:98
cfg_BeetleBankMaxY
CfgInt cfg_BeetleBankMaxY
Population_Manager::m_SimulationName
char m_SimulationName[255]
Definition: populationmanager.h:513
AnimalPosition::m_x
unsigned m_x
Definition: populationmanager.h:172
CoverTempMap::GetQualIndexed
double GetQualIndexed(int a_x, int a_y)
Definition: Partridge_Population_Manager.h:78
Partridge_Base
Base class for all partridge classes.
Definition: Partridge_All.h:401
Partridge_Male::KillThis
virtual void KillThis()
General direct mortality handler.
Definition: Partridge_All.h:703
tov_PermanentSetaside
Definition: tov_declaration.h:49
Partridge_Population_Manager::Init
virtual void Init(void)
Definition: Partridge_Population_Manager.cpp:207
tole_WindTurbine
Definition: tole_declaration.h:97
Partridge_Population_Manager::bad_guys
Partridge_Male * bad_guys[500]
Debug.
Definition: Partridge_Population_Manager.h:159
tole_ActivePit
Definition: tole_declaration.h:63
cfg_springcensusdate
static CfgInt cfg_springcensusdate("PAR_SPRINGCENSUSDATE", CFG_CUSTOM, March+21)
Probe date.
cfg_breedingpairs_date
static CfgInt cfg_breedingpairs_date("PAR_BREEDINGPAIRS_DATE", CFG_CUSTOM, 90)
Probe date.
k_factors::calcDickPottsk
void calcDickPottsk()
Definition: Partridge_All.cpp:3026
Partridge_Base::GetUncleStatus
bool GetUncleStatus()
Supply uncle status.
Definition: Partridge_All.h:437
cfg_ReallyBigOutputMonthly_used
CfgBool cfg_ReallyBigOutputMonthly_used
Partridge_struct::m_covey
Partridge_Covey * m_covey
Definition: Partridge_All.h:349
TAnimal::Supply_m_Location_x
int Supply_m_Location_x()
Definition: populationmanager.h:213
pars_ChDying
Definition: Partridge_All.h:276
tov_OSpringBarley
Definition: tov_declaration.h:46
pars_MFindingMate
Definition: Partridge_All.h:279
k_factors::calcreal_1
void calcreal_1()
Definition: Partridge_All.cpp:2994
cfg_ParHuntingBeetleBankArea
CfgInt cfg_ParHuntingBeetleBankArea("PAR_HUNTING_BEETLEBANKAREA", CFG_CUSTOM, 500)
The hunting rate in beetle bank areas.
tov_Setaside
Definition: tov_declaration.h:50
population_attributes::setNoChicksSept
void setNoChicksSept(int n)
Definition: Partridge_All.h:140
population_attributes::setNoMalesDec
void setNoMalesDec(int n)
Definition: Partridge_All.h:156
population_attributes::SetTerritorialFemalesInMay
void SetTerritorialFemalesInMay(int nf)
Definition: Partridge_All.h:200
population_attributes::setNoMalesSept
void setNoMalesSept(int n)
Definition: Partridge_All.h:148
August
const int August
Definition: landscape.h:43
tov_SpringBarleySeed
Definition: tov_declaration.h:52
tov_SpringBarleySKManagement
Definition: tov_declaration.h:65
Partridge_Population_Manager::OpenParOutputFiles
bool OpenParOutputFiles()
Opens the partridge output files.
Definition: Partridge_Population_Manager.cpp:1612
pars_FAttractingMate
Definition: Partridge_All.h:283
Partridge_Population_Manager::DoAfter
virtual void DoAfter()
Utility method called before EndStep.
Definition: Partridge_Population_Manager.cpp:1307
Partridge_struct::x
int x
Definition: Partridge_All.h:344
tov_WWheatPToxicControl
Definition: tov_declaration.h:55
tole_MownGrass
Definition: tole_declaration.h:74
pcomm_Mating
Definition: Partridge_Communication.h:57
tov_OWinterWheat
Definition: tov_declaration.h:66
Chick_struct::sex
bool sex
Definition: Partridge_All.h:377
cfg_ParShotMax
static CfgInt cfg_ParShotMax("PAR_SHOTPERCENTAGE_MAX", CFG_CUSTOM, 1500)
Maximum% shot.
Partridge_Population_Manager::WriteParJuvMort
void WriteParJuvMort(int yr, int a_min, int a_age, int a_cause)
Output method.
Definition: Partridge_Population_Manager.cpp:1664
tov_OCarrots
Definition: tov_declaration.h:43
tole_YoungForest
Definition: tole_declaration.h:55
cfg_StartingNumberFemalePartridges
static CfgInt cfg_StartingNumberFemalePartridges("PAR_STARTING_NO_FEMALES", CFG_CUSTOM, 10000)
Start no of female partridges.
Partridge_Population_Manager::ParNoB
FILE * ParNoB
No of breeding Pairs.
Definition: Partridge_Population_Manager.h:136
Population_Manager::SimW
int SimW
Definition: populationmanager.h:511
tole_Stream
Definition: tole_declaration.h:89
population_attributes::setNoFemalesSept
void setNoFemalesSept(int n)
Definition: Partridge_All.h:144
PartridgeCommunicationData::m_male
Partridge_Male * m_male
Definition: Partridge_Communication.h:83
population_attributes::incNoShotBirds
void incNoShotBirds()
Definition: Partridge_All.h:180
CoverTempMap::SetQualIndexed
void SetQualIndexed(int a_x, int a_y, double a_qual)
Definition: Partridge_Population_Manager.h:79
population_attributes::SetBirdsInApril
void SetBirdsInApril(double ba)
Definition: Partridge_All.h:132
cfg_StartingNumberMalePartridges
static CfgInt cfg_StartingNumberMalePartridges("PAR_STARTING_NO_MALES", CFG_CUSTOM, 10000)
Start no of male partridges.
tov_OBarleyPeaCloverGrass
Definition: tov_declaration.h:41
tole_ConiferousForest
Definition: tole_declaration.h:54
pars_FStartingNewBrood
Definition: Partridge_All.h:282
tov_WinterWheatShort
Definition: tov_declaration.h:56
g_msg
class MapErrorMsg * g_msg
Definition: maperrormsg.cpp:41
tov_SpringBarleyGrass
Definition: tov_declaration.h:52
pars_FBuildingUpResources
Definition: Partridge_All.h:282
Partridge_Population_Manager::DoBefore
virtual void DoBefore()
Utility method called before Step.
Definition: Partridge_Population_Manager.cpp:1297
Partridge_Population_Manager::CreateObjects
void CreateObjects(int ob_type, Partridge_struct *data, int number)
Definition: Partridge_Population_Manager.cpp:368
tole_LargeRoad
Definition: tole_declaration.h:61
Chick_struct
Struct to pass chick information.
Definition: Partridge_All.h:374
Partridge_Population_Manager::HuntingDifferentiatedBeetleBankArea
void HuntingDifferentiatedBeetleBankArea(int a_pct)
Differentiated hunting in beetlebank areas.
Definition: Partridge_Population_Manager.cpp:1204
Population_Manager::m_AOR_Probe
AOR_Probe * m_AOR_Probe
Definition: populationmanager.h:526
pars_ChDeveloping
Definition: Partridge_All.h:276
k_factors::calcreal_3
void calcreal_3()
Definition: Partridge_All.cpp:3015
Partridge_Population_Manager::m_territoryqualmap
CoverTempMap * m_territoryqualmap
Pointer to territory quality map.
Definition: Partridge_Population_Manager.h:165
Landscape
The landscape class containing all environmental and topographical data.
Definition: landscape.h:112
tov_YoungForest
Definition: tov_declaration.h:60
tov_OWinterBarleyExt
Definition: tov_declaration.h:65
cfg_nest_hedgebank0
CfgInt cfg_nest_hedgebank0
Nesting quality for hedgebank type 0.
tov_SpringBarleySilage
Definition: tov_declaration.h:52
CoveyManager::Tick
void Tick(void)
Do the covey management for the time-step.
Definition: Partridge_Covey.cpp:2144
cfg_ParShotMin
static CfgInt cfg_ParShotMin("PAR_SHOTPERCENTAGE_MIN", CFG_CUSTOM, 1500)
Minimum% shot.
pars_FIncubating
Definition: Partridge_All.h:283
pars_FFindingTerritory
Definition: Partridge_All.h:282
Partridge_Population_Manager::m_HatchSuccess
int m_HatchSuccess
No hatch success.
Definition: Partridge_Population_Manager.h:127
Partridge_Population_Manager::WriteParClutches
void WriteParClutches(int a_min, int a_num1, int a_num2)
Output method.
Definition: Partridge_Population_Manager.cpp:1682
Partridge_Population_Manager::HuntingGrid
void HuntingGrid(int p_chance)
Density grid-based hunting.
Definition: Partridge_Population_Manager.cpp:1159
tole_Marsh
Definition: tole_declaration.h:41
TTypesOfVegetation
TTypesOfVegetation
Definition: tov_declaration.h:30
tole_OrchardBand
Definition: tole_declaration.h:73
PartridgeCommunicationData::m_female
Partridge_Female * m_female
Definition: Partridge_Communication.h:84
tov_SpringRape
Definition: tov_declaration.h:53
cfg_rainscaling
static CfgFloat cfg_rainscaling("PAR_RAINSCALING", CFG_CUSTOM, 0.767)
Correction for using rainfall penalty.
tole_Pond
Definition: tole_declaration.h:101
Partridge_Population_Manager::DoLast
virtual void DoLast()
Ultility method called at the end of the time-step.
Definition: Partridge_Population_Manager.cpp:1326
Landscape::SupplySimAreaHeight
int SupplySimAreaHeight(void)
Definition: landscape.h:1637
Covey_struct::x
int x
Definition: Partridge_All.h:331
tov_PotatoesIndustry
Definition: tov_declaration.h:50
cfg_par_max_terr_qual
CfgInt cfg_par_max_terr_qual
The minimum territory quality needed in early season.
Partridge_Covey::GetCoveySize
unsigned int GetCoveySize()
Return the covey size.
Definition: Partridge_Covey.h:476
Landscape::SupplySimAreaWidth
int SupplySimAreaWidth(void)
Definition: landscape.h:1632
Partridge_Covey::m_neighbourlist_size
int m_neighbourlist_size
Number of coveys close to this covey.
Definition: Partridge_Covey.h:286
tov_SpringBarleyPTreatment
Definition: tov_declaration.h:63
tov_FodderGrass
Definition: tov_declaration.h:62
Partridge_Population_Manager::DoSanityCheck
void DoSanityCheck()
Debug only.
Definition: Partridge_Population_Manager.cpp:1252
pars_ChMaturing
Definition: Partridge_All.h:276
September
const int September
Definition: landscape.h:44
tov_Carrots
Definition: tov_declaration.h:31
Partridge_Population_Manager::MaleImmigration
void MaleImmigration(void)
If male immigration is needed - Unused.
Definition: Partridge_Population_Manager.cpp:1813
CfgBool
Bool configurator entry class.
Definition: configurator.h:127
Partridge_Population_Manager::WriteParUnpairedMale
void WriteParUnpairedMale(int a_min, int a_num)
Output method.
Definition: Partridge_Population_Manager.cpp:1676
tole_PermPasture
Definition: tole_declaration.h:47
pob_Chick2
Definition: Partridge_All.h:297
AdultPartridge_struct::age
int age
Definition: Partridge_All.h:389
pob_Covey
Definition: Partridge_All.h:297
TAnimal
The base class for all ALMaSS animal classes.
Definition: populationmanager.h:205
Partridge_Covey
The collective for a family of partridges
Definition: Partridge_Covey.h:90
Partridge_Male::AmIaMember
int AmIaMember()
A debug function.
Definition: Partridge_All.cpp:3159
tov_SpringBarleyCloverGrass
Definition: tov_declaration.h:52
Partridge_Population_Manager::CreateNestingCoverDensityMap
void CreateNestingCoverDensityMap()
Intitialises the nesting cover map.
Definition: Partridge_Population_Manager.cpp:778
Partridge_Female::GetOldMate
Partridge_Male * GetOldMate(void)
Supply old mate pointer.
Definition: Partridge_All.h:893
tov_WinterRape
Definition: tov_declaration.h:53
tov_OGrazingPigs
Definition: tov_declaration.h:44
tov_SugarBeet
Definition: tov_declaration.h:66
Landscape::SupplyVegPatchy
bool SupplyVegPatchy(int a_polyref)
Definition: landscape.h:986
Partridge_Population_Manager::TestShouldFlock
void TestShouldFlock()
Should the birds start to flock?
Definition: Partridge_Population_Manager.cpp:1435
AnimalPosition
A class defining an animals position.
Definition: populationmanager.h:168
tole_PermanentSetaside
Definition: tole_declaration.h:46
tov_OSBarleySilage
Definition: tov_declaration.h:56
Partridge_struct::y
int y
Definition: Partridge_All.h:345
cfg_Emigration
static CfgInt cfg_Emigration("PAR_EMIGRATION", CFG_CUSTOM, 1)
Loss due to emmigration (out of 10000)
tov_PermanentGrassGrazed
Definition: tov_declaration.h:49
g_covey_manager
class CoveyManager * g_covey_manager
Definition: Partridge_Covey.cpp:2070
Population_Manager::BeforeStepActions
unsigned BeforeStepActions[12]
Definition: populationmanager.h:542
population_attributes::setNoChick1sAug
void setNoChick1sAug(int ch)
Definition: Partridge_All.h:212
PartridgeCommunicationData::m_covey
Partridge_Covey * m_covey
Definition: Partridge_Communication.h:85
tole_UrbanPark
Definition: tole_declaration.h:79
population_attributes::SetTerritorialFemalesInApril
void SetTerritorialFemalesInApril(double fa)
Definition: Partridge_All.h:128
pcomm_SetClutch
Definition: Partridge_Communication.h:62
tov_CloverGrassGrazed2
Definition: tov_declaration.h:33
pcomm_WaitForMale
Definition: Partridge_Communication.h:64
AdultPartridge_struct::sex
bool sex
Definition: Partridge_All.h:388
tole_Track
Definition: tole_declaration.h:59
tov_WWheatPControl
Definition: tov_declaration.h:55
Partridge_Population_Manager::m_HabitatQuality
double m_HabitatQuality[300]
Part of habitat quality map evaluation.
Definition: Partridge_Population_Manager.h:151
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
Population_Manager
Base class for all population managers.
Definition: populationmanager.h:424
AdultPartridge_struct
Struct to pass adult partridge information.
Definition: Partridge_All.h:386
pars_ClHatching
Definition: Partridge_All.h:273
tov_Potatoes
Definition: tov_declaration.h:50
population_attributes::incNoShotFemales
void incNoShotFemales()
Definition: Partridge_All.h:184
Landscape::SupplyDayInYear
int SupplyDayInYear(void)
Definition: landscape.h:1596
population_attributes::SetBroodGeoMean
void SetBroodGeoMean(double gm)
Definition: Partridge_All.h:136
CoverTempMap::GetQual
double GetQual(int a_x, int a_y)
Definition: Partridge_Population_Manager.h:75
pars_Destroy
Definition: Partridge_All.h:287
Partridge_Population_Manager::m_messagecentre
Partridge_Communication m_messagecentre
Message class pointer.
Definition: Partridge_Population_Manager.h:163
Partridge_Base::GetCovey
Partridge_Covey * GetCovey(void)
Supply covey pointer.
Definition: Partridge_All.h:453
DissolveChance
const int DissolveChance[40]
Definition: Partridge_Population_Manager.cpp:71
Partridge_Population_Manager::m_halfwidth
int m_halfwidth
Definition: Partridge_Population_Manager.h:129
Landscape::SupplyYearNumber
int SupplyYearNumber(void)
Definition: landscape.h:1616
Clutch_struct
Struct to pass clutch information.
Definition: Partridge_All.h:362
pars_CoveyBeing
Definition: Partridge_All.h:285
Partridge_Population_Manager::FillCoveyNeigbourList
bool FillCoveyNeigbourList(Partridge_Covey *a_covey, int a_distance, int a_x, int a_y)
Get a list of neighbour covies.
Definition: Partridge_Population_Manager.cpp:1571
tole_NaturalGrassWet
Definition: tole_declaration.h:87
cfg_par_min_terr_qual
CfgInt cfg_par_min_terr_qual
The minimum territory quality needed in late season.
tole_Orchard
Definition: tole_declaration.h:71
tole_MetalledPath
Definition: tole_declaration.h:84
tov_Maize
Definition: tov_declaration.h:36
Partridge_Base::CopyMyself
virtual void CopyMyself(int a_Ptype)
Duplicate this object.
Definition: Partridge_All.cpp:239
Partridge_Covey::GetUnpairedFemale
Partridge_Female * GetUnpairedFemale()
Finds the first unpaired female in the covey.
Definition: Partridge_Covey.cpp:2304
population_attributes::incNoChicksHatched
void incNoChicksHatched()
Definition: Partridge_All.h:108
Covey_struct::y
int y
Definition: Partridge_All.h:332
tov_OWinterRape
Definition: tov_declaration.h:47
tov_WWheatPTreatment
Definition: tov_declaration.h:55
tole_SandDune
Definition: tole_declaration.h:81
CfgFloat::value
double value(void)
Definition: configurator.h:118
tole_WoodyEnergyCrop
Definition: tole_declaration.h:94
AnimalPosition::m_y
unsigned m_y
Definition: populationmanager.h:173
CoveyManager::BroodGeoMean
double BroodGeoMean()
Calculate the geometric mean of no of chicks.
Definition: Partridge_Covey.cpp:2117
tov_FieldPeas
Definition: tov_declaration.h:34
tov_BroadBeans
Definition: tov_declaration.h:66
pars_FLaying
Definition: Partridge_All.h:282
Partridge_Covey::SanityCheck
void SanityCheck()
Debug method.
Definition: Partridge_Covey.cpp:2403
tole_River
Definition: tole_declaration.h:65
cfg_par_rainfactor
static CfgFloat cfg_par_rainfactor("PAR_RAINFACTOR", CFG_CUSTOM, 0.2)
Increase in energy requirement with rainfall.
tov_OSeedGrass1
Definition: tov_declaration.h:46
Partridge_Base::SetCovey
void SetCovey(Partridge_Covey *a_covey)
Set covey pointer.
Definition: Partridge_All.h:492
Partridge_Population_Manager::Hunting
void Hunting(int p_chance)
Global hunting.
Definition: Partridge_Population_Manager.cpp:1116
Population_Manager::StateNames
const char * StateNames[100]
Definition: populationmanager.h:531
Partridge_Population_Manager::Catastrophe
virtual void Catastrophe()
Kill/clone a configuragle proportion of population.
Definition: Partridge_Population_Manager.cpp:1731
tov_OFodderBeet
Definition: tov_declaration.h:65
g_MaxWalk
int g_MaxWalk[200]
Definition: Partridge_Population_Manager.cpp:66
pars_ClDying
Definition: Partridge_All.h:273
tole_Scrub
Definition: tole_declaration.h:42
cfg_par_start_dissolve
CfgInt cfg_par_start_dissolve
The earliest covey dissolve date.
Definition: Partridge_Population_Manager.cpp:94
CFG_CUSTOM
Definition: configurator.h:60
tov_OCloverGrassGrazed1
Definition: tov_declaration.h:43
tole_PermPastureTussocky
Definition: tole_declaration.h:45
tov_OSpringBarleyPigs
Definition: tov_declaration.h:47
Partridge_Population_Manager::Partridge_Population_Manager
Partridge_Population_Manager(Landscape *a_map)
Definition: Partridge_Population_Manager.cpp:156
tov_SpringBarleySpr
Definition: tov_declaration.h:66
Population_Manager::m_TheLandscape
Landscape * m_TheLandscape
Definition: populationmanager.h:515
population_attributes::setNoOldFemales
void setNoOldFemales(int nf)
Definition: Partridge_All.h:196
tov_PermanentGrassLowYield
Definition: tov_declaration.h:63
pars_Initiation
Definition: Partridge_All.h:267
Population_Manager::OpenTheReallyBigProbe
bool OpenTheReallyBigProbe()
Definition: PopulationManager.cpp:859
pcomm_MatingM
Definition: Partridge_Communication.h:58
tole_Field
Definition: tole_declaration.h:43
pars_MPairing
Definition: Partridge_All.h:279
Partridge_Chick
Partridge chick class.
Definition: Partridge_All.h:581
tole_FieldBoundary
Definition: tole_declaration.h:40
Partridge_Population_Manager::ParAdMort
FILE * ParAdMort
Adult mortality record.
Definition: Partridge_Population_Manager.h:132
Partridge_Population_Manager::CloseParOutputFiles
bool CloseParOutputFiles()
Closes the partridge output files.
Definition: Partridge_Population_Manager.cpp:1631
cfg_flockdata_date
static CfgInt cfg_flockdata_date("PAR_FLOCKDATA_DATE", CFG_CUSTOM, 270)
Date when birds start to flock.
tole_PermPastureLowYield
Definition: tole_declaration.h:44
Partridge_Population_Manager::m_maxx
int m_maxx
internal variables
Definition: Partridge_Population_Manager.h:129
Covey_struct
Struct to pass covey information.
Definition: Partridge_All.h:329
Partridge_Population_Manager::ParUnpairedMale
FILE * ParUnpairedMale
No unparied males 1st Jun.
Definition: Partridge_Population_Manager.h:142
CfgInt
Integer configurator entry class.
Definition: configurator.h:87
tole_RiversideTrees
Definition: tole_declaration.h:51
Population_Manager::m_ListNameLength
unsigned m_ListNameLength
Definition: populationmanager.h:538
Partridge_Base::GetObjectType
Partridge_Object GetObjectType()
Supply object type.
Definition: Partridge_All.h:432
tov_WinterBarley
Definition: tov_declaration.h:53
TALMaSSObject::GetCurrentStateNo
int GetCurrentStateNo()
Returns the current state number.
Definition: populationmanager.h:121
Partridge_struct::by
int by
Definition: Partridge_All.h:347
Partridge_Population_Manager::DissolveCovey
void DissolveCovey(Partridge_Covey *a_covey)
Definition: Partridge_Population_Manager.cpp:1475
tov_NaturalGrass
Definition: tov_declaration.h:37
Partridge_Population_Manager::HabitatEvalPolyField
int HabitatEvalPolyField(int a_field)
Part of habitat quality map evaluation.
Definition: Partridge_Population_Manager.cpp:943
pars_MFlocking
Definition: Partridge_All.h:279
TTypesOfLandscapeElement
TTypesOfLandscapeElement
Definition: tole_declaration.h:36
Covey_struct::first_member
Partridge_Base * first_member
Definition: Partridge_All.h:333
tole_IndividualTree
Definition: tole_declaration.h:93
cfg_BeetleBankMaxX
CfgInt cfg_BeetleBankMaxX
tov_SeedGrass2
Definition: tov_declaration.h:50
cfg_ReallyBigOutput_used
CfgBool cfg_ReallyBigOutput_used
TAnimal::Supply_m_Location_y
int Supply_m_Location_y()
Definition: populationmanager.h:216
Partridge_Population_Manager::ObjectLoopInit
void ObjectLoopInit(int ob_type)
Definition: Partridge_Population_Manager.cpp:187
PartridgeCommunicationData
Data structure of a message.
Definition: Partridge_Communication.h:78
cfg_nest_hedgebank2
CfgInt cfg_nest_hedgebank2
Nesting quality for hedgebank type 2.
Partridge_struct::bx
int bx
Definition: Partridge_All.h:346
CfgFloat
Double configurator entry class.
Definition: configurator.h:106
Partridge_Population_Manager::FillInFoodArray
void FillInFoodArray()
Precalculated food values with age.
Definition: Partridge_Population_Manager.cpp:1390
Partridge_Population_Manager::CreateCloneObjects
void CreateCloneObjects(int ob_type, AdultPartridge_struct *as)
Definition: Partridge_Population_Manager.cpp:535
g_FoodNeed
double g_FoodNeed[200]
Definition: Partridge_Population_Manager.cpp:65
cfg_ParShootStartYear
static CfgInt cfg_ParShootStartYear("PAR_SHOOTSTARTYEAR", CFG_CUSTOM, 1)
First year with hunting.
tole_PitDisused
Definition: tole_declaration.h:50
population_attributes::setNoMalesAug
void setNoMalesAug(int nm)
Definition: Partridge_All.h:220
tov_NoGrowth
Definition: tov_declaration.h:38
Partridge_Population_Manager::m_ShouldFlock
bool m_ShouldFlock
Flag for flocking or not.
Definition: Partridge_Population_Manager.h:123
tov_OPotatoes
Definition: tov_declaration.h:44
tole_HeritageSite
Definition: tole_declaration.h:90
CfgInt::value
int value(void)
Definition: configurator.h:98
population_attributes::setNoOldMales
void setNoOldMales(int nm)
Definition: Partridge_All.h:192
tole_PlantNursery
Definition: tole_declaration.h:95
k_factors::Output_kfactors
void Output_kfactors()
Definition: Partridge_All.cpp:2893
PartridgeCommunicationData::m_clutch
Partridge_Clutch * m_clutch
Definition: Partridge_Communication.h:80
FloatToDouble
void FloatToDouble(double &, float)
cfg_ParHuntingThreshold
static CfgInt cfg_ParHuntingThreshold("PAR_HUNTINGTHRESHOLD", CFG_CUSTOM, 1)
Number of birds at which hunting starts.
pars_FFlocking
Definition: Partridge_All.h:282
Partridge_Population_Manager::WriteParFlocks
void WriteParFlocks(int a_min, int a_size, int a_young)
Output method.
Definition: Partridge_Population_Manager.cpp:1688
population_attributes::setNoFemsAug
void setNoFemsAug(int nf)
Definition: Partridge_All.h:224
tov_OSeedGrass2
Definition: tov_declaration.h:46
pob_Male
Definition: Partridge_All.h:297
Partridge_Population_Manager::UpdateNestingCoverMap
void UpdateNestingCoverMap()
Definition: Partridge_Population_Manager.cpp:1084
Partridge_Covey::ArePaired
bool ArePaired()
Debug method.
Definition: Partridge_Covey.cpp:2384
Partridge_Population_Manager::TheAOROutputProbe
virtual void TheAOROutputProbe()
Output method.
Definition: Partridge_Population_Manager.cpp:1705
tov_OFieldPeasSilage
Definition: tov_declaration.h:56
pars_MGuardingMate
Definition: Partridge_All.h:279
cfg_nest_hedgebank1
CfgInt cfg_nest_hedgebank1
Nesting quality for hedgebank type 1.
tov_SpringWheat
Definition: tov_declaration.h:53
Partridge_Population_Manager::TheRipleysOutputProbe
virtual void TheRipleysOutputProbe(FILE *a_prb)
Output method.
Definition: Partridge_Population_Manager.cpp:1713
population_attributes::AddToChicks6wks
void AddToChicks6wks(int ch)
Definition: Partridge_All.h:208
k_factors::CreateInfoDatabaseFile
void CreateInfoDatabaseFile()
Definition: Partridge_All.cpp:3145
tov_SpringBarley
Definition: tov_declaration.h:52
Partridge_Population_Manager::GetNestingCoverDensity
double GetNestingCoverDensity(int x, int y)
Definition: Partridge_Population_Manager.cpp:754
tov_OWinterRye
Definition: tov_declaration.h:49
tole_Carpark
Definition: tole_declaration.h:85
g_par_rainfactor
double g_par_rainfactor
Definition: Partridge_Population_Manager.cpp:63
tov_OFirstYearDanger
Definition: tov_declaration.h:44
tole_DeciduousForest
Definition: tole_declaration.h:52
Partridge_Male::StartBreedingBehaviour
void StartBreedingBehaviour(void)
Message handler.
Definition: Partridge_All.cpp:2719
Partridge_Population_Manager::WriteParAdMort
void WriteParAdMort(int a_min, int a_age, int a_sex, int a_cause)
Output method.
Definition: Partridge_Population_Manager.cpp:1658
tov_CloverGrassGrazed1
Definition: tov_declaration.h:32
tole_Hedges
Definition: tole_declaration.h:37
tov_OFieldPeas
Definition: tov_declaration.h:43
tov_FodderBeet
Definition: tov_declaration.h:35
pob_Clutch
Definition: Partridge_All.h:297
tov_WinterRye
Definition: tov_declaration.h:55
Partridge_Population_Manager::CoveyDissolveWeather
bool CoveyDissolveWeather()
Definition: Partridge_Population_Manager.cpp:1422
Partridge_Population_Manager::DoMaleSanityCheck
void DoMaleSanityCheck()
Debug only.
Definition: Partridge_Population_Manager.cpp:1274
Partridge_Population_Manager::DoFirst
virtual void DoFirst()
Utility method called before BeginStep.
Definition: Partridge_Population_Manager.cpp:590
Partridge_Base::SetAge
void SetAge(int a_age)
Set age.
Definition: Partridge_All.h:477
cfg_BeetleBankInvert
CfgBool cfg_BeetleBankInvert
tov_Triticale
Definition: tov_declaration.h:53
Partridge_Chick2
The partridge Chick2 class.
Definition: Partridge_All.h:628
Clutch_struct::No
int No
Definition: Partridge_All.h:364
pob_Chick
Definition: Partridge_All.h:297
tole_Vildtager
Definition: tole_declaration.h:99
population_attributes::setNoFemalesDec
void setNoFemalesDec(int n)
Definition: Partridge_All.h:152
Population_Manager::m_ListNames
const char * m_ListNames[32]
Definition: populationmanager.h:537
Partridge_Population_Manager::EvalHabitatQual
double EvalHabitatQual(TTypesOfLandscapeElement a_cet, int a_poly)
Part of habitat quality map evaluation.
Definition: Partridge_Population_Manager.cpp:837
cfg_par_male_gives_up
CfgInt cfg_par_male_gives_up
Latest date a male will mate search.
pars_FDying
Definition: Partridge_All.h:283
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
Partridge_Covey::m_neighbourlist
Partridge_Covey * m_neighbourlist[50]
List of coveys close to this covey.
Definition: Partridge_Covey.h:284
Partridge_Population_Manager::WriteParNoB
void WriteParNoB(int a_min, int a_nob)
Output method.
Definition: Partridge_Population_Manager.cpp:1670
March
const int March
Definition: landscape.h:38
CfgBool::value
bool value(void)
Definition: configurator.h:135
tole_AmenityGrass
Definition: tole_declaration.h:76
population_attributes::SetFemalesInApril
void SetFemalesInApril(double fa)
Definition: Partridge_All.h:120
pars_FMakingNest
Definition: Partridge_All.h:282
tole_NaturalGrassDry
Definition: tole_declaration.h:48
tole_BeetleBank
Definition: tole_declaration.h:69
Landscape::SupplyPolyRef
int SupplyPolyRef(int a_x, int a_y)
Definition: landscape.h:1488
tov_SeedGrass1
Definition: tov_declaration.h:50
pob_Female
Definition: Partridge_All.h:297
TAnimal::WhatState
virtual int WhatState()
Definition: populationmanager.h:263
pars_MDying
Definition: Partridge_All.h:279
tov_OSpringBarleyGrass
Definition: tov_declaration.h:46
Partridge_Base::GetAge
int GetAge(void)
Supply age.
Definition: Partridge_All.h:472
CoverTempMap::ZeroQual
void ZeroQual()
Definition: Partridge_Population_Manager.h:74
tole_Coast
Definition: tole_declaration.h:67
tole_BuiltUpWithParkland
Definition: tole_declaration.h:80
Partridge_Population_Manager::m_Starved
int m_Starved
No starvation events.
Definition: Partridge_Population_Manager.h:171
Landscape::SupplyGlobalDate
long SupplyGlobalDate(void)
Definition: landscape.h:1621
tole_SmallRoad
Definition: tole_declaration.h:60
tov_None
Definition: tov_declaration.h:39
population_attributes::SetNonTerritorialFemalesInMay
void SetNonTerritorialFemalesInMay(int nf)
Definition: Partridge_All.h:204
Landscape::SupplyElementSubType
int SupplyElementSubType(int a_polyref)
Definition: landscape.h:1121
tole_Fence
Definition: tole_declaration.h:57
cfg_BeetleBankMinX
CfgInt cfg_BeetleBankMinX
cfg_pm_eventfrequency
CfgInt cfg_pm_eventfrequency
tov_OSpringBarleyExt
Definition: tov_declaration.h:63
cfg_kfactoroutput_date
static CfgInt cfg_kfactoroutput_date("PAR_KFACTOROUTPUT_DATE", CFG_CUSTOM, 90)
Probe date.
population_attributes::incNoClutches
void incNoClutches()
Definition: Partridge_All.h:87
population_attributes::setNoChick2sAug
void setNoChick2sAug(int ch)
Definition: Partridge_All.h:216
Partridge_Population_Manager::AddObject
void AddObject(int ob_type, TAnimal *pTAo)
Definition: Partridge_Population_Manager.cpp:457
cfg_HindranceScalingFactor
static CfgFloat cfg_HindranceScalingFactor("PAR_HINDRANCE_SCALING", CFG_CUSTOM, 1000)
Used to scale biomass hindrance.
tole_Heath
Definition: tole_declaration.h:70
November
const int November
Definition: landscape.h:46
cfg_par_energyslope_perday
static CfgFloat cfg_par_energyslope_perday("PAR_ENERGYSLOPE_PERDAY", CFG_CUSTOM, 1.06)
Slope of linear increase in energy needs of chicks.