Loading [MathJax]/extensions/ams.js
ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OsmiaParasitoid_Population_Manager Class Reference

#include <Osmia_Population_Manager.h>

Inheritance diagram for OsmiaParasitoid_Population_Manager:
Population_Manager Population_Manager_Base

Public Member Functions

 OsmiaParasitoid_Population_Manager (Landscape *a_landscape, int a_cellsize)
 
 ~OsmiaParasitoid_Population_Manager ()
 
void AddDispersers (int a_ref, double a_dispersers)
 
void RemoveParasitoids (int a_ref, double a_dispersers)
 
double GetSize (int a_ref)
 
double GetSize (int a_x, int a_y)
 
array< double, static_cast< unsigned >TTypeOfOsmiaParasitoids::topara_foobar)> GetParasitoidNumbers (int a_x, int a_y)
 returns an array with the parasitoid numbers in the cell at the location given by a_x, a_y More...
 
void AddParasitoid (TTypeOfOsmiaParasitoids a_type, int a_x, int a_y)
 
- Public Member Functions inherited from Population_Manager
 Population_Manager (Landscape *a_l_ptr, int a_numberLifeStages=12)
 
virtual ~Population_Manager (void)
 
void SetNoProbesAndSpeciesSpecificFunctions (int a_pn) override
 Sets up probe and species specifics. More...
 
void OpenTheAOROutputProbe (const string &a_AORFilename) override
 Opens the AOR output file. More...
 
unsigned GetLiveArraySize (int a_listindex) override
 Gets the number of 'live' objects for a list index in the TheArray. More...
 
unsigned GetPopulationSize (int a_listindex) override
 Gets the number of species objects by default it is the same as LiveArray, however it could be different. This function should be used/overriden when we are interested in the number of the objects for presentation and not in inner maintenance of the PopulationManager and or TheArray. More...
 
void IncLiveArraySize (int a_listindex)
 Increments the number of 'live' objects for a list index in the TheArray. More...
 
unsigned int FarmAnimalCensus (unsigned int a_farm, unsigned int a_typeofanimal)
 
char * SpeciesSpecificReporting (int a_species, int a_time) override
 
char * ProbeReport (int a_time)
 
char * ProbeReportTimed (int a_time)
 
void ImpactProbeReport (int a_Time)
 
bool BeginningOfMonth ()
 
void LOG (const char *fname)
 
int SupplyStepSize () const
 
void Run (int NoTSteps) override
 
virtual unsigned Probe (int ListIndex, Probe_Data *p_TheProbe)
 
virtual void ImpactedProbe ()
 
virtual TAnimalSupplyAnimalPtr (unsigned int a_index, unsigned int a_animal)
 Returns the pointer indexed by a_index and a_animal. Note NO RANGE CHECK. More...
 
virtual unsigned SupplyListIndexSize ()
 
unsigned SupplyListSize (unsigned listindex) const
 
void PushIndividual (const unsigned a_listindex, TAnimal *a_individual_ptr)
 
const char * SupplyStateNames (int i) const
 
unsigned SupplyStateNamesLength () const
 
virtual void DisplayLocations ()
 
TAnimalFindIndividual (unsigned Type, TAnimal *a_me)
 
virtual TAnimalFindClosest (int x, int y, unsigned Type, TAnimal *a_me)
 
omp_nest_lock_t * GetGuardMapElement (unsigned a_x_index, unsigned a_y_index)
 Return the guard map cell. More...
 
void SetGuardMapElement (unsigned a_x_index, unsigned a_y_index)
 Set the given guard map cell. More...
 
void UnsetGuardMapElement (unsigned a_x_index, unsigned a_y_index)
 Unset the given guard map cell. More...
 
void UpdateGuardMap (int a_x, int a_y, int &a_index_x, int &a_index_y)
 Get the index of the guard map for the given location. More...
 
bool OpenTheRipleysOutputProbe ()
 
bool OpenTheMonthlyRipleysOutputProbe ()
 
bool OpenTheReallyBigProbe ()
 
virtual void TheAOROutputProbe ()
 
virtual void TheRipleysOutputProbe (ofstream *a_prb)
 Special output functionality. More...
 
virtual void TheReallyBigOutputProbe ()
 
void CloseTheMonthlyRipleysOutputProbe () const
 
virtual void CloseTheRipleysOutputProbe ()
 
virtual void CloseTheReallyBigOutputProbe ()
 
