Class CubicGeometry


public class CubicGeometry extends AbstractLattice
Cubic lattice geometry (3D) with optional fixed boundaries.
  • Constructor Details

    • CubicGeometry

      public CubicGeometry(EvoLudo engine)
      Create a cubic-lattice geometry tied to the given engine.
      Parameters:
      engine - EvoLudo pacemaker
  • Method Details

    • parse

      public boolean parse(String arg)
      Description copied from class: AbstractGeometry
      Parse geometry-specific CLI options.
      Overrides:
      parse in class AbstractGeometry
      Parameters:
      arg - the argument string without the geometry key
      Returns:
      true if parsing succeeded, false if 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:
      init in class AbstractGeometry
    • 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 lattice
      lz - 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 lattice
      lz - 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 permitted
      z - layer offset
      up - index offset of the layer above
      down - index offset of the layer below
      l - 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 node
      z - layer offset
      y - row offset within the layer
      x - 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 permitted
      z - layer offset
      up - index offset of the layer above
      down - index offset of the layer below
      l - 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 lattice
      lz - 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 lattice
      lz - 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 lattice
      lz - 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 from
      bOffset - the base offset for the target players
      min - the minimum index offset
      max - the maximum index offset
      l - the side length of the lattice
      interspecies - whether to allow self-links
    • checkSettings

      protected boolean checkSettings()
      Description copied from class: AbstractGeometry
      Hook for subclasses to implement geometry specific checks.
      Overrides:
      checkSettings in class AbstractGeometry
      Returns:
      true if adjustments require a reset