Class AizawaModel

java.lang.Object
edu.cnu.mdi.mdi3D.view3D.aizawaDemo.AizawaModel

public class AizawaModel extends Object
Numerical model for the five-parameter Aizawa attractor.

This class owns the complete evolving state of the attractor and performs numerical integration using Apache Commons Math.

Design notes

  • This class contains no UI code.
  • The simulation thread is expected to call update().
  • The EDT is expected to call getSnapshot().
  • For simplicity, snapshot publication uses a copied packed coordinate array.

Trajectory storage

The trajectory is stored internally in a packed float array:

 [x1, y1, z1, x2, y2, z2, ..., xn, yn, zn]
 

If a maximum point count is enforced and the trajectory exceeds that size, the oldest point is discarded by shifting the packed array left by one point. This is simple and adequate for demo-scale simulations.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    Default RK4 time step.
    static final int
    Default initial trajectory buffer capacity, in points.
    static final int
    Default maximum number of trajectory points to retain.
    static final int
    Default number of integration substeps per simulation update.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a model using default equations, step size, and history length.
    AizawaModel(AizawaEquations equations, double[] initialState, double dt, int substepsPerUpdate, int maxTrailPoints, int initialCapacity)
    Construct a model with the supplied configuration.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Get the RK4 time step.
    Get the equations object used by this model.
    int
    Get the maximum number of retained trail points.
    int
    Get the current number of points in the trajectory.
    Get the most recently published snapshot.
    double[]
    Get a copy of the current state vector.
    int
    Get the number of RK4 substeps taken during each simulation update.
    double
    Get the current simulation time.
    void
    Reset the model to the standard default initial state.
    void
    reset(double[] initialState)
    Reset the model to the provided initial state.
    void
    Advance the model by one simulation update.

    Methods inherited from class java.lang.Object

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

    • DEFAULT_DT

      public static final double DEFAULT_DT
      Default RK4 time step.
      See Also:
    • DEFAULT_SUBSTEPS_PER_UPDATE

      public static final int DEFAULT_SUBSTEPS_PER_UPDATE
      Default number of integration substeps per simulation update.
      See Also:
    • DEFAULT_MAX_TRAIL_POINTS

      public static final int DEFAULT_MAX_TRAIL_POINTS
      Default maximum number of trajectory points to retain.
      See Also:
    • DEFAULT_INITIAL_CAPACITY

      public static final int DEFAULT_INITIAL_CAPACITY
      Default initial trajectory buffer capacity, in points.
      See Also:
  • Constructor Details

    • AizawaModel

      public AizawaModel()
      Construct a model using default equations, step size, and history length.
    • AizawaModel

      public AizawaModel(AizawaEquations equations, double[] initialState, double dt, int substepsPerUpdate, int maxTrailPoints, int initialCapacity)
      Construct a model with the supplied configuration.
      Parameters:
      equations - the Aizawa equations object; must not be null
      initialState - initial state as [x, y, z]; must contain at least three values
      dt - RK4 step size; values less than or equal to zero are replaced by DEFAULT_DT
      substepsPerUpdate - number of RK4 substeps per update; values less than 1 are promoted to 1
      maxTrailPoints - maximum retained history length in points; values less than or equal to zero mean unbounded
      initialCapacity - initial internal buffer capacity in points; values less than 2 are promoted to 2
  • Method Details

    • reset

      public void reset(double[] initialState)
      Reset the model to the provided initial state.
      Parameters:
      initialState - initial state as [x, y, z]
    • reset

      public void reset()
      Reset the model to the standard default initial state.
    • update

      public void update()
      Advance the model by one simulation update.

      Each call performs substepsPerUpdate RK4 substeps of size dt. After each substep, the new point is appended to the trajectory.

    • getSnapshot

      public AizawaSnapshot getSnapshot()
      Get the most recently published snapshot.

      This method is side-effect free and intended for use by the EDT.

      Returns:
      the latest snapshot
    • getEquations

      public AizawaEquations getEquations()
      Get the equations object used by this model.
      Returns:
      the equations object
    • getDt

      public double getDt()
      Get the RK4 time step.
      Returns:
      the RK4 time step
    • getSubstepsPerUpdate

      public int getSubstepsPerUpdate()
      Get the number of RK4 substeps taken during each simulation update.
      Returns:
      substeps per update
    • getMaxTrailPoints

      public int getMaxTrailPoints()
      Get the maximum number of retained trail points.
      Returns:
      maximum trail point count, or a value less than or equal to zero if unbounded
    • getPointCount

      public int getPointCount()
      Get the current number of points in the trajectory.
      Returns:
      current point count
    • getTime

      public double getTime()
      Get the current simulation time.
      Returns:
      current time
    • getStateCopy

      public double[] getStateCopy()
      Get a copy of the current state vector.
      Returns:
      current state as [x, y, z]