TTypesOfPopulation GetPopulationType ()
 
int GetSeasonNumber ()
 Get the season number. More...
 
void LamdaDeath (int x, int y)
 
void LamdaBirth (int x, int y)
 
void LamdaBirth (int x, int y, int z)
 
void LamdaClear ()
 
void LamdaDumpOutput ()
 
virtual int SupplyPegPosx (int)
 
virtual int SupplyPegPosy (int)
 
virtual int SupplyCovPosx (int)
 
virtual int SupplyCovPosy (int)
 
virtual bool OpenTheFledgelingProbe ()
 
virtual bool OpenTheBreedingPairsProbe ()
 
virtual bool OpenTheBreedingSuccessProbe ()
 
virtual void BreedingPairsOutput (int)
 
virtual int TheBreedingFemalesProbe (int)
 
virtual int TheFledgelingProbe ()
 
virtual void BreedingSuccessProbeOutput (double, int, int, int, int, int, int, int)
 
virtual int TheBreedingSuccessProbe (int &, int &, int &, int &, int &, int &)
 
virtual void FledgelingProbeOutput (int, int)
 
virtual void TheGeneticProbe (unsigned, int, unsigned &)
 
virtual void GeneticsResultsOutput (FILE *, unsigned)
 
void Debug_Shuffle (unsigned int Type)
 
virtual void RunStepMethods ()
 
- Public Member Functions inherited from Population_Manager_Base
 Population_Manager_Base (Landscape *L)
 The Population_Manager_Base constructor. More...
 
virtual void Catastrophe (int)
 Must be re-implemented in descendent classes. More...
 
int SupplySimW () const
 Returns landscape width in m. More...
 
int SupplySimH () const
 Returns landscape height in m. More...
 
int SupplySimWH () const
 Returns half the landscape width in m. More...
 
int SupplySimHH () const
 Returns half the landscape height in m. More...
 
virtual int ProbeFileInput (char *p_Filename, int p_ProbeNo)
 A stub to build specfic probes and functions. More...
 
int SupplyListNameLength () const
 
const char * SupplyListName (int a_i) const
 Get a list name from the list. More...
 
virtual void SupplyLocXY (unsigned, unsigned, int &, int &)
 A stub for identifying an individual at a location. More...
 
virtual TAnimalFindClosest (int, int, unsigned)
 A stub for identifying an individual at a location. More...
 
std::string SupplySimulationName ()
 
void SetStepCounterInADay (int a_counter)
 Set step counter in a day. More...
 
int GetStepCounterInADay (void)
 Return the sep counter in a day. More...
 
virtual double GetAphidDensity (int, int)
 Return the aphid density, it is only used when aphid simulations are running. More...
 

Protected Attributes

vector< OsmiaParasitoidSubPopulation * > m_SubPopulations
 The array storing the sub-populations of parasitoids. More...
 
Landscapem_TheLandscape
 A useful pointer to the lanscape object. More...
 
unsigned m_Wide
 the number of subpopulation cells wide More...
 
unsigned m_High
 the number of subpopulation cells high More...
 
unsigned m_CellSize
 Width of the cell in m (they are square) More...
 
unsigned m_Size
 Total cells. More...
 
- Protected Attributes inherited from Population_Manager
vector< unsigned > m_LiveArraySize
 
int m_NoProbes = 0
 
std::vector< std::vector< omp_nest_lock_t * > > m_MapGuard
 This is used to make sure animals will not behaviour at the same area - multi threads. More...
 
int m_guard_cell_height_num
 
int m_guard_cell_width_num
 
int m_guard_cell_size
 
bool m_is_paralleled
 This is used to indicate whether the species is paralleled. More...
 
const char * StateNames [100] {}
 
int m_StepSize {}
 
vector< vector< forward_list< TAnimal * > * > > TheSubArrays
 Hold all the animal pointers. More...
 
vector< vector< int > > TheSubArraysSizes
 Hold all the animal sizes in each thread. More...
 
vector< int > m_LifeStageOrderVec
 The vector to store the life stage order for looping specie life stages. More...
 
vector< forward_list< TAnimal * >::iterator > TheSubArraysIterators
 the iterator from last time called for SupplyAnimalPtr(), this for fast loop all the animals in the derived class. More...
 
vector< int > TheSubArrayPreviousIndex
 the animal index number from last time called for SupplyAnimalPtr(), this for fast loop all the animals in the derived class. More...
 
