ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
AOR_Probe_Goose Class Reference

#include <AOR_Probe.h>

Inheritance diagram for AOR_Probe_Goose:
AOR_Probe

Public Member Functions

 AOR_Probe_Goose (Population_Manager *a_owner, Landscape *a_TheLandscape, string a_filename)
 
virtual void DoProbe (int a_lifestage)
 
- Public Member Functions inherited from AOR_Probe
 AOR_Probe (Population_Manager *a_owner, Landscape *a_TheLandscape, string a_filename)
 
virtual ~AOR_Probe ()
 
virtual void CloseFile ()
 
void WriteData ()
 
void WriteDataHL ()
 
virtual void DoProbeInHaitatType (int a_lifestage, TTypesOfLandscapeElement a_tole)
 Records the locations of all beetles and classifies them as to in a habitat type or not. More...
 

Additional Inherited Members

- Protected Attributes inherited from AOR_Probe
ofstream m_ProbeFile
 
ofstream m_ProbeFileHL
 
int m_gridcountwidth [4]
 
int m_gridcountheight [4]
 
int m_gridcountsize [4]
 
int m_totalcells [4]
 
ListOfCells m_gridcount [4]
 
ListOfCells m_gridcountHLoc [4]
 
Landscapem_TheLandscape
 
TTypesOfLandscapeElement m_target_tole
 
Population_Managerm_owner
 

Constructor & Destructor Documentation

◆ AOR_Probe_Goose()

AOR_Probe_Goose::AOR_Probe_Goose ( Population_Manager a_owner,
Landscape a_TheLandscape,
string  a_filename 
)
130  : AOR_Probe(a_owner, a_TheLandscape, a_filename)
131 {
132  ;
133 }

Member Function Documentation

◆ DoProbe()

void AOR_Probe_Goose::DoProbe ( int  a_lifestage)
virtual

Reimplemented from AOR_Probe.

136 {
137  Goose_Base* aGoose;
138  for (int grid = 0; grid < 4; grid++) {
139  // The line below may be the fastest way to fill a vector of ints with '0', but the one following is the safe way
140  // memset(&m_gridcount[grid][0], 0, m_gridcount[grid].size() * sizeof m_gridcount[grid][0]);
141  fill(m_gridcount[grid].begin(), m_gridcount[grid].end(), 0);
142  }
143  for (int groups = 0; groups < 2; groups++)
144  {
145  int gooseindex = a_goosespecies * 2 + groups;
146  unsigned int total = (unsigned)m_owner->GetLiveArraySize(gooseindex);
147  for (int grid = 0; grid < 4; grid++)
148  {
149  for (unsigned j = 0; j < total; j++)
150  {
151  aGoose = dynamic_cast<Goose_Base*>(m_owner->SupplyAnimalPtr(gooseindex, j));
152  if (aGoose->GetCurrentStateNo() != -1) {
153  APoint pt = aGoose->SupplyPoint();
154  int gx = pt.m_x / m_gridcountsize[grid];
155  int gy = pt.m_y / m_gridcountsize[grid];
156  m_gridcount[grid][gx + gy * m_gridcountwidth[grid]] += aGoose->GetGroupsize();
157  }
158  }
159  }
160  }
161  WriteData();
162 }

References Population_Manager::GetLiveArraySize(), AOR_Probe::m_gridcount, AOR_Probe::m_gridcountsize, AOR_Probe::m_gridcountwidth, AOR_Probe::m_owner, APoint::m_x, APoint::m_y, Population_Manager::SupplyAnimalPtr(), and AOR_Probe::WriteData().


The documentation for this class was generated from the following files:
Population_Manager::SupplyAnimalPtr
virtual TAnimal * SupplyAnimalPtr(unsigned int a_index, unsigned int a_animal)
Returns the pointer indexed by a_index and a_animal. Note NO RANGE CHECK.
Definition: PopulationManager.h:678
AOR_Probe::m_owner
Population_Manager * m_owner
Definition: AOR_Probe.h:18
APoint
A simple class defining an x,y coordinate set.
Definition: ALMaSS_Setup.h:52
APoint::m_x
int m_x
Definition: ALMaSS_Setup.h:55
AOR_Probe::m_gridcount
ListOfCells m_gridcount[4]
Definition: AOR_Probe.h:13
Population_Manager::GetLiveArraySize
unsigned GetLiveArraySize(int a_listindex) override
Gets the number of 'live' objects for a list index in the TheArray.
Definition: PopulationManager.h:657
AOR_Probe::m_gridcountwidth
int m_gridcountwidth[4]
Definition: AOR_Probe.h:9
AOR_Probe::AOR_Probe
AOR_Probe(Population_Manager *a_owner, Landscape *a_TheLandscape, string a_filename)
Definition: AOR_Probe.cpp:15
AOR_Probe::WriteData
void WriteData()
Definition: AOR_Probe.cpp:56
APoint::m_y
int m_y
Definition: ALMaSS_Setup.h:56
AOR_Probe::m_gridcountsize
int m_gridcountsize[4]
Definition: AOR_Probe.h:11