Class Integrator

java.lang.Object
  extended byIntegrator
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
RK4

public abstract class Integrator
extends java.lang.Object
implements java.lang.Runnable

Integrator is an abstract class which can be subclassed to create any kind of numerical integrator. All calculations are performed using Points enabling any dimension of problem to be solved without rewriting either this superclass or any its subclasses.


Field Summary
protected  int steps
          The number of steps being used for the integration.
protected  double x
          Current value of the independent variable that the integration is begin performed with respect to.
protected  double x0
          Initial value of the independent variable that the integration is begin performed with respect to.
protected  double x1
          Final value of the independent variable that the integration is begin performed with respect to.
protected  Point y
          Current state of the system being integrated.
protected  Point y0
          Initial state of the system being integrated.
 
Constructor Summary
Integrator(double xStart, double xEnd, Point yStart, int steps)
          Constructor to instantiate Integrator - never called directly.
 
Method Summary
abstract  Point function(double x, Point y)
          Method to calculate the required function which defines the problem being integrated.
 double getIV()
          Method used to return the current value of the independent variable.
 Point getLocation()
          Method used to return the current state of the system.
abstract  Point integrate()
          Abstract method which performs the numerical integration, implemented by any subclass of Integrator.
 void run()
          Method used to start a new thread performing the integration.
 void setEnd(double x1)
          Method used to reset the final value of the independent variable used in the numerical integration.
 void setSteps(int steps)
          Method used to reset the number of steps used in the numerical integration.
abstract  java.lang.String toString()
          Abstract method to return the problem being integrated in human readable form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x0

protected final double x0
Initial value of the independent variable that the integration is begin performed with respect to.


x1

protected double x1
Final value of the independent variable that the integration is begin performed with respect to.


x

protected double x
Current value of the independent variable that the integration is begin performed with respect to.


y0

protected final Point y0
Initial state of the system being integrated.


y

protected Point y
Current state of the system being integrated.


steps

protected int steps
The number of steps being used for the integration.

Constructor Detail

Integrator

public Integrator(double xStart,
                  double xEnd,
                  Point yStart,
                  int steps)
Constructor to instantiate Integrator - never called directly.

Method Detail

integrate

public abstract Point integrate()
Abstract method which performs the numerical integration, implemented by any subclass of Integrator.


function

public abstract Point function(double x,
                               Point y)
Method to calculate the required function which defines the problem being integrated. This is calculated with respect to the independent variable x and perhaps wrt the Point y but this depends on the problem, e.g. an equation of motion integration would require the derivative of the Point y wrt x. This is abstract and must be implemented by the instance subclass of Integrator.


toString

public abstract java.lang.String toString()
Abstract method to return the problem being integrated in human readable form.


getLocation

public Point getLocation()
Method used to return the current state of the system. Used by the Display class in package compsim3.display.


getIV

public double getIV()
Method used to return the current value of the independent variable. Used by the Display class in package compsim3.display.


setSteps

public void setSteps(int steps)
Method used to reset the number of steps used in the numerical integration.


setEnd

public void setEnd(double x1)
Method used to reset the final value of the independent variable used in the numerical integration.


run

public void run()
Method used to start a new thread performing the integration. used by the display class in package compsim3.display.

Specified by:
run in interface java.lang.Runnable