glvis icon indicating copy to clipboard operation
glvis copied to clipboard

Refactoring with scripts and stream commands help

Open najlkin opened this issue 7 months ago • 4 comments

Refactored the code base, separating scripts handling and introducing a help for script commands (which can be placed on the website too). At the moment it is:

Available commands are: mesh <file> - Visualize the mesh. solution <mesh> <solution> - Visualize the solution. psolution <np> <mesh prefix> <keep attributes> <solution prefix> - Visualize the distributed solution. quadrature <mesh> <quadrature> - Visualize the quadrature. pquadrature <np> <mesh prefix> <keep attributes> <quadrature prefix> - Visualize the distributed quadrature. data_coll_mesh <type> <data coll> - Visualize the mesh from data collection. data_coll_field <type> <data coll> <field> - Visualize the field from data collection. data_coll_quad <type> <data coll> <quad> - Visualize the Q-field from data collection. data_coll_cycle <cycle> - Preset the cycle of the data collection. data_coll_protocol <protocol> - Preset the protocol of the data collection. screenshot <file> - Take a screenshot, saving it to the file. viewcenter <x> <y> - Change the viewcenter. perspective <on/off> - Turn on or off perspective projection. light <on/off> - Turn on or off light. view <theta> <phi> - Change the solid angle of view. zoom <zoom> - Change the zoom factor. shading <flat/smooth/cool> - Change the shading algorithm. subdivisions <times> <dummy> - Change the refinement level. valuerange <min> <max> - Change the value range. autoscale <off/on/value/mesh> - Change the autoscale algorithm. levellines <min> <max> <num> - Set the level lines. axis_numberformat '<format>' - Set the axis number format. colorbar_numberformat '<format>' - Set the colorbar number format. window <x> <y> <w> <h> - Set the position and size of the window. keys <key> - Send the control key sequence. palette <index> - Set the palette index. palette_repeat <times> - Set the repetition of the palette. toggle_attributes <1/0> [[<1/0>] ...]; - Toggle visibility of the attributes. rotmat <[0,0]> <[1,0]> ... <[3,3]> - Set the rotation matrix. camera <cam[0]> ... <cam[2]> <dir[0]> ... <dir[2]> <up[0]> ... <up[2]> - Set the camera position, direction and upward vector. scale <scale> - Set the scaling factor. translate <x> <y> <z> - Set the translation coordinates. plot_caption '<caption>' - Set the plot caption.

Similarly, handling of stream commands has been refactored, offering the following help:

Available commands are: mesh <mesh> - Visualize the mesh. solution <mesh> <solution> - Visualize the solution. quadrature <mesh> <quadrature> - Visualize the quadrature. fem2d_data <mesh> <data> - Visualize the 2D scalar data. vfem2d_data <mesh> <data_x> <data_y> - Visualize the 2D vector data. vfem2d_data_keys <mesh> <data_x> <data_y> <keys> - Visualize the 2D vector data and apply control keys. fem3d_data <mesh> <data> - Visualize the 3D scalar data. vfem3d_data <mesh> <data_x> <data_y> <data_z> - Visualize the 3D vector data. vfem3d_data_keys <mesh> <data_x> <data_y> <data_z> <keys> - Visualize the 3D vector data and apply control keys. fem2d_gf_data <mesh> <solution> - Visualize the 2D scalar grid function. fem2d_gf_data_keys <mesh> <solution> <keys> - Visualize the 2D scalar grid function and apply control keys. vfem2d_gf_data <mesh> <solution> - Visualize the 2D vector grid function. vfem2d_gf_data_keys <mesh> <solution> <keys> - Visualize the 2D vector grid function and apply control keys. fem3d_gf_data <mesh> <solution> - Visualize the 3D scalar grid function. fem3d_gf_data_keys <mesh> <solution> <keys> - Visualize the 3D scalar grid function and apply control keys. vfem3d_gf_data <mesh> <solution> - Visualize the 3D vector grid function. vfem3d_gf_data_keys <mesh> <solution> <keys> - Visualize the 3D vector grid function and apply control keys. raw_scalar_2d <data> - Visualize the 2D scalar data (see stream_reader.cpp). parallel <num proc> <proc> - Prefix for distributed mesh/solution/quadrature. screenshot <file> - Take a screenshot, saving it to the file. viewcenter <x> <y> - Change the viewcenter. view <theta> <phi> - Change the solid angle of view. zoom <zoom> - Change the zoom factor. shading <flat/smooth/cool> - Change the shading algorithm. subdivisions <times> <dummy> - Change the refinement level. valuerange <min> <max> - Change the value range. autoscale <off/on/value/mesh> - Change the autoscale algorithm. levellines <min> <max> <num> - Set the level lines. axis_numberformat '<format>' - Set the axis number format. colorbar_numberformat '<format>' - Set the colorbar number format. window_size <w> <h> - Set the size of the window. window_geometry <x> <y> <w> <h> - Set the position and size of the window. window_title '<title>' - Set title of the window. keys <keys> - Send the control key sequence. palette <index> - Set the palette index. palette_repeat <times> - Set the repetition of the palette. camera <cam[0]> ... <cam[2]> <dir[0]> ... <dir[2]> <up[0]> ... <up[2]> - Set the camera position, direction and upward vector. plot_caption '<caption>' - Set the plot caption. axis_labels '<x label>' '<y label>' '<z label>' - Set labels of the axes. pause - Stop the stream until space is pressed. autopause <0/off/1/on> - Turns off or on autopause.

🌟 Besides there are multiple other improvements:

  • Introduced Window structure bundling (some of) the shared objects, eliminating the global state. This is a lightweight version of #170 .
  • Removed most of the references to GetAppWindow() (a global function for obtaining thread-local SdlWindow)
  • Unified GLVisInitVis() and display() in aux_js.cpp.
  • Unified handling of streams (through StreamReader) and improved DataState, so all data types can be animated 🎞️ .
  • Fixed the flag for keeping of real attributes in the script command, which was broken since #235 .
  • Fixed the flag for keeping of real attributes in streams.
  • Fixed the default padding digits for data collections.
  • Fixed cycling of vector->scalar function in 2D to work with raw data
  • Improved guarding of web-only source files.
  • Fixed a typo in NOTICE.

✔️ Tests:

  • [x] some script
  • [x] serial stream
  • [x] parallel stream
  • [x] cmd-line file loading
  • [x] saved stream
  • [x] js

najlkin avatar May 06 '25 01:05 najlkin

@najlkin, can you resolve the conflicts?

tzanio avatar Sep 22 '25 20:09 tzanio

There was just the patch #343 , which is not needed here as the data structure is redesigned here, so just an empty commit 😉 .

najlkin avatar Sep 22 '25 20:09 najlkin

Mention in CHANGELOG?

tzanio avatar Sep 23 '25 21:09 tzanio

@justinlaughlin and @v-dobrev -- do you want to take a look?

tzanio avatar Sep 23 '25 22:09 tzanio