vector< int > TheSubArrayThreadIndex
 the thread index number from last time called for SupplyAnimalPtr(), this for fast loop all the animals in the derived class. More...
 
unsigned StateNamesLength
 
FILE * TestFile {}
 
FILE * TestFile2 {}
 
vector< unsigned > BeforeStepActions
 Holds the season list of possible before step actions. More...
 
int m_SeasonNumber
 Holds the season number. Used when running goose and hunter sims. More...
 
TTypesOfPopulation m_population_type {TOP_NoSpecies}
 
ofstream * AOROutputPrb {}
 
ofstream * RipleysOutputPrb {}
 
ofstream * RipleysOutputPrb1 {}
 
ofstream * RipleysOutputPrb2 {}
 
ofstream * RipleysOutputPrb3 {}
 
ofstream * RipleysOutputPrb4 {}
 
ofstream * RipleysOutputPrb5 {}
 
ofstream * RipleysOutputPrb6 {}
 
ofstream * RipleysOutputPrb7 {}
 
ofstream * RipleysOutputPrb8 {}
 
ofstream * RipleysOutputPrb9 {}
 
ofstream * RipleysOutputPrb10 {}
 
ofstream * RipleysOutputPrb11 {}
 
ofstream * RipleysOutputPrb12 {}
 
ofstream * ReallyBigOutputPrb {}
 
AOR_Probem_AOR_Probe {}
 A pointer to the AOR probe. More...
 
long int lamdagrid [2][257][257] {}
 
- Protected Attributes inherited from Population_Manager_Base
int SimH
 stores the simulation height More...
 
int SimW
 stores the simulation width More...
 
int SimHH
 stores the simulation height halved More...
 
int SimWH
 stores the simulation width halved More...
 
string m_SimulationName
 stores the simulation name More...
 
Landscapem_TheLandscape
 holds an internal pointer to the landscape More...
 
int m_ListNameLength {}
 the number of life-stages simulated in the population manager More...
 
const char * m_ListNames [32] {}
 A list of life-stage names. More...
 
std::string m_AORProbeFileName {"AOR_Probe.txt"}
 name of the AOR Probe file More...
 
std::string m_ProbeFileName {"Probe.res"}
 name of the Probe file More...
 
int m_step_counter_in_a_day
 Step counter in a day, this is used for the animals with finer step size other than one day. More...
 

Additional Inherited Members

- Public Attributes inherited from Population_Manager
bool ProbesSet {}
 
- Public Attributes inherited from Population_Manager_Base
Probe_DataTheProbe [100] = {nullptr}
 Holds a list of pointers to standard output probes. More...
 
- Protected Member Functions inherited from Population_Manager
virtual bool StepFinished ()
 Methods to run the simulations. More...
 
virtual void DoFirst ()
 
virtual void DoBefore ()
 
virtual void DoAfter ()
 
virtual void DoLast ()
 
virtual void DoSpecialBetweenLifeStages (int a_life_stage)
 
virtual void SortX (unsigned Type)
 
void SortXIndex (unsigned Type)
 
virtual void SortY (unsigned Type)
 
void SortState (unsigned Type)
 
void SortStateR (unsigned Type)
 
virtual unsigned PartitionLiveDead (unsigned Type)
 
virtual void Shuffle_or_Sort (unsigned Type)
 
virtual void Shuffle (unsigned Type)
 
virtual void Catastrophe ()
 
- Protected Member Functions inherited from Population_Manager_Base
 ~Population_Manager_Base ()=default
 

Constructor & Destructor Documentation

◆ OsmiaParasitoid_Population_Manager()

OsmiaParasitoid_Population_Manager::OsmiaParasitoid_Population_Manager ( Landscape a_landscape,
int  a_cellsize 
)

Intialises each subpopulation of Osmia parasitoids. Creates subpopulation maps and intialises each population Parasitoid populations are described by the enum TTypeOfOsmiaParasitoids

