Interface ContinuousGeneratorODE<TShared, TInternal>

This interface defines the functionality of a continuous time model without delays, which can be used by ContinuousSystem to initialise and update particles.

interface ContinuousGeneratorODE<TShared, TInternal> {
    getZeroEvery(shared: TShared): ZeroEvery;
    initial(
        time: number,
        shared: TShared,
        internal: TInternal,
        stateNext: number[],
        random: Random,
    ): void;
    internal(shared: TShared): TInternal;
    output(t: number, y: number[]): number[];
    packingState(shared: TShared): Packer;
    rhs(t: number, y: number[], dydt: number[]): void;
    update(
        time: number,
        dt: number,
        state: number[],
        shared: TShared,
        internal: TInternal,
        stateNext: number[],
        random: Random,
    ): void;
    updateShared(shared: TShared, newShared: TShared): void;
}

Type Parameters

  • TShared

    Values which are shared between all particles in a group and are not mutated by them - the model parameter values for that group

  • TInternal

    Internal state values which can be mutated by generators, used to improve efficiency of the system by e.g. caching calculation results for use by other particles.

Hierarchy (View Summary)

Methods

  • Sets the initial state of a particle.

    Parameters

    • time: number

      The current time at which to initialise particle state

    • shared: TShared

      The shared parameter values used by the particle's group

    • internal: TInternal

      The internal state used by the particle's group

    • stateNext: number[]

      The array of values which should be updated by the generator with initial particle state values

    • random: Random

      A random number generator which may be used by the generator to initialise values

    Returns void

  • Compute additional quantities that are derived from the variables. Unlike rhs, this returns a vector rather than writing in place. Not all models include an output method - these models have no output.

    Parameters

    • t: number

      The time to compute initial conditions at

    • y: number[]

      The value of the variables

    Returns number[]

  • Compute the derivatives

    Parameters

    • t: number

      The time to compute initial conditions at

    • y: number[]

      The value of the variables

    • dydt: number[]

      An array that will be written into, will hold derivatives on exit. Must be the same length as y

    Returns void

  • Updates the state of a particle from its previous state.

    Parameters

    • time: number

      The new time to which the particle state should be updated.

    • dt: number

      The time step from the current time to the new time

    • state: number[]

      The current state of the particle

    • shared: TShared

      The shared parameter values used by the particle's group

    • internal: TInternal

      The internal state used by the particle's group

    • stateNext: number[]

      The array of values which should be updated by the generator with new particle state values

    • random: Random

      A random number generator which may be used by the generator to update values

    Returns void