Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Float64ArrayIO.applyState #149

Open
samreid opened this issue Jul 29, 2020 · 0 comments
Open

Use Float64ArrayIO.applyState #149

samreid opened this issue Jul 29, 2020 · 0 comments

Comments

@samreid
Copy link
Member

samreid commented Jul 29, 2020

WOASModelIO currently has:

  static applyState( model, stateObject ) {
    validate( model, this.validator );

    // We make an assumption about Float64ArrayIO's serialization here, so that we don't create temporary garbage
    // Float64Arrays. Instead we set the array values directly.
    model.yDraw.set( stateObject.private.yDraw );
    model.yNow.set( stateObject.private.yNow );
    model.yLast.set( stateObject.private.yLast );
    model.yNext.set( stateObject.private.yNext );

    model.yNowChangedEmitter.emit();
  }

But it seems these should leverage Float64IO.applyState, like so:

  static applyState( model, stateObject ) {
    validate( model, this.validator );

    // We make an assumption about Float64ArrayIO's serialization here, so that we don't create temporary garbage
    // Float64Arrays. Instead we set the array values directly.
    Float64ArrayIO.applyState( model.yDraw, stateObject.private.yDraw );
    // ...
    
    model.yNowChangedEmitter.emit();
  }

@zepumph can you please take a look?

@zepumph zepumph removed their assignment Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants