Class CubicGeometry
Object
AbstractGeometry
AbstractLattice
CubicGeometry
Cubic lattice geometry (3D) with optional fixed boundaries.
-
Field Summary
Fields inherited from class AbstractLattice
fixedBoundaryFields inherited from class AbstractGeometry
connectivity, EMPTY_LINKS, engine, features, in, isInterspecies, isRegular, isRewired, isSingle, isUndirected, isValid, kin, kout, logger, name, network2D, network3D, out, pAddwire, pRewire, size, specs, type -
Constructor Summary
ConstructorsConstructorDescriptionCubicGeometry(EvoLudo engine) Create a cubic-lattice geometry tied to the given engine. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddNeighbor(int aPlayer, int z, int y, int x) Adds a neighbor if all indices are valid (non-negative).private voidaddSixNeighborsFixed(boolean interspecies, int z, int up, int down, int l) Adds the six nearest-neighbors with fixed boundary conditions.private voidaddSixNeighborsToroidal(boolean interspecies, int z, int up, int down, int l) Adds the six nearest-neighbors with toroidal boundary conditions.protected booleanHook for subclasses to implement geometry specific checks.voidinit()Generates a cubic (3D) regular lattice.private voidinitFixed(int l, int lz) Populate the lattice with a larger interaction range than the von-Neumann stencil, with fixed boundaries.private voidinitRange(int l, int lz) Populate the lattice with a larger interaction range than the von-Neumann stencil, optionally with toroidal wrapping.private voidinitSelf(int l, int lz) Connect each node exclusively to itself (used when connectivity is 1).private voidinitSixNeighbors(int l, int lz) Populate the lattice with von-Neumann (6-neighbour) connectivity, respecting the configured boundary conditions.private voidinitToroidal(int l, int lz) Populate the lattice with a larger interaction range than the von-Neumann stencil, with toroidal wrapping.private voidlinkNeighboursAt(int aPlayer, int bOffset, int min, int max, int l, boolean interspecies) Links all neighbors in the specified range [min, max] around bOffset to aPlayer.booleanParse geometry-specific CLI options.Methods inherited from class AbstractLattice
clone, equals, hashCode, isFixedBoundary, setFixedBoundary, stripBoundaryMethods inherited from class AbstractGeometry
addDirected, addEdgeAt, addLinkAt, addUndirected, alloc, check, clearLinksFrom, clearLinksTo, create, create, decodeGeometry, deriveCompetitionGeometry, displaySingle, encodeGeometry, enforceSize, getAddwire, getConnectivity, getEncodeKey, getFeatures, getLabel, getName, getNetwork2D, getNetwork3D, getRewire, getSize, getSpecs, getType, isConsistent, isGraphConnected, isInterspecies, isLattice, isNeighborOf, isRegular, isRewired, isSingle, isType, isUndirected, isUnique, parse, removeEdgeAt, removeLinkAt, rewire, rewireDirected, rewireEdgeAt, rewireLinkAt, rewireUndirected, setAddwire, setConnectivity, setInterspecies, setName, setNetwork2D, setNetwork3D, setRewire, setSingle, setSize, setType, swapEdges, usage, warn
-
Constructor Details
-
CubicGeometry
Create a cubic-lattice geometry tied to the given engine.- Parameters:
engine- EvoLudo pacemaker
-
-
Method Details
-
parse
Description copied from class:AbstractGeometryParse geometry-specific CLI options.- Overrides:
parsein classAbstractGeometry- Parameters:
arg- the argument string without the geometry key- Returns:
trueif parsing succeeded,falseif invalid
-
init
public void init()Generates a cubic (3D) regular lattice. Supports von-Neumann style connectivity \(k=6\) as well as larger interaction ranges and optional fixed boundaries.- Specified by:
initin classAbstractGeometry
-
initSelf
private void initSelf(int l, int lz) Connect each node exclusively to itself (used when connectivity is 1).- Parameters:
l- side length of the latticelz- number of layers along the z-direction
-
initSixNeighbors
private void initSixNeighbors(int l, int lz) Populate the lattice with von-Neumann (6-neighbour) connectivity, respecting the configured boundary conditions.- Parameters:
l- side length of the latticelz- number of layers along the z-direction
-
addSixNeighborsFixed
private void addSixNeighborsFixed(boolean interspecies, int z, int up, int down, int l) Adds the six nearest-neighbors with fixed boundary conditions.- Parameters:
interspecies- whether self-links are permittedz- layer offsetup- index offset of the layer abovedown- index offset of the layer belowl- side length of the lattice
-
addNeighbor
private void addNeighbor(int aPlayer, int z, int y, int x) Adds a neighbor if all indices are valid (non-negative).- Parameters:
aPlayer- the focal nodez- layer offsety- row offset within the layerx- column offset within the row
-
addSixNeighborsToroidal
private void addSixNeighborsToroidal(boolean interspecies, int z, int up, int down, int l) Adds the six nearest-neighbors with toroidal boundary conditions.- Parameters:
interspecies- whether self-links are permittedz- layer offsetup- index offset of the layer abovedown- index offset of the layer belowl- side length of the lattice
-
initRange
private void initRange(int l, int lz) Populate the lattice with a larger interaction range than the von-Neumann stencil, optionally with toroidal wrapping.- Parameters:
l- side length of the latticelz- number of layers along the z-direction
-
initFixed
private void initFixed(int l, int lz) Populate the lattice with a larger interaction range than the von-Neumann stencil, with fixed boundaries.- Parameters:
l- side length of the latticelz- number of layers along the z-direction- See Also:
-
initToroidal
private void initToroidal(int l, int lz) Populate the lattice with a larger interaction range than the von-Neumann stencil, with toroidal wrapping.- Parameters:
l- side length of the latticelz- number of layers along the z-direction- See Also:
-
linkNeighboursAt
private void linkNeighboursAt(int aPlayer, int bOffset, int min, int max, int l, boolean interspecies) Links all neighbors in the specified range [min, max] around bOffset to aPlayer.- Parameters:
aPlayer- the player to link frombOffset- the base offset for the target playersmin- the minimum index offsetmax- the maximum index offsetl- the side length of the latticeinterspecies- whether to allow self-links
-
checkSettings
protected boolean checkSettings()Description copied from class:AbstractGeometryHook for subclasses to implement geometry specific checks.- Overrides:
checkSettingsin classAbstractGeometry- Returns:
trueif adjustments require a reset
-