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
);

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.

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
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.

Example
void __stdcall setNbrhd(double *param)
{
nbrhd1D(2,btPeriodic);
}

See AlsoonSimCreate, nbrhdBlocks, nbrhdCCDM, nbrhdFractal, nbrhdMoore, nbrhdRandom, nbrhdRandomER, nbrhdVonNeumann. |