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

java.lang.Object
  extended by net.algart.model3d.common.movement.model.AbstractMovementIntegrator
      extended by net.algart.model3d.common.movement.model.EulerMovementIntegrator
All Implemented Interfaces:
MovementIntegrator

public class EulerMovementIntegrator
extends AbstractMovementIntegrator

The simplest implementation of the MovementIntegrator interface, based on the classic Euler method for solving Cauchy problem.

More precisely, let the coordinates and velocities of all items at the current moment tn be described by the vector wn, and we want to find the coordinates and velocities wn+1 at the next moment tn+1=tnt — see comments to MovementIntegrator. This class uses the following formula:

wn+1 = wn + Δt f(tn, wn)

where f(t, w) is the vector function, calculating the derivatives dw/dt of coordinates and velocities w and, so, describing interaction of items (the product Δt f(tn, wn) is calculated by calculateLeftSide method).

This class does not support estimation of the maximal and mean errors: isErrorInformationAvailable() method returns false, maxLastCoordinateError(), meanLastCoordinateError(), maxLastVelocityError(), meanLastVelocityError() methods return Double.NaN.

Please see comments fo MovementIntegrator interface about multithreading usage.

AlgART Laboratory 2010

Since:
JDK 1.5
Version:
1.0
Author:
Daniel Alievsky

Field Summary
Modifier and Type Field and Description
 
Fields inherited from class net.algart.model3d.common.movement.model.AbstractMovementIntegrator
countOfCheckedNeighbours, countOfProcessedInteractions, countOfProcessedItems, countOfProcessedSymmetricInteractions, n
 
Method Summary
Modifier and Type Method and Description
static EulerMovementIntegrator getEulerIntegrator(ItemSet itemSet, java.util.Collection<InteractionRule> interactionRules, double deltaT)
          Creates new instance of this class.
 void performIteration()
          Performs one iteration of integration.
protected  void preprocess()
          Performs necessary preprocessing before an iteration, in particular, reallocate all necessary work memory.
 java.lang.String toString()
          Returns a brief string description of this object.
 
Methods inherited from class net.algart.model3d.common.movement.model.AbstractMovementIntegrator
calculateLeftSide, calculateLeftSide, copyBasicSettings, getAccelerationLimit, getCounterOfCheckedNeighbours, getCounterOfProcessedInteractions, getCounterOfProcessedItems, getCounterOfProcessedSymmetricInteractions, getDeltaT, getInteractionRules, getItemSet, getNumberOfParallelTasks, getT, getVelocityLimit, getViscousForces, isErrorInformationAvailable, maxLastCoordinateError, maxLastVelocityError, meanLastCoordinateError, meanLastVelocityError, resetCounters, setAccelerationLimit, setDeltaT, setNumberOfParallelTasks, setT, setVelocityLimit, setViscousForces
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getEulerIntegrator

public static EulerMovementIntegrator getEulerIntegrator(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 set of interaction rules, used by this class.
deltaT - the time step Δt.
Returns:
new instance of this class.
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.

performIteration

public 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
Specified by:
performIteration in class AbstractMovementIntegrator

preprocess

protected void preprocess()
Description copied from class: AbstractMovementIntegrator
Performs necessary preprocessing before an iteration, in particular, reallocate all necessary work memory. This method must be called in the beginning of AbstractMovementIntegrator.performIteration() method and before any call of AbstractMovementIntegrator.calculateLeftSide(double[], double[], double[], double[], double[], double[], double) or AbstractMovementIntegrator.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 AbstractMovementIntegrator.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.

Overrides:
preprocess in class AbstractMovementIntegrator

toString

public java.lang.String toString()
Returns a brief string description of this object.

The result of this method may depend on implementation.

Overrides:
toString in class java.lang.Object
Returns:
a brief string description of this object.