tut_MovePop¶
This page describes the class tut_MovePop
The class tut_MovePop
is derived from SPopulation.
Here the agents age and die after reaching an age near the maximum age, and they are able to move randomly
For this the actions
are required.
(The class tut_MovePop
is described in detail in the third part of the tutorial).
- Code:
Data types¶
The actions GetOld
and OldAgeDeath
expect the agents to have a float member m_fAge
.
Therefore, we extend the basic agent type defined in SPopulation by a float:
struct tut_OldAgeDieAgent : Agent {
float m_fAge;
};
Public Methods¶
constructor
¶
tut_OldAgeDiePop(SCellGrid *pCG, PopFinder *pPopFinder, int iLayerSize,
IDGen **apIDG, uint32_t *aulState, uint *aiSeeds);
pCG
Pointer to the cell grid the simulation runs on.
pPopFinder
A pointer to an instance of a PopFinder population container.
iLayerSize
The layer size used by the agent management system.
apIDG
An array of pointers to the ID generators, one for each thread.
aulState
An array of
uint
used to initalize the WELL512 random number generators.aiSeeds
Seeds for other WELL512 instances not used for moving and breeding, e.g. for genetics.
This creates an instance each of GetOld, OldAgeDeath and RandomMove, and registers them with the Prioritizer.
destructor
¶
~tut_OldAgeDiePop();
The destructor deletes the action objects created in the constructor.
addPopSpecificAgentData
¶
addPopSpecificAgentData(int iAgentIndex, char **ppData);
iAgentIndex
Index of agent whose data is being read.
ppData
pointer to a string containing textual representation of data (see DAT-files).
addPopSpecificAgentDataTypeQDF
¶
addPopSpecificAgentDataTypeQDF(hid_t *hAgentDataType);
hAgentDataType
HDF5 handle for a existin HDF data type.
This method extends the existing HDF data type, by an entry for the agent’s age member.