699  : Population_Manager(L)
700 {
705  // Calculate the number of cells
706  m_CellSize = a_cellsize;
709  m_Size = m_Wide*m_High;
710  unsigned notypes = static_cast<int>(TTypeOfOsmiaParasitoids::topara_foobar) - 1;
711  std::vector<OsmiaParasitoidSubPopulation*>::size_type index = notypes * m_Size;;
712  m_SubPopulations.resize(index);
713  for (unsigned ps = 0; ps < notypes; ps++)
714  {
715  double range = cfg_OsmiaParasStartHighLow.value(2 * ps) - cfg_OsmiaParasStartHighLow.value(2 * ps + 1);
716  for (unsigned int y = 0; y < m_High; y++)
717  for (unsigned int x = 0; x < m_Wide; x++)
718  {
720  index = ps* (x + y * m_Wide);
721  m_SubPopulations[index] = OPsP;
722  }
723  array<double, 12> morts;
724  for (int m=0; m<12; m++) morts[m]= cfg_OsmiaParasDailyMort.value(ps*12+m);
725  m_SubPopulations[0]->SetMortalities(morts); // This is a static member so only the one intialisation is needed, therefore outside the for y loop
726  }
727 }

References cfg_OsmiaParasDailyMort, cfg_OsmiaParasDispersal, cfg_OsmiaParasStartHighLow, g_rand_uni_fnc(), m_CellSize, m_High, m_Size, m_SubPopulations, m_TheLandscape, m_Wide, Landscape::SupplySimAreaHeight(), Landscape::SupplySimAreaWidth(), topara_foobar, and CfgArray_Double::value().

◆ ~OsmiaParasitoid_Population_Manager()

OsmiaParasitoid_Population_Manager::~OsmiaParasitoid_Population_Manager ( )
731 {
732  for (int p=0; p< int(m_SubPopulations.size()); p++)
733  {
734  delete m_SubPopulations[p];
735  }
736 }

References m_SubPopulations.

Member Function Documentation

◆ AddDispersers()

void OsmiaParasitoid_Population_Manager::AddDispersers ( int  a_ref,
double  a_dispersers 
)
inline
140  {
141  m_SubPopulations[a_ref]->Add(a_dispersers);
142  }

References m_SubPopulations.

Referenced by OsmiaParasitoidSubPopulation::Dispersal().

◆ AddParasitoid()

void OsmiaParasitoid_Population_Manager::AddParasitoid ( TTypeOfOsmiaParasitoids  a_type,
int  a_x,
int  a_y 
)
inline
151  {
152  int subpop = ((a_x / m_CellSize) + (a_y / m_CellSize) * m_Wide) + (static_cast<unsigned>(a_type)-1) * m_Size;
153  m_SubPopulations[subpop]->Add(1);
154  }

References m_CellSize, m_Size, m_SubPopulations, and m_Wide.

◆ GetParasitoidNumbers()

array< double, static_cast< unsigned >TTypeOfOsmiaParasitoids::topara_foobar)> OsmiaParasitoid_Population_Manager::GetParasitoidNumbers ( int  a_x,
int  a_y 
)

returns an array with the parasitoid numbers in the cell at the location given by a_x, a_y

740 {
741  array<double, static_cast<unsigned>(TTypeOfOsmiaParasitoids::topara_foobar)> parasitoiddensitylist;
742  // First find the right sub-population
743  int subpop = (a_x / m_CellSize) + (a_y / m_CellSize) * m_Wide;
744  for (unsigned ps = 1; ps < static_cast<int>(TTypeOfOsmiaParasitoids::topara_foobar); ps++)
745  {
746  parasitoiddensitylist[ps] = m_SubPopulations[subpop]->GetSubPopnSize();
747  subpop += m_Size;
748  }
749  return parasitoiddensitylist;
750 }

References m_CellSize, m_Size, m_SubPopulations, m_Wide, and topara_foobar.

Referenced by Osmia_Female::CalcParaistised().

◆ GetSize() [1/2]

double OsmiaParasitoid_Population_Manager::GetSize ( int  a_ref)
inline
146 { return m_SubPopulations[a_ref]->GetSubPopnSize(); }

References m_SubPopulations.

◆ GetSize() [2/2]

double OsmiaParasitoid_Population_Manager::GetSize ( int  a_x,
int  a_y 
)
inline
147 { return m_SubPopulations[a_x+a_y*m_Wide]->GetSubPopnSize(); }

References m_SubPopulations, and m_Wide.

◆ RemoveParasitoids()

void OsmiaParasitoid_Population_Manager::RemoveParasitoids ( int  a_ref,
double  a_dispersers 
)
inline
143  {
144  m_SubPopulations[a_ref]->Remove(a_dispersers);
145  }

References m_SubPopulations.

Member Data Documentation

