Ability to plot user-provided point line #367
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a user-provided “point line” overlay (red polyline) that can be toggled with Ctrl+l, with coordinates loadable from a points file (-pts), from the socket protocol (pointline command), or from GLVis scripts (pointline command).
Changes:
- Adds point-line state/storage (
DataState::point_coords) and a shared parsing helper (ReadPointLine). - Adds rendering support for the overlay across visualization scenes and a Ctrl+l toggle.
- Extends server/socket and script command handling to accept
pointline, and adds-ptsCLI option plus docs/changelog updates.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/vsvector3d.cpp | Adds Ctrl+l help text and queues point line overlay in the 3D vector scene render list. |
| lib/vsvector.cpp | Adds Ctrl+l help text and queues point line overlay in the 2D vector scene render list. |
| lib/vssolution3d.cpp | Adds Ctrl+l help text and queues point line overlay in the 3D solution scene render list. |
| lib/vssolution.cpp | Adds Ctrl+l help text and queues point line overlay in the 2D solution scene render list. |
| lib/vsdata.hpp | Introduces point-line drawable/bool state and helper methods to prepare/toggle/render it. |
| lib/vsdata.cpp | Implements Ctrl+l behavior and point-line buffer creation and scene queueing. |
| lib/threads.hpp | Adds a new GLVis command type + storage for point line coordinates. |
| lib/threads.cpp | Implements pointline socket command parsing and execution wiring into the renderer. |
| lib/script_controller.cpp | Adds pointline support to the GLVis script command set. |
| lib/data_state.hpp | Adds point_coords to shared state and declares ReadPointLine. |
| lib/data_state.cpp | Implements ReadPointLine parsing helper and moves point_coords in move-assign. |
| glvis.cpp | Adds -pts option, loads point coordinates from file, and forwards them into server sessions. |
| README.md | Documents Ctrl+l toggle and references -pts. |
| CHANGELOG | Adds an entry documenting the new point line overlay feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Jan Nikl <nikl1@llnl.gov>
Conflicts: glvis.cpp lib/vsdata.cpp
Co-authored-by: John Camier <camierjs@gmail.com>
Co-authored-by: John Camier <camierjs@gmail.com>
|
@najlkin, @dylan-copeland, @v-dobrev and @camierjs -- all reviewer comments have been addressed and I tested that this works, can you take another look? |
|
How about showing the overlay line by default when loaded from command line? That is expected behavior, I would say (why to load it otherwise...), and also it is better for headless rendering, so you do not need to send the |
Hmm, it has not happened to me, it is only with ZLib, I guess. Anyway, fixing it by the copy of |
|
I know it is not just Zlib, but without MFEM compiled with Zlib, |
|
Thanks @najlkin, @dylan-copeland, @camierjs and @v-dobrev! |
Overview
This PR adds an optional point line overlay (useful e.g. for reference curves), which can be toggled with Ctrl + l.
Points can be loaded from a file with the
-ptscommand-line option, sent via socket with thepointlinecommand, or specified in a GLVis scripts. The points line format is: number of points, followed byx y zcoordinates.The overlay appears as a red line connecting the given points.
Testing
Stand-alone with input from file
Use this circle_points.txt points file to run
and press Ctrl + l.
Server mode with input from file
Run
then send a solution via socket, e.g. from
mpirun -np 4 ./ex1pand press Ctrl + l.Server mode with input by socket
Add sample points to the solution socket output in one of the examples, e.g. in
ex1.cpp:start a server with
./glvisand then run./ex1 -m ../data/escher.mesh.The point line should appear by default and can be turned off/on with Ctrl + l.
In server mode, input by socket overrides input by file. In parallel, all ranks send point lines, but only the one from rank 0 is considered.
GLVis script
Use the files in this archive: test_pointline.zip to run
Press Space and rhe point line should appear; it can be turned off/on with Ctrl + l.
Potential improvements