jmathlib
Class AbstractOdeSolver

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--jmathlib.AbstractOdeSolver
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
EulerCauchyOdeSolver, EulerOdeSolver, ModifiedEulerOdeSolver, RK4OdeSolver

public abstract class AbstractOdeSolver
extends java.lang.Thread

A class to solve x'(t) = f(t,x) ODE's Concrete implementation of this class must override at least 'computeSolution' and 'function' methods. - 'computeSolution' is called by this Thread's run method - 'function' is normally called by the concrete implementation of 'computeSolution'


Field Summary
protected  double currentTime
          The current value of variable 't'
protected  boolean killed
          if true, algorithm terminates immediately
protected  java.util.Vector listenerList
          a list of listeners to be notified signals during algorithm run-time
protected  int npts
          The number of values to be computed
protected  Curve results
          A Vector that stores computation results, each element being an array of double of type {t,x_1(t),...
protected  int sleepTime
          How long the thread sleeps between each step (allowing the user to adjust the simulation's speed) If 0 (the default), the thread just yields.
protected  double tend
          The ODE's solution end time
protected  double tstart
          The ODE's solution start time
protected  double[] x0
          The initial condition X(0)[]
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AbstractOdeSolver(double tstart, double tend, double[] x0, int npts)
           
 
Method Summary
 void addSignalListener(SignalListener listener)
          registers a SignalListener to receive SignalEvent during algorithm run-time note : this method tries to mimic javax.swing.EventListener as much as possible, (seeing that swing classes ain't accessible easily from an applet).
abstract  void computeSolution()
          ODE solver algorithm
 void fireSignal(SignalEvent event)
          fires the given DrawingEvent to all registered DrawingListener's
abstract  double[] function(double t, double[] x)
          Right-hand side of ODE x' = f(x,t)
 double getCurrentTime()
           
abstract  java.lang.String getDescription()
           
 Curve getResults()
           
 void kill()
           
 void removeSignalListener(SignalListener listener)
           
 void run()
          Thread.run() method Mustn't be overriden by end-user...
 void setSleepingTime(int sleep)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tstart

protected double tstart
The ODE's solution start time

tend

protected double tend
The ODE's solution end time

x0

protected double[] x0
The initial condition X(0)[]

npts

protected int npts
The number of values to be computed

results

protected Curve results
A Vector that stores computation results, each element being an array of double of type {t,x_1(t),...,x_N(t)}

currentTime

protected double currentTime
The current value of variable 't'

sleepTime

protected int sleepTime
How long the thread sleeps between each step (allowing the user to adjust the simulation's speed) If 0 (the default), the thread just yields.

killed

protected boolean killed
if true, algorithm terminates immediately

listenerList

protected java.util.Vector listenerList
a list of listeners to be notified signals during algorithm run-time
Constructor Detail

AbstractOdeSolver

public AbstractOdeSolver(double tstart,
                         double tend,
                         double[] x0,
                         int npts)
Parameters:
tstart - The ODE's solution start time
tend - The ODE's solution end time
x0 - The initial condition X(0)[]
npts - The number of points to be computed ; defaults to 100 if npts = 0
Method Detail

getCurrentTime

public double getCurrentTime()
Returns:
The current value of variable 't'

getResults

public Curve getResults()
Returns:
The solution X(t) stored in a Vector of (N+1)-elements arrays ([0]->t, [1]->x_1(t), ..., [N]->x_N(t))

setSleepingTime

public void setSleepingTime(int sleep)
Parameters:
sleepin'time - between each step in ms

run

public void run()
Thread.run() method Mustn't be overriden by end-user...
Overrides:
run in class java.lang.Thread

kill

public void kill()

addSignalListener

public void addSignalListener(SignalListener listener)
registers a SignalListener to receive SignalEvent during algorithm run-time note : this method tries to mimic javax.swing.EventListener as much as possible, (seeing that swing classes ain't accessible easily from an applet).

removeSignalListener

public void removeSignalListener(SignalListener listener)

fireSignal

public void fireSignal(SignalEvent event)
fires the given DrawingEvent to all registered DrawingListener's

computeSolution

public abstract void computeSolution()
ODE solver algorithm

function

public abstract double[] function(double t,
                                  double[] x)
Right-hand side of ODE x' = f(x,t)

getDescription

public abstract java.lang.String getDescription()
Returns:
A brief description of the algorithm used by this ODE solver


jmathlib/ABMOdeSolver.java