Class PDEInitialize

Object
ODEInitialize
PDEInitialize

class PDEInitialize extends ODEInitialize
Helper class responsible for initializing spatial density fields for PDE based simulations in the EvoLudo framework.

PDEInitialize encapsulates a particular initialization "type" (uniform, random, localized shapes, Gaussian, ring, etc.), a background density vector, an optional dependent-component index and an RNG for randomized initial configurations. It provides a single entry point init(double[][]) that fills a preallocated two-dimensional density array where each row corresponds to the state vector at a lattice site.

Concepts and inputs

  • density - destination array of shape [space.getSize()][nDim]; each row receives the initial density vector for a spatial location.
  • y0 - baseline initial state vector (peak or default densities) used for the selected initialization pattern.
  • background - background density vector used for locations outside the initialized region (e.g. outside a circle or square).
  • dependent - index of a dependent component (or -1 if none). When set, several initialization modes perform a correction and normalization so the dependent component and the total density are consistent (e.g. for frequency-based models).
  • rng - random number generator used for RANDOM initializations.

Supported initialization types

The class supports the following patterns via the inner PDEInitialize.Type enum: UNIFORM, RANDOM, PERTURBATION, SQUARE, CIRCLE, GAUSSIAN (sombrero) and RING. The chosen type determines how y0 and background are applied across the lattice: globally, randomly, locally (centered square/circle), or using radially/gaussian-scaled profiles.

Usage

Construct an instance with the desired PDEInitialize.Type, background vector, dependent index and RNG (if needed), then call init(double[][]) to populate the simulation density array prior to starting integration or discrete updates.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Types of initial configurations.

    Nested classes/interfaces inherited from class ODEInitialize

    ODEInitialize.InitType
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final PDE
    Owning PDE model providing geometry and background data.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an initializer tied to the supplied PDE model.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) void
    apply(int x, int l, double[] y0, double[][] dest)
    Applies the initialization for GeometryType.LINEAR.
    (package private) void
    apply(int x, int y, int l, double[] y0, double[][] dest)
    Applies the initialization for GeometryType.SQUARE and variants.
    (package private) void
    apply(int x, int y, int z, int l, int lz, double[] y0, double[][] dest)
    Applies the initialization for GeometryType.CUBE.
    void
    init(double[][] density)
    Initialize the density array according to the configured type.
    private void
    initFunction(double[][] density, double[] y0, AbstractGeometry space)
    Dispatch initialization based on the dimensionality of the geometry.
    private void
    initFunction1D(double[][] density, double[] y0, AbstractGeometry space)
    Initialization for GeometryType.LINEAR geometries extracted to reduce complexity.
    private void
    initFunction2D(double[][] density, double[] y0, AbstractGeometry space)
    Initialization for square/triangular/hexagonal lattice geometries extracted to reduce cognitive complexity.
    private void
    initFunction3D(double[][] density, double[] y0, AbstractGeometry space)
    Initialization for GeometryType.CUBE geometries extracted to reduce complexity.
    private void
    initPerturbation(double[][] density, double[] y0, AbstractGeometry space)
    Initialize a uniform background with a single perturbed site at the center.
    private void
    initRandom(double[][] density, double[] y0, AbstractGeometry space)
    Initialize each site independently at random (normalized if needed).
    private void
    initUniform(double[][] density, double[] y0, AbstractGeometry space)
    Initialize every lattice point with the same state.
    private void
    scaleDensity(double[] y0, double scale, double[] d)
    Helper method to scale the density vector d by the scalar factor scale.

    Methods inherited from class ODEInitialize

    init, parse

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • pde

      private final PDE pde
      Owning PDE model providing geometry and background data.
  • Constructor Details

    • PDEInitialize

      PDEInitialize(PDE pde)
      Create an initializer tied to the supplied PDE model.
      Parameters:
      pde - owning PDE
  • Method Details

    • init

      public void init(double[][] density)
      Initialize the density array according to the configured type.
      Parameters:
      density - per-node trait densities to fill
    • initUniform

      private void initUniform(double[][] density, double[] y0, AbstractGeometry space)
      Initialize every lattice point with the same state.
      Parameters:
      density - per-node density buffer to populate
      y0 - base state vector copied to each node
      space - simulation geometry describing the lattice size
    • initPerturbation

      private void initPerturbation(double[][] density, double[] y0, AbstractGeometry space)
      Initialize a uniform background with a single perturbed site at the center.
      Parameters:
      density - per-node density buffer to populate
      y0 - perturbed state vector applied to the central node
      space - simulation geometry describing the lattice
    • initRandom

      private void initRandom(double[][] density, double[] y0, AbstractGeometry space)
      Initialize each site independently at random (normalized if needed).
      Parameters:
      density - per-node density buffer to populate
      y0 - base amplitudes for random sampling
      space - simulation geometry describing the lattice size
    • initFunction

      private void initFunction(double[][] density, double[] y0, AbstractGeometry space)
      Dispatch initialization based on the dimensionality of the geometry.
      Parameters:
      density - per-node density buffer to populate
      y0 - peak density vector for the localized shapes
      space - simulation geometry describing the lattice
    • initFunction3D

      private void initFunction3D(double[][] density, double[] y0, AbstractGeometry space)
      Initialization for GeometryType.CUBE geometries extracted to reduce complexity.
      Parameters:
      density - per-node density buffer to populate
      y0 - peak density vector for the localized shape
      space - simulation geometry describing the lattice
    • initFunction1D

      private void initFunction1D(double[][] density, double[] y0, AbstractGeometry space)
      Initialization for GeometryType.LINEAR geometries extracted to reduce complexity.
      Parameters:
      density - per-node density buffer to populate
      y0 - peak density vector for the localized shape
      space - simulation geometry describing the lattice
    • initFunction2D

      private void initFunction2D(double[][] density, double[] y0, AbstractGeometry space)
      Initialization for square/triangular/hexagonal lattice geometries extracted to reduce cognitive complexity.
      Parameters:
      density - per-node density buffer to populate
      y0 - peak density vector for the localized shape
      space - simulation geometry describing the lattice
    • apply

      void apply(int x, int l, double[] y0, double[][] dest)
      Applies the initialization for GeometryType.LINEAR.
      Parameters:
      x - the x coordinate
      l - the linear length of the lattice
      y0 - the initial state
      dest - the destination array
    • apply

      void apply(int x, int y, int l, double[] y0, double[][] dest)
      Applies the initialization for GeometryType.SQUARE and variants.
      Parameters:
      x - the x coordinate
      y - the y coordinate
      l - the linear length of the lattice
      y0 - the initial state
      dest - the destination array
    • apply

      void apply(int x, int y, int z, int l, int lz, double[] y0, double[][] dest)
      Applies the initialization for GeometryType.CUBE.
      Parameters:
      x - the x coordinate
      y - the y coordinate
      z - the z coordinate
      l - the linear length of the lattice
      lz - the linear height of the lattice (lz == l except for NOVA)
      y0 - the initial state
      dest - the destination array
    • scaleDensity

      private void scaleDensity(double[] y0, double scale, double[] d)
      Helper method to scale the density vector d by the scalar factor scale. The scalar must lie in \((0, 1)\) such that the initial densities/frequencies represent the maximum.
      Parameters:
      y0 - the initial density vector
      scale - the scaling factor
      d - the location to store the scaled density