Class SolarIntegrator

java.lang.Object
  extended byIntegrator
      extended byRK4
          extended bySolarIntegrator
All Implemented Interfaces:
java.lang.Runnable

public class SolarIntegrator
extends RK4

SolarIntegrator is a subclass of the abstract RK4 class. It implements a function method which represents the mathematical representation of my simplified solar system. (about 90 coupled differential equations :)


Field Summary
 
Fields inherited from class Integrator
steps, x, x0, x1, y, y0
 
Constructor Summary
SolarIntegrator(SpaceObject[] o, double t0, double t1, PointN startPoint, int steps)
          Constructs a SolarIntegrator for performing numerical integration.
 
Method Summary
 Point function(double time, Point n)
          represents the mathematical behaviour of my simplified solar system.
 double getDistance(SpaceObject s, double x, double y, double z)
          calculates the distance of a SpaceObject s from a certain position in 3D.
 Point integrate()
          Method for numerical integration.
 java.lang.String toString()
          This method is NOT USED!!!
 
Methods inherited from class Integrator
getIV, getLocation, run, setEnd, setSteps
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SolarIntegrator

public SolarIntegrator(SpaceObject[] o,
                       double t0,
                       double t1,
                       PointN startPoint,
                       int steps)
Constructs a SolarIntegrator for performing numerical integration.

Parameters:
o - arry of SpaceObjects in the system.
t0 - start time of integration (in seconds as I only use SI units).
t1 - stop time of integration.
startPoint - has to be a huge list where the first three entries are the sun coordinates, the next three the sun velocities, and then it is repeating this patter with all planets, following the order: sun -> outwards until Neptun.
steps - number of integration steps between start and stop time
Method Detail

integrate

public Point integrate()
Method for numerical integration.

Overrides:
integrate in class RK4
Returns:
a Point object which contains the new (after the integration) position and velocities of all space objects. Starting with the sun's positions and velocities, then mercury's and so on until neptuns positions and velocities.

function

public Point function(double time,
                      Point n)
represents the mathematical behaviour of my simplified solar system. ~about 90 coupled differential equations, but which is actually just calculating the new velocities and accelerations of each SpaceObject. (i.e. differentiating with respect to time)

Specified by:
function in class Integrator
Parameters:
time - a time step.
n - a Point object holding current positions and velocities.
Returns:
a Point object which contains the velocieties and accelerations of all space objects. Starting with the sun's velocities and accelerations, then mercury's and so on until neptun's.

getDistance

public double getDistance(SpaceObject s,
                          double x,
                          double y,
                          double z)
calculates the distance of a SpaceObject s from a certain position in 3D.

Parameters:
s - a SpaceObject.
x - cartesian x coordinate of a point in 3D.
y - cartesian y coordinate of a point in 3D.
z - cartesian z coordinate of a point in 3D.
Returns:
the distace beetween the SpaceObject s and the point in 3D.

toString

public java.lang.String toString()
This method is NOT USED!!! only implementet because the abstract super class RK4 has it and there fore it is necessary to implement it -> otherwise compiler error!.

Specified by:
toString in class Integrator
Returns:
a empty String.