glvis icon indicating copy to clipboard operation
glvis copied to clipboard

Refactoring to remove global state

Open publixsubfan opened this issue 3 years ago • 3 comments

This PR is intended to split off some of the work from #149 into a somewhat-smaller PR.

  • Adds a new class, GLVisWindow, which consolidates most of the global state within aux_vis.cpp. GLVisWindow handles creation of the SdlWindow, VisualizationScene*, and GLVisCommand objects from a StreamState object and/or an array of input streams.
  • Make VisualizationScene* event handlers member functions where possible, removing dependence on global pointers.
  • Remove most references to global objects from the core glvis library.
  • Move handling of multiplexing of GLVisCommand and other idle function runs from SdlWindow to GLVisWindow.

publixsubfan avatar May 12 '21 23:05 publixsubfan

I can now build and run the js version but there is at least on thing that isn't working yet. I saw that the CallKeySequence call was moved from aux_js.cpp:startVisualization into aux_vis.cpp:InitVisualization (which is called in aux_js.cpp:startVisualization) but it doesn't seem to work, when I open ex9 I see this:

Screen Shot 2021-06-01 at 5 47 14 PM

Instead of this:

Screen Shot 2021-06-01 at 5 47 31 PM

I'll spend some more time debugging.

tomstitt avatar Jun 02 '21 00:06 tomstitt

The JS target seems to work well for me now, I slacked a copy to @tzanio and @kanye-quest so check it out if you want

tomstitt avatar Jun 13 '21 20:06 tomstitt

All other examples from glvis.org/live work for me, but I still get an error with Navier in this branch, e.g. the following run:

./glvis -saved ~/glvis-web/src/data/navier.saved

shows

Screen Shot 2021-06-15 at 5 18 24 PM

instead of

Screen Shot 2021-06-15 at 5 18 39 PM

tzanio avatar Jun 16 '21 00:06 tzanio