ConfinedMove

The class ConfinedMove is derived from Action and limits the agents moves to a ciecle with specified center and radius. It maintains an array of permissions (one bool for each cell), where false means the cell is out of limits. Usually it is used togeteher with a RandomMove if WeightedMove action. The priority for this action shold be set to make it be executed after the mve action.

It uses the population’s list of registered moves to eliminate those moves from the list who would cross the boundary.

Code:

Attributes:

ATTR_CONFINEDMOVE_NAME

“ConfinedMove”

action name

ATTR_CONFINEDMOVE_X_NAME

“ConfinedMove_x”

x-coordinate of confinement circle

ATTR_CONFINEDMOVE_Y_NAME

“ConfinedMove_y”

y-coordinate of confinement circle

ATTR_CONFINEDMOVE_R_NAME

“ConfinedMove_r”

radius of confinement circle

Public Methods

constructor

ConfinedMove(SPopulation<T> *pPop, SCellGrid *pCG, std::string sID);
pPop

A pointer to the SPopulation object performing this action.

pCG

A pointer to the SCellGrid object on which the simulation runs.

sActionName

Name of this action.

sID

An ID for this action.

The constructor.

destructor

virtual ~ConfinedMove();

Deletes the array of permissions.

preLoop

virtual int preLoop();

Here the array of permissions is created and filled (true if corresponding cell is inside the confinement circle, false otherwise). (This is done in parallel)

finalize

virtual int finalize(float fTime);

Here the list of registered moves is modified: moves which lead outside the confinement circle are removed from the list.

extractAttributesQDF

virtual int extractAttributesQDF(hid_t hSpeciesGroup);
hSpeciesGroup

HDF handle for the species group to read from.

Reads the action’s attributes from the specified group of a QDF file.

writeAttributesQDF

virtual int writeAttributesQDF(hid_t hSpeciesGroup);
hSpeciesGroup

HDF handle for the species group to write the attributes to.

Writes the action’s attributes (in this case, the registration mode) to the specified group pf a QDF file.

tryGetAttributes

virtual int tryGetAttributes(const ModuleComplex *pMC);
pMC

A ModuleComplex object.

Extracts the action’s attributes from the ModuleComplex object.

modifyAttributes

virtual int modifyAttributes(const std::string sAttrName, double dValue);
sAttrName

Name of attribute to change.

dValue

Value to set the attribute to.

Can be used to change the center and/or the radius of the confinement.

isEqual

virtual bool isEqual(Action<T> *pAction, bool bStrict);
pAction

Pointer to an action object to compare with this.

bStrict

Strictness of comparisons (ignored here).

pAction is equal to this, if it is a ConfinedMove object whose mpve attributes have values equal to those of this object.