Skip to content

Conversation

@najlkin
Copy link
Contributor

@najlkin najlkin commented May 6, 2025

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 Refactoring to remove global state #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 Parallel streams for web version #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:

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

@najlkin najlkin self-assigned this May 6, 2025
@najlkin najlkin changed the title Refactoring and scripts commands help Refactoring with scripts and stream commands help May 6, 2025
@najlkin najlkin mentioned this pull request Jun 4, 2025
@najlkin najlkin requested a review from camierjs June 4, 2025 21:38
Copy link

@camierjs camierjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great!
Tried down to the emscriptem & JS: looks good!

@tzanio
Copy link
Member

tzanio commented Sep 22, 2025

@najlkin, can you resolve the conflicts?

@najlkin
Copy link
Contributor Author

najlkin commented Sep 22, 2025

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

@tzanio
Copy link
Member

tzanio commented Sep 23, 2025

Mention in CHANGELOG?

Copy link
Member

@tzanio tzanio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @najlkin !

@tzanio
Copy link
Member

tzanio commented Sep 23, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants