Class KineticsDemoView

All Implemented Interfaces:
edu.cnu.mdi.feedback.IFeedbackProvider, edu.cnu.mdi.sim.ISimulationHost, edu.cnu.mdi.sim.SimulationListener, edu.cnu.mdi.transfer.IFileDropHandler, ActionListener, ComponentListener, FocusListener, MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class KineticsDemoView extends SimulationView3D
3D kinetic-gas demo hosted in the MDI simulation framework.

Key design point: the simulation thread owns the physics and the model. The view updates OpenGL/Swing state only from engine refresh callbacks on the EDT.

See Also:
  • Field Details

    • DEFAULT_PARTICLE_COUNT

      public static final int DEFAULT_PARTICLE_COUNT
      See Also:
    • DEFAULT_VOLUME_FRACTION

      public static final float DEFAULT_VOLUME_FRACTION
      See Also:
    • DEFAULT_INITIAL_TEMP

      public static final float DEFAULT_INITIAL_TEMP
      See Also:
  • Constructor Details

    • KineticsDemoView

      public KineticsDemoView()
      Construct the kinetics demo view using its canonical default properties.
    • KineticsDemoView

      public KineticsDemoView(Properties props)
      Construct the kinetics demo view using the supplied properties.
      Parameters:
      props - the properties used to configure the view
    • KineticsDemoView

      public KineticsDemoView(Object... keyVals)
      Legacy compatibility constructor using alternating key/value pairs.
      Parameters:
      keyVals - alternating property key/value pairs
  • Method Details

    • getConfiguration

      public static edu.cnu.mdi.view.ViewConfiguration<KineticsDemoView> getConfiguration()
      Get the lazy-creation configuration for this view.
      Returns:
      the view configuration for lazy creation
    • getViewInfo

      public edu.cnu.mdi.view.AbstractViewInfo getViewInfo()
      Overrides:
      getViewInfo in class edu.cnu.mdi.view.BaseView
    • make3DPanel

      protected Panel3D make3DPanel(float angleX, float angleY, float angleZ, float xDist, float yDist, float zDist)
      Description copied from class: PlainView3D
      Create the 3D panel for this view.
      Specified by:
      make3DPanel in class PlainView3D
      Parameters:
      angleX - initial x rotation angle
      angleY - initial y rotation angle
      angleZ - initial z rotation angle
      xDist - initial camera x offset
      yDist - initial camera y offset
      zDist - initial camera z offset
      Returns:
      the created 3D panel
    • createKineticsView

      public static KineticsDemoView createKineticsView()
      Compatibility factory to build the view with its standard defaults.

      Newer code should generally prefer new KineticsDemoView().

      Returns:
      a new default-configured kinetics view
    • onSimulationReady

      protected void onSimulationReady(edu.cnu.mdi.sim.SimulationContext ctx)
      Description copied from class: SimulationView3D
      Called when the simulation becomes ready to run.
      Overrides:
      onSimulationReady in class SimulationView3D
      Parameters:
      ctx - simulation context
    • onSimulationRun

      protected void onSimulationRun(edu.cnu.mdi.sim.SimulationContext ctx)
      Description copied from class: SimulationView3D
      Called when the simulation starts or restarts running.
      Overrides:
      onSimulationRun in class SimulationView3D
      Parameters:
      ctx - simulation context
    • onSimulationRefresh

      protected void onSimulationRefresh(edu.cnu.mdi.sim.SimulationContext ctx)
      Description copied from class: SimulationView3D
      Called on every engine refresh request, immediately before this class repaints or refreshes the 3D panel in response.
      Overrides:
      onSimulationRefresh in class SimulationView3D
      Parameters:
      ctx - simulation context
    • onSimulationStateChange

      protected void onSimulationStateChange(edu.cnu.mdi.sim.SimulationContext ctx, edu.cnu.mdi.sim.SimulationState from, edu.cnu.mdi.sim.SimulationState to, String reason)
      Description copied from class: SimulationView3D
      Called whenever the simulation transitions between states, after any pending engine reset triggered by SimulationView3D.requestEngineReset(java.util.function.Supplier<edu.cnu.mdi.sim.Simulation>, java.util.function.Consumer<edu.cnu.mdi.sim.SimulationEngine>, boolean, boolean) has been applied.
      Overrides:
      onSimulationStateChange in class SimulationView3D
      Parameters:
      ctx - simulation context
      from - the state being left
      to - the state being entered
      reason - human-readable reason for the transition, or null
    • getSimulation

      public KineticsSimulation getSimulation()
      Helper method to get the simulation instance with the correct type.
      Returns:
      the kinetics simulation
    • getModel

      public KineticsModel getModel()
      Helper method to get the model instance with the correct type.
      Returns:
      the kinetics model
    • getEntropyPanel

      public EntropyPlotPanel getEntropyPanel()
      Helper method to get the diagnostics panel with the correct type.
      Returns:
      the entropy plot panel
    • requestReset

      public void requestReset()
      Reset the demo back to its default parameters.

      This requests a safe engine reset: if running, it will stop and swap the engine once the current simulation terminates.