public abstract class NumericalIntegrator extends Object implements IThreadAware
Modifier | Constructor and Description |
---|---|
protected |
NumericalIntegrator()
Initializes a new instance.
|
protected |
NumericalIntegrator(NumericalIntegrator existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
Modifier and Type | Method and Description |
---|---|
abstract Object |
clone(CopyContext context)
Create a copy of this integrator.
|
abstract double |
getCurrentStepSize()
Gets the current (positive) size of the step which the integrator will use for the next integration step.
|
int |
getDimension()
|
IntegrationSense |
getDirection()
Gets whether to integrate forward, increasing the independent variable, or backward,
decreasing the independent variable.
|
double[] |
getFinalDependentVariableValues()
Gets the values of the dependent variables resulting from the last integration step.
|
double |
getFinalIndependentVariableValue()
Gets the value of the independent variable after an integration step.
|
double[] |
getInitialDependentVariableValues()
Gets the values of the dependent variables prior to an integration step.
|
double |
getInitialIndependentVariableValue()
Gets the value of the independent variable prior to an integration step.
|
double |
getInitialStepSize()
|
boolean |
getIsThreadSafe()
Gets a value indicating whether the methods on this instance are safe to call from
multiple threads simultaneously.
|
double |
getPreviousStepSize()
Gets the size of the last step taken by the integrator.
|
StepSizeInformation |
getStepSizeInformation()
|
DependentVariableDerivatives |
getSystemOfEquations()
Gets the system of differential equations corresponding to the derivatives of the
dependent variables.
|
void |
initialize(double x,
double[] y)
Initialize the integrator's initial independent and dependent variables and reset the integration parameters.
|
void |
integrate()
Perform an integration step moving the independent and dependent variables from their
initial (the final values of the previous step) to their new final values,
using the
CurrentStepSize (get ). |
void |
integrate(double stepSize)
Perform an integration step moving the independent and dependent variables from their
initial (the final values of the previous step) to their new final values.
|
abstract void |
reintegrate(double stepSize)
Repeats the last integration of the differential equations.
|
void |
setDirection(IntegrationSense value)
Sets whether to integrate forward, increasing the independent variable, or backward,
decreasing the independent variable.
|
protected void |
setFinalDependentVariableValues(double[] value)
Sets the values of the dependent variables resulting from the last integration step.
|
protected void |
setFinalIndependentVariableValue(double value)
Sets the value of the independent variable after an integration step.
|
protected void |
setInitialDependentVariableValues(double[] value)
Sets the values of the dependent variables prior to an integration step.
|
protected void |
setInitialIndependentVariableValue(double value)
Sets the value of the independent variable prior to an integration step.
|
void |
setInitialStepSize(double value)
|
protected void |
setStepSizeInformation(StepSizeInformation value)
|
void |
setSystemOfEquations(DependentVariableDerivatives value)
Sets the system of differential equations corresponding to the derivatives of the
dependent variables.
|
protected void |
startNextStep()
This performs the task of setting the Initial values to the previous Final values prior to taking the next step.
|
protected NumericalIntegrator()
protected NumericalIntegrator(@Nonnull NumericalIntegrator existingInstance, @Nonnull CopyContext context)
See ICloneWithContext.clone(CopyContext)
for more information about how to implement this constructor
in a derived class.
existingInstance
- The existing instance to copy.context
- A CopyContext
that controls the depth of the copy.ArgumentNullException
- Thrown when existingInstance
or context
is null
.public abstract Object clone(CopyContext context)
clone
in interface ICloneWithContext
context
- The context in which to create the copy.public final boolean getIsThreadSafe()
If this property is true
, all methods and properties are guaranteed to be thread safe.
Conceptually, an object that returns true
for this method acts as if there is a lock
protecting each method and property such that only one thread at a time can be inside any method or
property in the class. In reality, such locks are generally not used and are in fact discouraged. However,
the user must not experience any exceptions or inconsistent behavior that would not be experienced if such
locks were used.
If this property is false
, the behavior when using this class from multiple threads
simultaneously is undefined and may include inconsistent results and exceptions. Clients wishing to use
multiple threads should call CopyForAnotherThread.copy(T)
to get a separate instance of the
object for each thread.
getIsThreadSafe
in interface IThreadAware
public final DependentVariableDerivatives getSystemOfEquations()
public final void setSystemOfEquations(DependentVariableDerivatives value)
public final int getDimension()
@Nonnull public final IntegrationSense getDirection()
public final void setDirection(@Nonnull IntegrationSense value)
@Nonnull public final StepSizeInformation getStepSizeInformation()
protected final void setStepSizeInformation(@Nonnull StepSizeInformation value)
public final double getInitialStepSize()
public final void setInitialStepSize(double value)
public final double getPreviousStepSize()
public abstract double getCurrentStepSize()
public final double getInitialIndependentVariableValue()
protected final void setInitialIndependentVariableValue(double value)
public final double[] getInitialDependentVariableValues()
protected final void setInitialDependentVariableValues(double[] value)
public final double getFinalIndependentVariableValue()
protected final void setFinalIndependentVariableValue(double value)
public final double[] getFinalDependentVariableValues()
protected final void setFinalDependentVariableValues(double[] value)
public void integrate()
Perform an integration step moving the independent and dependent variables from their
initial (the final values of the previous step) to their new final values,
using the CurrentStepSize
(get
).
When overriding this method, NumericalIntegrator.startNextStep()
should be called prior to
integration.
public void integrate(double stepSize)
Perform an integration step moving the independent and dependent variables from their initial (the final values of the previous step) to their new final values.
When overriding this method, NumericalIntegrator.startNextStep()
should be called prior to
integration. Also note that the CurrentStepSize
(get
)
property should be unaffected by the stepSize
parameter.
public abstract void reintegrate(double stepSize)
Repeats the last integration of the differential equations.
When overriding this method, note that the CurrentStepSize
(get
)
property should be unaffected by the stepSize
parameter.
protected void startNextStep()
public void initialize(double x, @Nonnull double[] y)
x
- The value of the initial independent variable.y
- The values for the initial dependent variables.