org.gicentre.utils.network.traer.physics

## Class RungeKuttaIntegrator

- java.lang.Object
- - org.gicentre.utils.network.traer.physics.Integrator
  - - org.gicentre.utils.network.traer.physics.RungeKuttaIntegrator

- Direct Known Subclasses:
    SettlingRungeKuttaIntegrator

      public class RungeKuttaIntegrator
      extends Integrator

  Class capable of performing Runge Kutta integration. Compared to the Euler integrators, this one is slower but is more stable.
  Version:
    3.4, 5th February, 2016.
  Author:
    Carl Pearson, Jeffrey Traer Bernstein and minor modifications by Jo Wood.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.gicentre.utils.network.traer.physics.Integrator

      `Integrator.METHOD`

  - ### Field Summary

    - ### Fields inherited from class org.gicentre.utils.network.traer.physics.Integrator

      `s`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RungeKuttaIntegrator(ParticleSystem s)` Sets up the integrator to be used by the given particle system.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `allocateParticles()` Instantiates the original positions and velocities of the particles.
    `protected static Function<Particle,?>` | `kApplier(java.util.Map<Particle,Vector3D> kForces, java.util.Map<Particle,Vector3D> kVelocities, java.util.Map<Particle,Vector3D> originalPositions, java.util.Map<Particle,Vector3D> originalVelocities, float deltaT)` Provides the function that applies the single increment of the particles' positions and velocities.
    `protected static Function<Particle,?>` | `kFunctor(java.util.Map<Particle,Vector3D> kForces, java.util.Map<Particle,Vector3D> kVelocities)` Provides the function capable of performing the integration.
    `RungeKuttaIntegrator` | `step(float deltaT)` Performs the incrementing of the particles' positions and velocities over the given time step.
    `protected Function<Particle,?>` | `updater(java.util.Map<Particle,Vector3D> k1f, java.util.Map<Particle,Vector3D> k1v, java.util.Map<Particle,Vector3D> k2f, java.util.Map<Particle,Vector3D> k2v, java.util.Map<Particle,Vector3D> k3f, java.util.Map<Particle,Vector3D> k3v, java.util.Map<Particle,Vector3D> k4f, java.util.Map<Particle,Vector3D> k4v, java.util.Map<Particle,Vector3D> oPos, java.util.Map<Particle,Vector3D> oVel, float deltaT)` Provides the function that updates the particles in the system.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RungeKuttaIntegrator

          public RungeKuttaIntegrator(ParticleSystem s)

      Sets up the integrator to be used by the given particle system.
      Parameters:
        `s` - Particle system upon which to perform the integration.

  - ### Method Detail

    - #### kFunctor

          protected static final Function<Particle,?> kFunctor(java.util.Map<Particle,Vector3D> kForces,
                                                               java.util.Map<Particle,Vector3D> kVelocities)

      Provides the function capable of performing the integration.
      Parameters:
        `kForces` - Forces to be applied to particles during integration.
        `kVelocities` - Velocities of particles.
      Returns:
        The function that performs the integration.

    - #### kApplier

          protected static final Function<Particle,?> kApplier(java.util.Map<Particle,Vector3D> kForces,
                                                               java.util.Map<Particle,Vector3D> kVelocities,
                                                               java.util.Map<Particle,Vector3D> originalPositions,
                                                               java.util.Map<Particle,Vector3D> originalVelocities,
                                                               float deltaT)

      Provides the function that applies the single increment of the particles' positions and velocities.
      Parameters:
        `kForces` - Forces associated with the particles/
        `kVelocities` - Velocities of the particles.
        `originalPositions` - The original positions of the particles before integration.
        `originalVelocities` - The original velocities of the particles before integration.
        `deltaT` - Time step over which to move the particles.
      Returns:
        The function that increments the particles.

    - #### updater

          protected Function<Particle,?> updater(java.util.Map<Particle,Vector3D> k1f,
                                                 java.util.Map<Particle,Vector3D> k1v,
                                                 java.util.Map<Particle,Vector3D> k2f,
                                                 java.util.Map<Particle,Vector3D> k2v,
                                                 java.util.Map<Particle,Vector3D> k3f,
                                                 java.util.Map<Particle,Vector3D> k3v,
                                                 java.util.Map<Particle,Vector3D> k4f,
                                                 java.util.Map<Particle,Vector3D> k4v,
                                                 java.util.Map<Particle,Vector3D> oPos,
                                                 java.util.Map<Particle,Vector3D> oVel,
                                                 float deltaT)

      Provides the function that updates the particles in the system.
      Parameters:
        `k1f` - K1 force.
        `k1v` - K1 velocity.
        `k2f` - K2 force.
        `k2v` - K2 velocity.
        `k3f` - K3 force.
        `k3v` - K3 velocity.
        `k4f` - K4 force.
        `k4v` - K4 velocity.
        `oPos` - Original position.
        `oVel` - Original velocity.
        `deltaT` - Change in time units.
      Returns:
        Function that updates the particle positions.

    - #### allocateParticles

          protected final void allocateParticles()

      Instantiates the original positions and velocities of the particles. This has the side-effect of clearing all forces on particles.

    - #### step

          public RungeKuttaIntegrator step(float deltaT)

      Performs the incrementing of the particles' positions and velocities over the given time step.
      Specified by:
        `step` in class `Integrator`
      Parameters:
        `deltaT` - Time step over which to update the particles.
      Returns:
        The integrator that updates the system.