Class SquareGeometry

Direct Known Subclasses:
MooreGeometry, SecondNeighbourGeometry, VonNeumannGeometry

public class SquareGeometry extends AbstractLattice
Square lattice with arbitrary neighbourhood sizes. Provides shared helpers for square-based variants.
  • Constructor Details

    • SquareGeometry

      public SquareGeometry(EvoLudo engine)
      Create a square 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
    • warnIfConnectivityProvided

      protected void warnIfConnectivityProvided(String numeric)
      Emit a warning if the user attempts to specify connectivity for a fixed stencil.
      Parameters:
      numeric - connectivity string passed on the CLI
    • init

      public void init()
      Generates square regular lattices with arbitrary neighbourhood sizes. Variant-specific initializers for standard stencils are available to subclasses.

      Requirements/notes:

      1. Population size must be a perfect square \(N=n^2\).
      2. Admissible connectivities are \(4\) (von Neumann) or \((2m+1)^2-1\) for Moore-type stencils.
      3. Inter-species interactions add the focal node as a neighbour and allow connectivity \(1\).
      4. Boundaries are periodic by default but can be fixed.
      Specified by:
      init in class AbstractGeometry
    • prepareSquareLattice

      protected int prepareSquareLattice()
      Common setup for square geometries.
      Returns:
      the computed side length of the lattice
    • initSquareSelf

      protected void initSquareSelf(int side, int fullside, int offset)
      Initialize a square lattice that only connects nodes to themselves (used when connectivity equals one).
      Parameters:
      side - side length of the (sub) lattice
      fullside - global side length
      offset - index offset into the population
    • initSquare

      protected void initSquare(int side, int fullside, int offset)
      Initialize a square lattice with arbitrary (odd) neighbourhood sizes.
      Parameters:
      side - side length of the (sub) lattice
      fullside - global side length
      offset - index offset into the population
    • adjustBoundaries

      private void adjustBoundaries(int range, int side, int fullside, int offset, boolean interspecies)
      Adjust arbitrary-range neighbourhoods along fixed boundaries.
      Parameters:
      range - interaction range
      side - side length of the (sub) lattice
      fullside - global side length
      offset - index offset into the population
      interspecies - true if self-links are required
    • ensureSquareSize

      protected boolean ensureSquareSize(boolean requireEvenSide)
      Enforce square lattice size and optionally even side lengths.
      Parameters:
      requireEvenSide - true if the side length must be even
      Returns:
      true if the size had to be adjusted
    • 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