ALMaSS Skylark ODDox  1.1
The skylark model description following ODdox protocol
TSkylarkList< T > Class Template Reference

#include <skylarks_all.h>

Public Member Functions

 TSkylarkList ()
 
double Probe (probe_data *p_TheProbe)
 

Constructor & Destructor Documentation

◆ TSkylarkList()

template<class T >
TSkylarkList< T >::TSkylarkList ( )
inline
88  : vector < T > ()
89  {
90  }

Member Function Documentation

◆ Probe()

template<class T >
double TSkylarkList< T >::Probe ( probe_data p_TheProbe)
inline
94  {
95 
96  // Counts through the list and goes through each area to see if the animal
97  // is standing there and if the farm, veg or element conditions are met
98  AnimalPosition Sp;
99  double NumberSk = 0;
100  // Four possibilites
101  // either NoVegTypes or NoElementTypes or NoFarmTypes is >0 or all==0
102  if ( p_TheProbe->m_NoFarms != 0 )
103  {
104  for ( unsigned j = 0; j < this->GetItemsInContainer(); j++ )
105  {
106  Sp = this->Get( j )->SupplyPosition();
107  unsigned Farm = this->Get( j )->SupplyFarmOwnerRef();
108  for ( unsigned i = 0; i < p_TheProbe->m_NoAreas; i++ )
109  {
110  if ( ( Sp.m_x >= p_TheProbe->m_Rect[i].m_x1 ) && ( Sp.m_y >= p_TheProbe->m_Rect[i].m_y1 )
111  && ( Sp.m_x < p_TheProbe->m_Rect[i].m_x2 ) && ( Sp.m_y < p_TheProbe->m_Rect[i].m_y2 ) )
112  for ( unsigned k = 0; k < p_TheProbe->m_NoFarms; k++ )
113  {
114  if ( p_TheProbe->m_RefFarms[k] == Farm )
115  NumberSk++; // it is in the square so increment number
116  }
117  }
118  }
119  }
120  if ( p_TheProbe->m_NoEleTypes != 0 )
121  {
122  for ( unsigned j = 0; j < this->GetItemsInContainer(); j++ )
123  {
124  Sp = this->Get( j )->SupplyPosition();
125  for ( unsigned i = 0; i < p_TheProbe->m_NoAreas; i++ )
126  {
127  if ( ( Sp.m_x >= p_TheProbe->m_Rect[i].m_x1 ) && ( Sp.m_y >= p_TheProbe->m_Rect[i].m_y1 )
128  && ( Sp.m_x < p_TheProbe->m_Rect[i].m_x2 ) && ( Sp.m_y < p_TheProbe->m_Rect[i].m_y2 ) )
129  for ( unsigned k = 0; k < p_TheProbe->m_NoEleTypes; k++ )
130  {
131  if ( p_TheProbe->m_RefEle[k] == Sp.m_EleType )
132  NumberSk++; // it is in the square so increment number
133  }
134  }
135  }
136  }
137  else
138  {
139  if ( p_TheProbe->m_NoVegTypes != 0 )
140  {
141  for ( unsigned j = 0; j < this->GetItemsInContainer(); j++ )
142  {
143  Sp = this->Get( j )->SupplyPosition();
144  for ( unsigned i = 0; i < p_TheProbe->m_NoAreas; i++ )
145  {
146  if ( ( Sp.m_x >= p_TheProbe->m_Rect[i].m_x1 ) && ( Sp.m_y >= p_TheProbe->m_Rect[i].m_y1 )
147  && ( Sp.m_x < p_TheProbe->m_Rect[i].m_x2 ) && ( Sp.m_y < p_TheProbe->m_Rect[i].m_y2 ) )
148  {
149  for ( unsigned k = 0; k < p_TheProbe->m_NoVegTypes; k++ )
150  {
151  if ( p_TheProbe->m_RefVeg[k] == Sp.m_VegType )
152  NumberSk++; // it is in the square so increment number
153  }
154  }
155  }
156  }
157  }
158  else // both must be zero
159  {
160  for ( unsigned j = 0; j < this->GetItemsInContainer(); j++ )
161  {
162  Sp = this->Get( j )->SupplyPosition();
163  for ( unsigned i = 0; i < p_TheProbe->m_NoAreas; i++ )
164  {
165  if ( ( Sp.m_x >= p_TheProbe->m_Rect[i].m_x1 ) && ( Sp.m_y >= p_TheProbe->m_Rect[i].m_y1 )
166  && ( Sp.m_x < p_TheProbe->m_Rect[i].m_x2 ) && ( Sp.m_y < p_TheProbe->m_Rect[i].m_y2 ) )
167  NumberSk++; // it is in the square so increment number
168  }
169  }
170  }
171  }
172  return NumberSk;
173  }

References AnimalPosition::m_EleType, probe_data::m_NoAreas, probe_data::m_NoEleTypes, probe_data::m_NoFarms, probe_data::m_NoVegTypes, probe_data::m_Rect, probe_data::m_RefEle, probe_data::m_RefFarms, probe_data::m_RefVeg, AnimalPosition::m_VegType, AnimalPosition::m_x, rectangle::m_x1, rectangle::m_x2, AnimalPosition::m_y, rectangle::m_y1, and rectangle::m_y2.


The documentation for this class was generated from the following file:
probe_data::m_NoAreas
unsigned m_NoAreas
Definition: PopulationManager.h:292
probe_data::m_RefFarms
unsigned m_RefFarms[25]
Definition: PopulationManager.h:299
probe_data::m_Rect
rectangle m_Rect[10]
Definition: PopulationManager.h:293
AnimalPosition::m_x
unsigned m_x
Definition: PopulationManager.h:172
rectangle::m_y1
unsigned m_y1
Definition: PopulationManager.h:101
probe_data::m_NoVegTypes
unsigned m_NoVegTypes
Definition: PopulationManager.h:295
rectangle::m_x2
unsigned m_x2
Definition: PopulationManager.h:102
probe_data::m_RefEle
TTypesOfLandscapeElement m_RefEle[25]
Definition: PopulationManager.h:298
probe_data::m_RefVeg
TTypesOfVegetation m_RefVeg[25]
Definition: PopulationManager.h:297
vector
AnimalPosition
A class defining an animals position.
Definition: PopulationManager.h:168
rectangle::m_y2
unsigned m_y2
Definition: PopulationManager.h:103
AnimalPosition::m_EleType
TTypesOfLandscapeElement m_EleType
Definition: PopulationManager.h:174
AnimalPosition::m_y
unsigned m_y
Definition: PopulationManager.h:173
rectangle::m_x1
unsigned m_x1
Definition: PopulationManager.h:100
Farm
The base class for all farm types.
Definition: farm.h:767
probe_data::m_NoEleTypes
unsigned m_NoEleTypes
Definition: PopulationManager.h:294
probe_data::m_NoFarms
unsigned m_NoFarms
Definition: PopulationManager.h:296
AnimalPosition::m_VegType
TTypesOfVegetation m_VegType
Definition: PopulationManager.h:175