org.apache.commons.math.ode
Class TestProblemAbstract

java.lang.Object
  extended by org.apache.commons.math.ode.TestProblemAbstract
All Implemented Interfaces:
org.apache.commons.math.ode.FirstOrderDifferentialEquations
Direct Known Subclasses:
TestProblem1, TestProblem2, TestProblem3, TestProblem4, TestProblem6

public abstract class TestProblemAbstract
extends Object
implements org.apache.commons.math.ode.FirstOrderDifferentialEquations

This class is used as the base class of the problems that are integrated during the junit tests for the ODE integrators.


Field Summary
protected  int calls
          Number of functions calls.
protected  double[] errorScale
          Error scale
protected  int n
          Dimension of the problem.
protected  double t0
          Initial time
protected  double t1
          Final time
protected  double[] y0
          Initial state
 
Constructor Summary
protected TestProblemAbstract()
          Simple constructor.
protected TestProblemAbstract(TestProblemAbstract problem)
          Copy constructor.
 
Method Summary
 void computeDerivatives(double t, double[] y, double[] yDot)
           
abstract  double[] computeTheoreticalState(double t)
          Compute the theoretical state at the specified time.
abstract  TestProblemAbstract copy()
          Copy operation.
abstract  void doComputeDerivatives(double t, double[] y, double[] yDot)
           
 int getCalls()
          Get the number of calls.
 int getDimension()
           
 double[] getErrorScale()
          Get the error scale.
 org.apache.commons.math.ode.events.EventHandler[] getEventsHandlers()
          Get the events handlers.
 double getFinalTime()
          Get the final time.
 double[] getInitialState()
          Get the initial state vector.
 double getInitialTime()
          Get the initial time.
protected  void setErrorScale(double[] errorScale)
          Set the error scale
protected  void setFinalConditions(double t1)
          Set the final conditions.
protected  void setInitialConditions(double t0, double[] y0)
          Set the initial conditions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

n

protected int n
Dimension of the problem.


calls

protected int calls
Number of functions calls.


t0

protected double t0
Initial time


y0

protected double[] y0
Initial state


t1

protected double t1
Final time


errorScale

protected double[] errorScale
Error scale

Constructor Detail

TestProblemAbstract

protected TestProblemAbstract()
Simple constructor.


TestProblemAbstract

protected TestProblemAbstract(TestProblemAbstract problem)
Copy constructor.

Parameters:
problem - problem to copy
Method Detail

copy

public abstract TestProblemAbstract copy()
Copy operation.

Returns:
a copy of the instance

setInitialConditions

protected void setInitialConditions(double t0,
                                    double[] y0)
Set the initial conditions

Parameters:
t0 - initial time
y0 - initial state vector

setFinalConditions

protected void setFinalConditions(double t1)
Set the final conditions.

Parameters:
t1 - final time

setErrorScale

protected void setErrorScale(double[] errorScale)
Set the error scale

Parameters:
errorScale - error scale

getDimension

public int getDimension()
Specified by:
getDimension in interface org.apache.commons.math.ode.FirstOrderDifferentialEquations

getInitialTime

public double getInitialTime()
Get the initial time.

Returns:
initial time

getInitialState

public double[] getInitialState()
Get the initial state vector.

Returns:
initial state vector

getFinalTime

public double getFinalTime()
Get the final time.

Returns:
final time

getErrorScale

public double[] getErrorScale()
Get the error scale.

Returns:
error scale

getEventsHandlers

public org.apache.commons.math.ode.events.EventHandler[] getEventsHandlers()
Get the events handlers.

Returns:
events handlers

getCalls

public int getCalls()
Get the number of calls.

Returns:
nuber of calls

computeDerivatives

public void computeDerivatives(double t,
                               double[] y,
                               double[] yDot)
Specified by:
computeDerivatives in interface org.apache.commons.math.ode.FirstOrderDifferentialEquations

doComputeDerivatives

public abstract void doComputeDerivatives(double t,
                                          double[] y,
                                          double[] yDot)

computeTheoreticalState

public abstract double[] computeTheoreticalState(double t)
Compute the theoretical state at the specified time.

Parameters:
t - time at which the state is required
Returns:
state vector at time t


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.