import CPMEvol from 'Artistoo/src/models/CPMEvol.js'
public class | source

CPMEvol

Extends:

GridBasedModelCPM → CPMEvol

Extension of the CPM class that uses Cell objects to track internal state of Cells Cell objects can override conf parameters, and track their lineage.

Constructor Summary

Public Constructor
public

constructor(field_size: GridSize, conf: object)

The constructor of class CA.

Member Summary

Public Members
public

Store the constructor of each cellKind on the grid, in order 0th index currently unused - but this is explicitly left open for further extension (granting background variable parameters through Cell)

public

Store the {@Cell} of each cell on the grid.

Method Summary

Public Methods
public

birth(childId: CellId, parentId: CellId)

Calls a birth event in a new daughter Cell object, and hands the other daughter (as parent) on to the Cell.

public

cellDeath(i: IndexCoordinate, t_old: CellId, t_new: CellId)

The postSetpixListener of CPMEvol registers cell death.

public

Get the Cell of the cell with CellId t.

public

Initiate a new CellId for a cell of CellKind "kind", and create elements for this cell in the relevant arrays.

public

reset()

Completely reset; remove all cells and set time back to zero.

Inherited Summary

From class GridBasedModel
public

cellvolume: *[]

This tracks the volumes of all non-background cells on the grid.

public

Input parameter settings; see the constructor of subclasses documentation.

public

Size of the grid.

public

Size of the grid in object format.

public

grid: *

public

Midpoint of the grid.

public

Attach a random number generation with a seed.

public

Dimensionality of the grid

public

The Grid2D#neighi or Grid3D#neighi iterator function of the underlying grid.

public

The Grid2D#pixels or Grid3D#pixels iterator function of the underlying grid.

public

The Grid#pixti iterator function of the underlying grid.

public

Cached values of these stats.

public

Objects of class Stat that have been computed on this model.

public

Tracks the elapsed time in MCS

public

Iterator for all the CellIds that are currently on the grid.

public

Get the CellKind of the cell with CellId t.

public

getStat(s: Stat): anything

Compute a statistic on this model.

public

neigh(p: ArrayCoordinate, torus: boolean[]): *

Get neighbourhood of position p, using neighborhood functions of the underlying grid class.

public

Get CellId of the pixel at coordinates p.

public

ran(incl_min: number, incl_max: number): number

Get a random integer number between incl_min and incl_max, uniformly sampled.

public

Get a random number from the seeded number generator.

public

Change the pixel at position p into CellId t.

public

Change the pixel at position i into CellId t.

public abstract

Update the grid in one timestep.

From class CPM
public get
public

track border pixels for speed

public

cellvolume: *[]

public

Array of objects of (@link HardConstraint) subclasses attached to the CPM.

public

Object showing which constraints are where in soft_constraints.

public

To check from outside if an object is a CPM; doing this with instanceof doesn't work in some cases. Any other object will not have this variable and return 'undefined', which in an if-statement equates to a 'false'. @type{boolean}

public

Highest cell ID previously assigned.

public

Number of non-background cells currently on the grid.

public

Array of functions that need to be executed after every timeStep event.

public

Array of functions that need to be executed after every setpixi event.

public

Array of objects of (@link SoftConstraint) subclasses attached to the CPM.

public

Object showing which constraints are where in soft_constraints.

public
public

Store the {@CellKind} of each cell on the grid.

public

Track time in MCS.

private

Private property used by updateborderneari to track borders.

public

Add a constraint to the CPM, ensuring that its SoftConstraint#deltaH or HardConstraint#fulfilled methods are called appropriately during a copy attempt.

public

Iterator returning non-background border pixels on the grid.

public

Iterator returning non-background border pixels on the grid.

public

Get the CellKind of the cell with CellId t.

public

Iterator returning non-background pixels on the grid.

public

deltaH(sourcei: IndexCoordinate, targeti: IndexCoordinate, src_type: CellId, tgt_type: CellId): number

returns total change in hamiltonian for all registered soft constraints together.

public

docopy(deltaH: number): boolean

Determine whether copy attempt will succeed depending on deltaH (stochastic).

public
public

getConstraint(constraintname: string, num: number): *

Get a Constraint object linked to this CPM by the name of its class.

public

Get volume of the cell with CellId t

public

Initiate a new CellId for a cell of CellKind "kind", and create elements for this cell in the relevant arrays (cellvolume, t2k).

public

Simulate one Monte Carlo Step.

public

Get CellId of the pixel at coordinates p.

public

reset()

Completely reset; remove all cells and set time back to zero.

public

Assign the cell with CellId t to CellKind k.

public

Change the pixel at position i into CellId t.

public

A time step in the CPM is a Monte Carlo step.

public

Update border elements (borderpixels) after a successful copy attempt.

Public Constructors

public constructor(field_size: GridSize, conf: object) source

The constructor of class CA.

Override:

CPM#constructor

Params:

NameTypeAttributeDescription
field_size GridSize

the size of the grid of the model.

conf object

configuration options; see CPM base class.

conf.CELLS object[]
  • optional
  • default: [empty, CPM.Cell, CPM.StochasticCorrector]

Array of objects of (@link Cell) subclasses attached to the CPM. These define the internal state of the cell objects that are tracked

Public Members

public cellclasses: CellObject source

Store the constructor of each cellKind on the grid, in order 0th index currently unused - but this is explicitly left open for further extension (granting background variable parameters through Cell)

public cells: Cell source

Store the {@Cell} of each cell on the grid.

Example:

this.cells[1] // cell object of cell with cellId 1

Public Methods

public birth(childId: CellId, parentId: CellId) source

Calls a birth event in a new daughter Cell object, and hands the other daughter (as parent) on to the Cell.

Params:

NameTypeAttributeDescription
childId CellId

id of the newly created Cell object

parentId CellId

id of the other daughter (that kept the parent id)

public cellDeath(i: IndexCoordinate, t_old: CellId, t_new: CellId) source

The postSetpixListener of CPMEvol registers cell death.

Params:

NameTypeAttributeDescription
i IndexCoordinate

the coordinate of the pixel that is changed.

t_old CellId

the cellid of this pixel before the copy

t_new CellId

the cellid of this pixel after the copy.

Listen:

setpixi

as this records when cels no longer contain any pixels. Note: CPM class already logs most of death, so it registers deleted entries.

public getCell(t: CellId): Cell source

Get the Cell of the cell with CellId t.

Params:

NameTypeAttributeDescription
t CellId

id of the cell to get kind of.

Return:

Cell

the cell object.

public makeNewCellID(kind: CellKind): CellId source

Initiate a new CellId for a cell of CellKind "kind", and create elements for this cell in the relevant arrays. Overrides super to also add a new Cell object to track.

Override:

CPM#makeNewCellID

Params:

NameTypeAttributeDescription
kind CellKind

cellkind of the cell that has to be made.

Return:

CellId

newid of the new cell.

public reset() source

Completely reset; remove all cells and set time back to zero. Only the constraints and empty cell remain.

Override:

CPM#reset