Rik's Treehouse > Babbling in Binary > My Software > Orphanware > R2DToo > R2DToo Help > For the Programmer > nbrhdVonNeumann

nbrhdVonNeumann

Declaration
Parameters
Remarks
Example
See Also

Declaration

void __stdcall nbrhdVonNeumann(
	int range,      	// range of neighbourhood
	int boundaryType	// type of boundary on world
);
Top of page

Parameters

range
Range of Von Neumann neighbourhood.
boundaryType
Type of boundary to impose on world. See Remarks.
Top of page

Remarks

This function is available through the API. It can be called within the model-supplied routine
setNbrhd to set the neighbourhood of each agent to a Von Neumann neighbourhood of range range. This consists of all sites reachable within range steps up or down, but not diagonally (forming a diamond of maximum width 2range+1 excepting the center cell).

The neighbours are indexed from left to right and top to bottom. For example, if range=1 the neighbour indices of agent a are

0
1a2
3

Boundaries

Boundaries are handled by the boundaryType parameter which may be one of the following:

btPeriodic
All borders wrap around forming a torus.
btEmpty
Agents at the edge have fewer neighbours. Top of page

Example

void __stdcall setNbrhd(double *param) { nbrhdVonNeumann(1,btPeriodic); }
Top of page

See Also

onSimCreate, nbrhd1D, nbrhdBlocks, nbrhdCCDM, nbrhdFractal, nbrhdMoore, nbrhdRandom, nbrhdRandomER.
Top of page
[Rik's Office Hours] [Contact Rik]
Last updated: Fri Apr 30 2004, 1:42pm