net.algart.model3d.common.movement.model
Class AbstractMovementIntegrator

java.lang.Object
  extended by net.algart.model3d.common.movement.model.AbstractMovementIntegrator
All Implemented Interfaces:
MovementIntegrator
Direct Known Subclasses:
EulerMovementIntegrator, RungeKuttaMovementIntegrator

public abstract class AbstractMovementIntegrator
extends java.lang.Object
implements MovementIntegrator

A skeletal implementation of the MovementIntegrator interface to minimize the effort required to implement this interface.

All non-abstract methods of this class, excepting performIteration(), are completely implemented and usually should not be overridden. Also this class offers protected methods

simplifying implementation of performIteration() method.

This class, by default, does not support estimation of the maximal and mean errors: isErrorInformationAvailable() method returns false, maxLastCoordinateError(), meanLastCoordinateError(), maxLastVelocityError(), meanLastVelocityError() methods return Double.NaN. But inheritors of this class can add this feature but overriding these methods.

AlgART Laboratory 2010

Since:
JDK 1.5
Version:
1.0
Author:
Daniel Alievsky

Field Summary
Modifier and Type Field and Description
protected  java.util.concurrent.atomic.AtomicLong countOfCheckedNeighbours
          The counter, returned by getCounterOfCheckedNeighbours() method.
protected  java.util.concurrent.atomic.AtomicLong countOfProcessedInteractions
          The counter, returned by getCounterOfProcessedInteractions() method.
protected  java.util.concurrent.atomic.AtomicLong countOfProcessedItems
          The counter, returned by getCounterOfProcessedItems() method.
protected  java.util.concurrent.atomic.AtomicLong countOfProcessedSymmetricInteractions
          The counter, returned by getCounterOfProcessedSymmetricInteractions() method.
protected  int n
          The current size of itemSet, calculated while the last call of preprocess() method.
 
Constructor Summary
Modifier Constructor and Description
protected AbstractMovementIntegrator(ItemSet itemSet, java.util.Collection<InteractionRule> interactionRules, double deltaT)
          Creates new instance of this class.
 
Method Summary
Modifier and Type Method and Description
protected  void calculateLeftSide(double[] resultDX, double[] resultDY, double[] resultDZ, double[] resultDVX, double[] resultDVY, double[] resultDVZ, double deltaT)
          Calculates the left sides of the motion equations, integrated by this object, multiplied by the passed deltaTt argument.
protected  void calculateLeftSide(double[] resultDX, double[] resultDY, double[] resultDZ, double[] resultDVX, double[] resultDVY, double[] resultDVZ, double deltaT, int threadIndex, int fromIndex, int toIndex)
          An analog of the full calculateLeftSide(double[], double[], double[], double[], double[], double[], double) method, which processes only the specified range of items.
 void copyBasicSettings(MovementIntegrator source)
          Copies all basic settings, that can be accessed via getXxx/setXxx methods of this interface, from the specified object.
 double getAccelerationLimit()
          Returns the acceleration limit Amax.
 long getCounterOfCheckedNeighbours()
          Returns the internal thread-safe counter of "neighbour" item pairs, which were checked by MovementIntegrator.performIteration() method while calculation of the right side of the motion equations.
 long getCounterOfProcessedInteractions()
          Returns the internal thread-safe counter of really interacted item pairs, which were really processed by MovementIntegrator.performIteration() method while calculation of the right side of the motion equations, that is for which calculateForce method was really called and returned true.
 long getCounterOfProcessedItems()
          Returns the internal thread-safe counter of items, which were processed by MovementIntegrator.performIteration() method while calculation of the right side of the motion equations.
 long getCounterOfProcessedSymmetricInteractions()
          An analog of the counter MovementIntegrator.getCounterOfProcessedInteractions(), counting only pairs, which were processed in more efficient way thanks to symmetric interaction rules.
 double getDeltaT()
          Returns the time step Δt for one iteration of integration.
 java.util.List<InteractionRule> getInteractionRules()
          Returns the list of interaction rules, used by this object.
 ItemSet getItemSet()
          Returns the item set, processed by this object.
 int getNumberOfParallelTasks()
          Returns the current number of parallel threads, which is recommended this object to use for optimizing calculations on multiprocessor systems.
 double getT()
          Returns the current time t in the physical model.
 double getVelocityLimit()
          Returns the velocity limit Vmax.
 boolean getViscousForces()
          Returns true if this object works in the mode of viscous forces.
 boolean isErrorInformationAvailable()
          Returns true if this implementation allows to estimate the maximal and mean error of calculating coordinates and velocities.
 double maxLastCoordinateError()
          Returns the estimation of the maximal error of calculating coordinates while the previous MovementIntegrator.performIteration() call, if this implementation supports this feature, or Double.NaN in other case.
 double maxLastVelocityError()
          Returns the estimation of the maximal error of calculating velocities while the previous MovementIntegrator.performIteration() call, if this implementation supports this feature, or Double.NaN in other case.
 double meanLastCoordinateError()
          Returns the estimation of the average error of calculating coordinates while the previous MovementIntegrator.performIteration() call, if this implementation supports this feature, or Double.NaN in other case.
 double meanLastVelocityError()
          Returns the estimation of the average error of calculating velocities while the previous MovementIntegrator.performIteration() call, if this implementation supports this feature, or Double.NaN in other case.
