caLib_abstract.lattice

This module defines the notion of a $(LATTICE). A $(LATTICE) is the data structure in wich all the cells are stored. Each generation, a $(RULE) changes the cells in the $(LATTICE). The most common example of a $(LATTICE) is a infinite square grid. Each square is the cell and it can contain any data such as a number or color. All of the cells then have a x,y coordinates associated with them. But some $(LATTICE)s can have other dimensions, like a 3-dimensional grid of cubes where each cube have an x,y,z coordinate. Or it can have som other shape, like a grid with hexagons instead of squares. The only limitation is that the coordinates must be integers. * This module provides templates for testing whether a given object is a $(LATTICE), and what kind of $(LATTICE) it is. * $(CALIB_ABSTRACT_DESC) *

Members

Structs

BoundedLattice
struct BoundedLattice(Ct, uint N)

Example of a BoundedLattice

Lattice
struct Lattice(Ct, uint N, neighbourhood = Neighbourhood!N)

Example of a Lattice

Templates

isAnyBoundedLattice
template isAnyBoundedLattice(T)

$(IS_ANY BoundedLattice)

isAnyLattice
template isAnyLattice(T)

$(IS_ANY Lattice)

isBoundedLattice
template isBoundedLattice(T, Ct, uint N)

Tests if something is a BoundedLattice. * returns true if T is a BoundedLattice of dimension N, Storing cells of type Ct. False if not. * A BoundedLattice is a $(LATTICE) with a fixed size. It's function getLatticeBounds returns a list of uint's representing the length of the lattice's dimensions * A BoundedLattice is a Lattice with the additional function: void getLatticeBounds(). *

isLattice
template isLattice(T, Ct, uint N)

Tests if something is a Lattice. * returns true if T is a Lattice of dimension N, Storing cells of type Ct. * A Lattice is the most basic form of a $(LATTICE). It must define the functions:
Ct get(string)(Coord), Ct get(Coord),
void set(string)(Coord, Ct), void set(Coord, Ct),
Ct[] getNeighbours(string)(Coord), Ct[] getNeighbours(Coord),
void iterate(string)(ubyte delegate(Ct cellState, Ct[] neighbours, Coord c)), void iterate(ubyte delegate(Ct cellState, Ct[] neighbours, Coord c)),
void nextGen(string)(), void nextGen(),
Where Coord is an alias for a typetuple containing int's, one int for each dimension (in a 3 dimensional Lattice Coord would be: (int, int, int)). *

Meta