Patch
<< previous | Chapter 17. The Built-In breve Class APIs | next >>

## Patch

Description for class Patch:

> A patch is a non-physical object which is associated with a specific location in space. A patch can hold information about the state of the world in that location, such as the presence of a nutrient, for example. See the object PatchGrid for more information on setting up patches. Patches must be set up as part of a PatchGrid.

> Because patches are not physical, they cannot move and they cannot collide with other objects. Though you can find the patch that an object is in, there is no collision callback when an object enters the patch. Patches can track the concentration of objects in their space. Currently this is limited to PatchChemical objects which are used to track information about abstract diffusable elements in the world. You can get the concentration, set the concentration, add and remove PatchChemcicals through the patch. See PatchGrid for adding PatchChemcials to the simulation and to iterate the diffusion. It is important to note that concentrations are stored in single precision floats currently to improve performance on hardware that supports SIMD processing.

> The methods used to find neighboring patches depends on the type of simulation you're running. Though many of the "get-patch" methods described below behave the same as one another, they are named differently to be consistent with different types of simulations.

> The neighbors are not fully initialized at the time that the init method is called. This is because the CLASS(PatchGrid) must create all of the patches before it can initialize the neighbors. Instead of accessing the neighbors in the init method, you should implement your own init-patch and place all initialization inside this method. The neighbors for the patch will be fully initialized by the time the init-patch method is called.

> When using a 2D XY style simulation, use the following methods to get the four cardinal directions: get-patch-to-left, get-patch-to-right, get-patch-above and get-patch-below.

> When using a 3D style simulation with and XZ ground plane (such that the vector (0, 1, 0) is pointing up, use the following methods to get the six cardinal directions: get-patch-to-north, get-patch-to-east, get-patch-to-south, get-patch-to-west, get-patch-above and get-patch-below.

> These two groups of methods should suffice for most simulations, but if for some reason you use another orientation for your simulation which doesn't fit well with the vocabulary of these methods, you can use the following methods: get-patch-towards-plus-x, get-patch-towards-minus-x, get-patch-towards-plus-y, get-patch-towards-minus-y, get-patch-towards-plus-z and get-patch-towards-minus-z.

Inherits from Abstract

Full API documentation for the class Patch:

- steve language documentation

- Python language documentation

<< previous | Up | next >>
Object | Table of Contents | PatchGrid