Class AizawaModel
java.lang.Object
edu.cnu.mdi.mdi3D.view3D.aizawaDemo.AizawaModel
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
FieldsModifier and TypeFieldDescriptionstatic final doubleDefault RK4 time step.static final intDefault initial trajectory buffer capacity, in points.static final intDefault maximum number of trajectory points to retain.static final intDefault number of integration substeps per simulation update. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct 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 TypeMethodDescriptiondoublegetDt()Get the RK4 time step.Get the equations object used by this model.intGet the maximum number of retained trail points.intGet the current number of points in the trajectory.Get the most recently published snapshot.double[]Get a copy of the current state vector.intGet the number of RK4 substeps taken during each simulation update.doublegetTime()Get the current simulation time.voidreset()Reset the model to the standard default initial state.voidreset(double[] initialState) Reset the model to the provided initial state.voidupdate()Advance the model by one simulation update.
-
Field Details
-
DEFAULT_DT
public static final double DEFAULT_DTDefault RK4 time step.- See Also:
-
DEFAULT_SUBSTEPS_PER_UPDATE
public static final int DEFAULT_SUBSTEPS_PER_UPDATEDefault number of integration substeps per simulation update.- See Also:
-
DEFAULT_MAX_TRAIL_POINTS
public static final int DEFAULT_MAX_TRAIL_POINTSDefault maximum number of trajectory points to retain.- See Also:
-
DEFAULT_INITIAL_CAPACITY
public static final int DEFAULT_INITIAL_CAPACITYDefault 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 nullinitialState- initial state as[x, y, z]; must contain at least three valuesdt- RK4 step size; values less than or equal to zero are replaced byDEFAULT_DTsubstepsPerUpdate- number of RK4 substeps per update; values less than 1 are promoted to 1maxTrailPoints- maximum retained history length in points; values less than or equal to zero mean unboundedinitialCapacity- 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
substepsPerUpdateRK4 substeps of sizedt. After each substep, the new point is appended to the trajectory. -
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
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]
-