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

nbrhd1D

Declaration
Parameters
Remarks
Example
See Also

Declaration

void __stdcall nbrhd1D(
	int range,      	// number of neighbours to either side
	int boundaryType	// type of boundary on world
);
Top of page

Parameters

range
Range of neighbourhood. Neighbourhood consists of range nearest neighbours to either side of an agent.
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
onSimCreate to set the neighbourhood of each agent to a one-dimensional (horizontal) strip of the range nearest neighbours to either side. Effectively, this allows the two-dimensional simulation to mimic a series of one-dimensional simulations running in parallel.

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

01a23

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) { nbrhd1D(2,btPeriodic); }
Top of page

See Also

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