◆ m_CellSize

unsigned OsmiaParasitoid_Population_Manager::m_CellSize
protected

Width of the cell in m (they are square)

Referenced by AddParasitoid(), GetParasitoidNumbers(), and OsmiaParasitoid_Population_Manager().

◆ m_High

unsigned OsmiaParasitoid_Population_Manager::m_High
protected

the number of subpopulation cells high

Referenced by OsmiaParasitoid_Population_Manager().

◆ m_Size

unsigned OsmiaParasitoid_Population_Manager::m_Size
protected

◆ m_SubPopulations

vector<OsmiaParasitoidSubPopulation*> OsmiaParasitoid_Population_Manager::m_SubPopulations
protected

◆ m_TheLandscape

Landscape* OsmiaParasitoid_Population_Manager::m_TheLandscape
protected

A useful pointer to the lanscape object.

Referenced by OsmiaParasitoid_Population_Manager().

◆ m_Wide

unsigned OsmiaParasitoid_Population_Manager::m_Wide
protected

the number of subpopulation cells wide

Referenced by AddParasitoid(), GetParasitoidNumbers(), GetSize(), and OsmiaParasitoid_Population_Manager().


The documentation for this class was generated from the following files:
g_rand_uni_fnc
double g_rand_uni_fnc()
Definition: ALMaSS_Random.cpp:56
OsmiaParasitoid_Population_Manager::m_Wide
unsigned m_Wide
the number of subpopulation cells wide
Definition: Osmia_Population_Manager.h:128
TTypeOfOsmiaParasitoids::topara_foobar
OsmiaParasitoid_Population_Manager::m_Size
unsigned m_Size
Total cells.
Definition: Osmia_Population_Manager.h:134
OsmiaParasitoid_Population_Manager::m_High
unsigned m_High
the number of subpopulation cells high
Definition: Osmia_Population_Manager.h:130
cfg_OsmiaParasDailyMort
static CfgArray_Double cfg_OsmiaParasDailyMort("OSMIA_PARAS_DAILYMORT", CFG_CUSTOM, 24, vector< double > { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 })
Montly mortalities for TTypeOfOsmiaParasitoids parasitoids. Each set of 12 are the mortalities matchi...
OsmiaParasitoid_Population_Manager::m_CellSize
unsigned m_CellSize
Width of the cell in m (they are square)
Definition: Osmia_Population_Manager.h:132
Landscape::SupplySimAreaHeight
int SupplySimAreaHeight(void)
Gets the simulation landscape height.
Definition: Landscape.h:2302
Landscape::SupplySimAreaWidth
int SupplySimAreaWidth(void)
Gets the simulation landscape width.
Definition: Landscape.h:2297
cfg_OsmiaParasStartHighLow
static CfgArray_Double cfg_OsmiaParasStartHighLow("OSMIA_PARAS_STARTHIGHLOW", CFG_CUSTOM, 2 *(static_cast< unsigned >(TTypeOfOsmiaParasitoids::topara_foobar) - 1), vector< double > { 2.0, 1.0, 2.0, 1.0})
Starting numbers for TTypeOfOsmiaParasitoids parasitoids. Each entry is the max and min starting numb...
cfg_OsmiaParasDispersal
static CfgArray_Double cfg_OsmiaParasDispersal("OSMIA_PARAS_DISPERSAL", CFG_CUSTOM, static_cast< unsigned >(TTypeOfOsmiaParasitoids::topara_foobar) - 1, vector< double > { 0.001, 0.0001 })
Dispersal rates for TTypeOfOsmiaParasitoids parasitoids. Each entry is the dispersal rate for the par...
CfgArray_Double::value
std::vector< double > value() const
Definition: Configurator.h:219
OsmiaParasitoid_Population_Manager::m_SubPopulations
vector< OsmiaParasitoidSubPopulation * > m_SubPopulations
The array storing the sub-populations of parasitoids.
Definition: Osmia_Population_Manager.h:124
OsmiaParasitoidSubPopulation
Definition: Osmia_Population_Manager.h:69
Population_Manager::Population_Manager
Population_Manager(Landscape *a_l_ptr, int a_numberLifeStages=12)
Definition: PopulationManager.cpp:200
OsmiaParasitoid_Population_Manager::m_TheLandscape
Landscape * m_TheLandscape
A useful pointer to the lanscape object.
Definition: Osmia_Population_Manager.h:126