ptolemy.domains.ct.kernel
Class CTBaseIntegrator.History

java.lang.Object
  extended byptolemy.domains.ct.kernel.CTBaseIntegrator.History
Enclosing class:
CTBaseIntegrator

protected class CTBaseIntegrator.History
extends java.lang.Object

The history information, state and derivatives, at equidistance past time points. This inner class is protect so that it can be tested.


Constructor Summary
CTBaseIntegrator.History(CTBaseIntegrator container)
          Construct the history.
 
Method Summary
 void clear()
          Remove all history information.
 int getCapacity()
          Return the maximum capacity.
 double[] getEntry(int index)
          Return the index-th entry in the history.
 int getValidEntryCount()
          Return the number of valid entries.
 void pushEntry(double state, double derivative)
          Push the new state-derivative pair into the history.
 void rebalance(double currentStepSize)
          Rebalance the history information with respect to the current step size, such that the information in the history list are equally distanced, and the distance is the current step size.
 void setCapacity(int capacity)
          Set the history capacity.
 double[][] toDoubleArray()
          Return the history information in an array format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CTBaseIntegrator.History

public CTBaseIntegrator.History(CTBaseIntegrator container)
Construct the history.

Method Detail

clear

public void clear()
Remove all history information.


getCapacity

public int getCapacity()
Return the maximum capacity.

Returns:
The capacity.

getValidEntryCount

public int getValidEntryCount()
Return the number of valid entries.

Returns:
The number of valid history entries.

getEntry

public double[] getEntry(int index)
Return the index-th entry in the history. The index starts from 0. If the current time index is n, then calling this method with argument 0 will return the history of time index n-1.

Parameters:
index - The index of the entry.
Returns:
The double matrix storing the index-th state and its derivative in history.

pushEntry

public void pushEntry(double state,
                      double derivative)
               throws IllegalActionException
Push the new state-derivative pair into the history. If the number of entries exceeds the capacity after the pushing , then the oldest entry will be lost.

Parameters:
state - The state.
derivative - THe derivative of the state.
Throws:
IllegalActionException - If the capacity of history is less than or equal to zero.

rebalance

public void rebalance(double currentStepSize)
Rebalance the history information with respect to the current step size, such that the information in the history list are equally distanced, and the distance is the current step size. If the current step size is less than the history step size used in the history list, then a 4-th order Hermite interpolation is used for every two consecutive points. If the current step size is larger than the history step size, then a linear extrapolation is used.

Parameters:
currentStepSize - The current step size.

setCapacity

public void setCapacity(int capacity)
Set the history capacity. The entries exceed the capacity will be lost. If the argument is less than 0, it is set to 0.

Parameters:
capacity - The new capacity.

toDoubleArray

public double[][] toDoubleArray()
Return the history information in an array format. The entries are ordered in their backward chronological order.

Returns:
The content of the history information in a double array format.