Class DustState

Matrix-like object representing the state of a dust model at a single point in time (vs a 3d-array like object DustStateTime. This object exists to simplify thinking about accessing different parts of the data, as primitives for doing this don't really exist in JavaScript. It also leaves us free to swap out the underling storage later (currently using ndarray)

Hierarchy

  • DustState

Constructors

  • new DustState(data: NdArray<number[] | TypedArray | GenericArray<number>>, nState: number, nParticles: number): DustState
  • Construct a new object - generally prefer dustState which also allocates the data correctly

    Parameters

    • data: NdArray<number[] | TypedArray | GenericArray<number>>

      The underlying data

    • nState: number

      The number of state elements per particle

    • nParticles: number

      The number of particles

    Returns DustState

Properties

nParticles: number

The number of particles

nState: number

The number of state elements per particle

state: NdArray<number[] | TypedArray | GenericArray<number>>

The underling state

Methods

  • asMatrix(): number[][]
  • Create a matrix of particle states. The ith element of the returned matrix is the state of the ith particle, itself a vector of length nState. This is a copy of the underlying data, decoupled from the state.

    Returns number[][]

  • getParticle(iParticle: number): number[]
  • Copy the state for a single vector into a plain JavaScript numeric array. This will then be decoupled from the underlying object

    Parameters

    • iParticle: number

      The index of the particle to fetch

    Returns number[]

  • getState(iState: number): number[]
  • Copy a single state across all variables into a plain JavaScript numeric array. This will then be decoupled from the underlying object

    Parameters

    • iState: number

      The index of the state to fetch

    Returns number[]

  • Construct a VectorView for a single particle. This can then be easily read from or written to.

    Parameters

    • iParticle: number

      The index of the particle to fetch

    Returns VectorView

  • Construct a VectorView for a single state, across all particles. This can then be easily read from or written to.

    Parameters

    • iState: number

      The index of the state to fetch

    Returns VectorView

Generated using TypeDoc