abstract  void performIteration()
          Performs one iteration of integration.
protected  void preprocess()
          Performs necessary preprocessing before an iteration, in particular, reallocate all necessary work memory.
 void resetCounters()
          Resets to 0 all internal counters, returned by MovementIntegrator.getCounterOfProcessedItems(), MovementIntegrator.getCounterOfCheckedNeighbours(), MovementIntegrator.getCounterOfProcessedInteractions() and MovementIntegrator.getCounterOfProcessedSymmetricInteractions() methods.
 void setAccelerationLimit(double accelerationLimit)
          Sets the acceleration limit Amax to the given value.
 void setDeltaT(double deltaT)
          Sets the current time Δt for one iteration of integration.
 void setNumberOfParallelTasks(int numberOfParallelTasks)
          Sets the number of parallel threads, which should be used, if possible, for optimizing calculations on multiprocessor systems.
 void setT(double t)
          Sets the current time t in the physical model.
 void setVelocityLimit(double velocityLimit)
          Sets the velocity limit Vmax to the given value.
 void setViscousForces(boolean viscousForces)
          Sets the mode of viscous forces ("pseudo-Newton's" motion equations), if the argument is true, or the usual mode (standard Newton's laws), if the argument is false See comments to this interface for more details.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

countOfProcessedItems

protected final java.util.concurrent.atomic.AtomicLong countOfProcessedItems
The counter, returned by getCounterOfProcessedItems() method. This counter is increased by calculateLeftSide(double[], double[], double[], double[], double[], double[], double, int, int, int) method.


countOfCheckedNeighbours

protected final java.util.concurrent.atomic.AtomicLong countOfCheckedNeighbours
The counter, returned by getCounterOfCheckedNeighbours() method. This counter is increased by calculateLeftSide(double[], double[], double[], double[], double[], double[], double, int, int, int) method.


countOfProcessedInteractions

protected final java.util.concurrent.atomic.AtomicLong countOfProcessedInteractions
The counter, returned by getCounterOfProcessedInteractions() method. This counter is increased by calculateLeftSide(double[], double[], double[], double[], double[], double[], double, int, int, int) method.


countOfProcessedSymmetricInteractions

protected final java.util.concurrent.atomic.AtomicLong countOfProcessedSymmetricInteractions
The counter, returned by getCounterOfProcessedSymmetricInteractions() method. This counter is increased by calculateLeftSide(double[], double[], double[], double[], double[], double[], double, int, int, int) method.


n

protected int n
The current size of itemSet, calculated while the last call of preprocess() method. After creating the object, this field contains 0.

Constructor Detail

AbstractMovementIntegrator

protected AbstractMovementIntegrator(ItemSet itemSet,
                                     java.util.Collection<InteractionRule> interactionRules,
                                     double deltaT)
Creates new instance of this class.

The itemSet argument is just stored in an internal field, and this reference will be returned by getItemSet() method. Unlike this, the interactionRules collection is copied into a newly created list: no references to it are maintained by the created object.

Parameters:
itemSet - the item set, which will be processed by this class.
interactionRules - the list of interaction rules, used by this class.
deltaT - the time step Δt.
Throws:
java.lang.NullPointerException - if one of the arguments is null or if one of interaction rules in the passed collection is null.
java.lang.IllegalArgumentException - if deltaT<0.
Method Detail

getItemSet

public ItemSet getItemSet()
Description copied from interface: MovementIntegrator
Returns the item set, processed by this object. Usually it is set while instantiation and cannot be changed in future. But you can change this item set by methods of ItemSet interface.

Specified by:
getItemSet in interface MovementIntegrator
Returns:
the reference to ItemSet object, processed by this object.

getInteractionRules

public java.util.List<InteractionRule> getInteractionRules()
Description copied from interface: MovementIntegrator
Returns the list of interaction rules, used by this object. Usually it is set while instantiation and cannot be changed in future.

The result is an immutable view (Collections.unmodifiableList) or a clone of the internal collection, stored by this object: you cannot modify the set of used interaction rules via the result of this method.

The elements of the returned list are never null.

Specified by:
getInteractionRules in interface MovementIntegrator
Returns:
the list of interaction rules, used by this object.

getNumberOfParallelTasks

public int getNumberOfParallelTasks()
Description copied from interface: MovementIntegrator
Returns the current number of parallel threads, which is recommended this object to use for optimizing calculations on multiprocessor systems.

The returned value is always positive (>0).

Specified by:
getNumberOfParallelTasks in interface MovementIntegrator
Returns:
the current number of parallel threads for multiprocessor optimization.

setNumberOfParallelTasks

public void setNumberOfParallelTasks(int numberOfParallelTasks)
Description copied from interface: MovementIntegrator
Sets the number of parallel threads, which should be used, if possible, for optimizing calculations on multiprocessor systems. This value should not be greater than the number of available processors or processor kernels.

If this argument is 0, it is automatically replaced with Runtime.getRuntime().availableProcessors(): the number of available processors. Note that in this case MovementIntegrator.getNumberOfParallelTasks() method will return not 0, but the actual number of available processors.

Specified by:
setNumberOfParallelTasks in interface MovementIntegrator
Parameters:
numberOfParallelTasks - the desired number of parallel threads for multiprocessor optimization.

getViscousForces

public boolean getViscousForces()
Description copied from interface: MovementIntegrator
Returns true if this object works in the mode of viscous forces. See comments to this interface for more details.

Specified by:
getViscousForces in interface MovementIntegrator
Returns:
whether this object works in the mode of viscous forces.

setViscousForces

public void setViscousForces(boolean viscousForces)
Description copied from interface: MovementIntegrator
Sets the mode of viscous forces ("pseudo-Newton's" motion equations), if the argument is true, or the usual mode (standard Newton's laws), if the argument is false See comments to this interface for more details.

Specified by:
setViscousForces in interface MovementIntegrator
Parameters:
viscousForces - whether you this object should be switched in the mode of viscous forces.

getAccelerationLimit

public double getAccelerationLimit()
Description copied from interface: MovementIntegrator
Returns the acceleration limit Amax. It can be Double.POSITIVE_INFINITY: it means that the accelerations are not limited. See comments to this interface for more details.

Specified by:
getAccelerationLimit in interface MovementIntegrator
Returns:
the acceleration limit Amax.

setAccelerationLimit

public void setAccelerationLimit(double accelerationLimit)
Description copied from interface: MovementIntegrator
Sets the acceleration limit Amax to the given value. You can pass Double.POSITIVE_INFINITY: it means that the accelerations will be not limited. See comments to this interface for more details.

Specified by:
setAccelerationLimit in interface MovementIntegrator
Parameters:
accelerationLimit - new acceleration limit Amax.

getVelocityLimit

public double getVelocityLimit()
Description copied from interface: MovementIntegrator
Returns the velocity limit Vmax. It can be Double.POSITIVE_INFINITY: it means that the velocities are not limited. See comments to this interface for more details.

Specified by:
getVelocityLimit in interface MovementIntegrator
Returns:
the velocity limit Amax.

setVelocityLimit

public void setVelocityLimit(double velocityLimit)
Description copied from interface: MovementIntegrator
Sets the velocity limit Vmax to the given value. You can pass Double.POSITIVE_INFINITY: it means that the velocities will be not limited. See comments to this interface for more details.

Specified by:
setVelocityLimit in interface MovementIntegrator
Parameters:
velocityLimit - new velocity limit Vmax.

getT

public double getT()
Description copied from interface: MovementIntegrator
Returns the current time t in the physical model. It is usually 0.0 after creating new object and automatically updated (increased by Δt) by MovementIntegrator.performIteration() method.

Specified by:
getT in interface MovementIntegrator
Returns:
the current time t.
See Also:
MovementIntegrator.getDeltaT()

setT

public void setT(double t)
Description copied from interface: MovementIntegrator
Sets the current time t in the physical model.

Specified by:
setT in interface MovementIntegrator
Parameters:
t - new value of the current time t.

getDeltaT

public double getDeltaT()
Description copied from interface: MovementIntegrator
Returns the time step Δt for one iteration of integration. It is usually specified while instantiating new object. It cannot be negative.

Specified by:
getDeltaT in interface MovementIntegrator
Returns:
the time step Δt.

setDeltaT

public void setDeltaT(double deltaT)
Description copied from interface: MovementIntegrator
Sets the current time Δt for one iteration of integration.

Specified by:
setDeltaT in interface MovementIntegrator
Parameters:
deltaT - new value of the time step Δt.

copyBasicSettings

public void copyBasicSettings(MovementIntegrator source)
Description copied from interface: MovementIntegrator
Copies all basic settings, that can be accessed via getXxx/setXxx methods of this interface, from the specified object. In other words, this method is equivalent to the following calls:
 setNumberOfParallelTasks(source.getNumberOfParallelTasks());
 setViscousForces(source.getViscousForces());
 setAccelerationLimit(source.getAccelerationLimit());
 setVelocityLimit(source.getVelocityLimit());
 setT(source.getT());
 setDeltaT(source.getDeltaT());
 

Specified by:
copyBasicSettings in interface MovementIntegrator
Parameters:
source - another movement integrator, the basic settings of which should be copied into this one.

getCounterOfProcessedItems

public long getCounterOfProcessedItems()
Description copied from interface: MovementIntegrator
Returns the internal thread-safe counter of items, which were processed by MovementIntegrator.performIteration() method while calculation of the right side of the motion equations.

Note that MovementIntegrator.performIteration() can calculate the right side of the equations several times (as in Runge-Kutta algorithms), and then every item will be also counted several times. Usually the items, which do not have coordinates of centers and velocities or do not have masses, are not counted.

This counter is 0 after creating new instance of this class and can be set to 0 by MovementIntegrator.resetCounters() method.

This method is provided for profiling and debugging needs only. It works as described above in the implementations, offered by this package, but there is no guarantee that it will return correct values in all implementations. If the implementation does not provide this counter, this method should return 0 always.

Specified by:
getCounterOfProcessedItems in interface MovementIntegrator
Returns:
the counter of processed items.

getCounterOfCheckedNeighbours

public long getCounterOfCheckedNeighbours()
Description copied from interface: MovementIntegrator
Returns the internal thread-safe counter of "neighbour" item pairs, which were checked by MovementIntegrator.performIteration() method while calculation of the right side of the motion equations. This number depends on the implementation of ItemSet interface: good implementations, like GridItemSet, allow to check only restricted number of items while finding all "neighbours" of the given item, which can interact with it.

Note that the "neighbour" pair is counted independently for both its elements. In other words, it two items act to each other, their pair is counter twice.

Note that MovementIntegrator.performIteration() can calculate the right side of the equations several times (as in Runge-Kutta algorithms), and then every neighbour item pair will be also counted several times.

This counter is 0 after creating new instance of this class and can be set to 0 by MovementIntegrator.resetCounters() method.

This method is provided for profiling and debugging needs only. It works as described above in the implementations, offered by this package, but there is no guarantee that it will return correct values in all implementations. If the implementation does not provide this counter, this method should return 0 always.

Specified by:
getCounterOfCheckedNeighbours in interface MovementIntegrator
Returns:
the counter of processed "neighbour" item pairs.

getCounterOfProcessedInteractions

public long getCounterOfProcessedInteractions()
Description copied from interface: MovementIntegrator
Returns the internal thread-safe counter of really interacted item pairs, which were really processed by MovementIntegrator.performIteration() method while calculation of the right side of the motion equations, that is for which calculateForce method was really called and returned true.

Note that an interacted pair is counted independently for both items. In other words, it two items act to each other, their pair is counter twice.

Note that an interacted pair is counted again for every interaction rule, applicable for this pair. So, if there are K>1 rules, in which calculateForce method returned true for the given pair, then this pair will be counted K times.

Note that MovementIntegrator.performIteration() can calculate the right side of the equations several times (as in Runge-Kutta algorithms), and then every neighbour item pair will be also counted several times.

This counter is 0 after creating new instance of this class and can be set to 0 by MovementIntegrator.resetCounters() method.

This method is provided for profiling and debugging needs only. It works as described above in the implementations, offered by this package, but there is no guarantee that it will return correct values in all implementations. If the implementation does not provide this counter, this method should return 0 always.

Specified by:
getCounterOfProcessedInteractions in interface MovementIntegrator
Returns:
the counter of processed really interacted item pairs.

getCounterOfProcessedSymmetricInteractions

public long getCounterOfProcessedSymmetricInteractions()
Description copied from interface: MovementIntegrator
An analog of the counter MovementIntegrator.getCounterOfProcessedInteractions(), counting only pairs, which were processed in more efficient way thanks to symmetric interaction rules. Namely, some implementations of this interface can use the fact, that some interaction is symmetric (implements SymmetricInteractionRule), and calculate the interaction force only once. The force F' of acting of the 2nd item to the 1st one is produced from the force F of acting of the 1st item to the 2nd one by changing the sign: F'=−F. In this case, the counter, returned by this method, is increased by 2 for each such interaction rule, as well as the counter, returned by MovementIntegrator.getCounterOfProcessedInteractions() method. But some "neighbour" item pairs cannot be processed in such a manner, for example, when the first item is processed (moved) by one processor in multiprocessor system and the second one is processed by another processor. In such situation, this counter is not increased, though the counter, returned by MovementIntegrator.getCounterOfProcessedInteractions() method, is increased by 2 (by 1 for each from two items). So, this method can help to measure optimization, achieved thanks to usage of symmetric interaction rules.

This counter is 0 after creating new instance of this class and can be set to 0 by MovementIntegrator.resetCounters() method.

This method is provided for profiling and debugging needs only. It works as described above in the implementations, offered by this package, but there is no guarantee that it will return correct values in all implementations. If the implementation does not provide this counter, this method should return 0 always.

Specified by:
getCounterOfProcessedSymmetricInteractions in interface MovementIntegrator
Returns:
the counter of processed really interacted item pairs, for which the interaction force was not calculated twice, because of using symmetric interaction rules.

resetCounters

public void resetCounters()
Description copied from interface: MovementIntegrator
Resets to 0 all internal counters, returned by MovementIntegrator.getCounterOfProcessedItems(), MovementIntegrator.getCounterOfCheckedNeighbours(), MovementIntegrator.getCounterOfProcessedInteractions() and MovementIntegrator.getCounterOfProcessedSymmetricInteractions() methods.

Specified by:
resetCounters in interface MovementIntegrator

performIteration

public abstract void performIteration()
Description copied from interface: MovementIntegrator
Performs one iteration of integration. This method sets the current time t to tt and correspondingly corrects the coordinates and velocities of all items in the processed item set, having centers and velocities and having masses, according to the motion equations. See comments to this interface for more details.

Specified by:
performIteration in interface MovementIntegrator

isErrorInformationAvailable

public boolean isErrorInformationAvailable()
Description copied from interface: MovementIntegrator
Returns true if this implementation allows to estimate the maximal and mean error of calculating coordinates and velocities. In this case, you can use MovementIntegrator.maxLastCoordinateError(), MovementIntegrator.meanLastCoordinateError(), MovementIntegrator.maxLastVelocityError(), MovementIntegrator.meanLastVelocityError() methods after every MovementIntegrator.performIteration() call to get this information. In other case, those methods return Double.NaN.

Specified by:
isErrorInformationAvailable in interface MovementIntegrator
Returns:
whether this implementation supports estimating the maximal and mean error of calculating coordinates and velocities.

maxLastCoordinateError

public double maxLastCoordinateError()
Description copied from interface: MovementIntegrator
Returns the estimation of the maximal error of calculating coordinates while the previous MovementIntegrator.performIteration() call, if this implementation supports this feature, or Double.NaN in other case.

Specified by:
maxLastCoordinateError in interface MovementIntegrator
Returns:
the estimation of the maximal error of calculating coordinates while the last integrating iteration.

maxLastVelocityError

public double maxLastVelocityError()
Description copied from interface: MovementIntegrator
Returns the estimation of the maximal error of calculating velocities while the previous MovementIntegrator.performIteration() call, if this implementation supports this feature, or Double.NaN in other case.

Specified by:
maxLastVelocityError in interface MovementIntegrator
Returns:
the estimation of the maximal error of calculating velocities while the last integrating iteration.

meanLastCoordinateError

public double meanLastCoordinateError()
Description copied from interface: MovementIntegrator
Returns the estimation of the average error of calculating coordinates while the previous MovementIntegrator.performIteration() call, if this implementation supports this feature, or Double.NaN in other case.

Specified by:
meanLastCoordinateError in interface MovementIntegrator
Returns:
the estimation of the average error of calculating coordinates while the last integrating iteration.

meanLastVelocityError

public double meanLastVelocityError()
Description copied from interface: MovementIntegrator
Returns the estimation of the average error of calculating velocities while the previous MovementIntegrator.performIteration() call, if this implementation supports this feature, or Double.NaN in other case.

Specified by:
meanLastVelocityError in interface MovementIntegrator
Returns:
the estimation of the average error of calculating velocities while the last integrating iteration.

calculateLeftSide

protected void calculateLeftSide(double[] resultDX,
                                 double[] resultDY,
                                 double[] resultDZ,
                                 double[] resultDVX,
                                 double[] resultDVY,
                                 double[] resultDVZ,
                                 double deltaT)
Calculates the left sides of the motion equations, integrated by this object, multiplied by the passed deltaTt argument. In other words, this method calculates the vector
Δt dw/dt = Δt f(t, w)

— see the concrete equation sets in comments to MovementIntegrator interface.

The left sides of the equations (multiplied by Δt) are stored in the passed Java arrays resultDX, resultDY, resultDZ, resultDVX, resultDVY, resultDVZ: the element #k of these arrays will contain, correspondingly, the values

Δt * dxk/dt,
Δt * dyk/dt,
Δt * dzk/dt,
Δt * dvxk/dt,
Δt * dvyk/dt,
Δt * dvzk/dt.

— the derivatives of coordinates and velocity components for the item itemSet.get(k). If the item #k does not implement both HavingVelocity and HavingMass interface, the corresponding elements of the passed array are filled by zero (0.0).

This method uses multithreading for optimizing calculations on multiprocessor system, it the desired number of parallel task is set to a value m >1 by setNumberOfParallelTasks(int) method. Namely, this method splits the item set into m ranges and calculates the derivatives for them in m parallel threads. Each range (or all item set in a case m=1) is processed by calculateLeftSide(double[], double[], double[], double[], double[], double[], double, int, int, int) method, which really performs all necessary calculations.

Note: this method does not use the current Δt, returned by getDeltaT() method, but uses the deltaT argument instead.

Note: this method uses some work memory, which must be allocated and correctly initialized by preprocess() method before calling this method. After preprocess() call, the item set should not be changed in any way, in other case this method will work incorrectly and even can throw an exception.

Parameters:
resultDX - array for storing dxk/dt * Δt values.
resultDY - array for storing dyk/dt * Δt values.
resultDZ - array for storing dzk/dt * Δt values.
resultDVX - array for storing dvxk/dt * Δt values.
resultDVY - array for storing dvyk/dt * Δt values.
resultDVZ - array for storing dvzk/dt * Δt values.
deltaT - Δt value.
Throws:
java.lang.NullPointerException - if one of passed arrays is null.
java.lang.IllegalArgumentException - if deltaT argument is negative (< 0.0).

calculateLeftSide

protected void calculateLeftSide(double[] resultDX,
                                 double[] resultDY,
                                 double[] resultDZ,
                                 double[] resultDVX,
                                 double[] resultDVY,
                                 double[] resultDVZ,
                                 double deltaT,
                                 int threadIndex,
                                 int fromIndex,
                                 int toIndex)
An analog of the full calculateLeftSide(double[], double[], double[], double[], double[], double[], double) method, which processes only the specified range of items. The range is specified by fromIndex and toIndex argument: if fills only the elements of resultDX, resultDY, resultDZ, resultDVX, resultDVY, resultDVZ arrays with indexes fromIndex<=k<toIndex.

The argument threadIndex, from 0 to getNumberOfParallelTasks()-1, specifies the index of the thread, which is executing this method, and is used for choosing a separate work memory for every thread while parallel execution. While single-thread execution, this argument should be 0.

This method is usually called from calculateLeftSide(double[], double[], double[], double[], double[], double[], double) method only.

Parameters:
resultDX - array for storing dxk/dt * Δt values.
resultDY - array for storing dyk/dt * Δt values.
resultDZ - array for storing dzk/dt * Δt values.
resultDVX - array for storing dvxk/dt * Δt values.
resultDVY - array for storing dvyk/dt * Δt values.
resultDVZ - array for storing dvzk/dt * Δt values.
deltaT - Δt value.
threadIndex - the index of thread, which calls this method.
fromIndex - start index of processed items, inclusive.
toIndex - end index of processed items, exclusive.
Throws:
java.lang.NullPointerException - if one of passed arrays is null.
java.lang.IllegalArgumentException - if deltaT argument is negative (< 0.0).
java.lang.IndexOutOfBoundsException - for illegal fromIndex and toIndex (fromIndex < 0 || toIndex > n || fromIndex > toIndex), or if threadIndex is out of 0..getNumberOfParallelTasks()-1 range.

preprocess

protected void preprocess()
Performs necessary preprocessing before an iteration, in particular, reallocate all necessary work memory. This method must be called in the beginning of performIteration() method and before any call of calculateLeftSide(double[], double[], double[], double[], double[], double[], double) or calculateLeftSide(double[], double[], double[], double[], double[], double[], double, int, int, int) methods, if the item set was corrected in any way after the last call of this method.

This implementation reallocates a temporary memory, used by calculateLeftSide(double[], double[], double[], double[], double[], double[], double, int, int, int) method, and calls itemSet.preprocess(). Please don't forget to call it from all overriding implementations.